Getting Started with Unity 3D

Now that you've downloaded the software, let's make a start. In this section, you'll find your way around Unity and get used to the software as we create a very basic driving game. So, from your computer's Start Menu, launch Unity Hub. You'll see this screen:

Unity Hub

Make sure the Projects tab is selected on the left. In the top right, there's a New button with a white arrow beside it. You can create Unity projects using different versions. Click the white arrow to show which software versions you have:

Unity Hub list of sofware versions

Unity nags you a lot about new versions. However, it doesn't update the version you have. It installs a new version and displays which version of the software you have on this list.

But click the New button or a version on the list to see this screen:

Unity Hub, new project dialog box

Make sure the 3D item is selected on the left. On the right, under Settings, type a name for your project. Call it anything you like. Then click the Create button at the bottom.

The software itslef can take a while to loa. But when it does, you'll see this screen:

Unity 3D software in full screen mode

There are five important areas highlighted in the image above:

Hierarchy
Inspector
Project Files
Scene
Game

Let's go through them.

Hierarchy
This is a list of all the game objects that are in your scene. When you first create a project, a camera and a light will be added by default.

Inspector
When you select a game object, you'll see a list of components that are attached to that game object. Each component will have lots of settings you can change.

Project Files
All the files in your project.

Scene
This is where you create your game.

Game
This tab lets you see what your game looks like when played.

In the hierarchy on the left, click the Main Camera item to select it. In the Inspector ont he right, you should see a list of all the components attached to the Main Camera:

Unity 3D Inspector with the Main Camera selected.

Despite how big the list is, there are only three components attached to the Main Camera: a Transform, a Camera, and an Audio Listener. Notice how many settings you can change.

When you select the camera in the hierarchy, you'll also see the camera component selected in the scene. You'll also see what the camera is looking at. This is shown in a box in the bottom right:

Scene view in Unity with the Main Camera selected

Notice the three coloured arrows when you select the camera. These are directional arrows and appear whenever a game object is selected in your scene. The green arrow is for the Y (up and down direction), the red arrow is for the X direction (left and right), and the blue arrow is for the Z direction (near and far away).

In the hierarchy, click the Directional Light object to select it. The camera view in the bottom right will disappear. But notice we still have the coloured arrows:

Scene view in Unity with the Directional Light selected

The four lines are showing you in which direction the light is shining. If you look in the Inspector window on the right, you'll see that there are two components attached to the light: a Transform and a Light. (All game objects have a Transform component.)

Now let's see how to move around in a Scene.

First, let's add a game object. We'll add a cube to the scene.

At the top of Unity, you'll see a menu bar with items for File, Edit, Assets, Game Objects, Component, Window, and Help. Click the Game Object item. From the menu that appears, select 3D Object > Cube:

Unity Game Object menu to insert a Cube in a scene.

When you select the Cube item, two things happen: one, a cube appears in the Scene window and, two, a new item with the default name of Cube appears in the Hierarchy window:

A 3D cube inserted into a Scene in Unity

With the cube selected, take a look at the Inspector window on the right. The cube has four components attached: a Transform, a Cube (Mesh Filter), A Mesh Renderer, and a Box Collider. We'll concentrate on the Transform component. Notice it has three items: a Position, a Rotation, and a Scale. Let's play around with these, see what they do.

In your Hierarchy window, double click your Cube item. This will zoom you in on the cube. In the Inspector window, notice that the position in the image above is 6.1620 for X, -0.136 for Y, and -15.57 for Z. Now hold your mouse over the cube's red arrow in the Scene view. Hold down your left mouse button on the red arrow. Keep it held down and drag. Watch the X value change in the Inspector window as you drag. The numbers will change. Now do the same for the green and blue arrows. Watch what happens in the Scene view to your cube and its Y or Z values in the Inspector.

You should notice that the cube moves up and down when you drag the blue arrow:

Moving a game object in the y direction

It moves near and farther away when you drag the blue arrow:

Moving a game object in the z direction

And the cube moves from left to right when you drag the red arrow:

Moving a game object in the x direction

If you want to move your cube to the centre of the scene, you can reset its position quite easily. Click the three dots to the right of the Transform heading in the Inspector:

Unity Inspector showing the reset transform button

A menu will appear. Select Reset:

The reset menu

The X, Y and Z values in the Inspector will now all be 0:

The Inspector showing the Transfor Position values reset to zero.

(If you suddenly can't see your cube in the Scene window, simply double-click it again in the Hierarchy.)

Note that you can also click inside of the text boxes where the numbers are. Delete the old value and type a new one. (Another way to change the values is to hold your left mouse button over the X, the Y or the Z. Keep it held down and drag left or right.)

You can also use the toolbar at the top of Unity to get the position arrows. Just click the Move icon to see the coloured arrows:

The Move icon highlighted

Rotate
Just under the Position transform in the Inspector is the Rotation transform. To see how that works, and with your cube selected, click the rotation icon in the toolbar at the top of Unity:

The Rotate icon highlighted

You will then see coloured circles instead of coloured arrows appear on your cube:

A 3D Cube being rotated in Unity

Hold your left mouse button down on one of the coloured circles. Keep it held down and drag. Notice which way the cube moves as you drag. Try all the coloured circles and note which ones are the X, the Y, and Z axis. Does the cube rotate the way you expected? If not, bear in mind that it's rotation on an axis. For example, the Y axis goes up and down. The cube will, therefore, rotate from left to right (or vice versa) .

You can, of course, simply type a value in the text boxes. In the image below, we've rotated the cube 5 degrees on the Y axis, 28 on the Y axis, and 10 on the Z:

The Inspector showing values entered for the rotation

To get your cube back in the rotation it was before, you can reset it, just like you did with the Position. Clicking reset from the menu resets the Position, the Rotation, and the Scale.

Scale
You can also scale the cube. You can type new values into the Scale textboxes. Or, you can use the Scale arrows. To do that, click the Scale icon on the Unity toolbar:

The Scale icon highlighted

When you click the Scale icon, you'll see arrows appear on your cube. This time, the end points of the arrows are squares:

A 3D cube being scaled

Mouse Movement
You can move around the Scene view itself with the aid of your mouse. To zoom in and out, make sure your mouse is somewhere over the Scene. Now scroll your middle mouse button. To pan round, hold down your middle mouse button and drag. Alternatively, click the hand icon in the Unity toolbar at the top:

The Pan icon highlighted

With the hand tool selected, hold down your left mouse button and drag to pan around the scene.

If you hold down your right mouse button anywhere in the scene, you can rotate the scene itself to give you a better view of things.

So, to sum up:

Mouse Wheel: scroll your mouse wheel to zoom in and out.
Mouse Wheel: Hold down the mouse wheel to pan.
Left Mouse Button: Select the hand icon from the toolbar, hold down your left mouse button and drag to pan around your scene.
Right Mouse button: Hold down your right mouse button to rotate your scene.

In the next lesson, what we'll do is to create a basic box car using cubes, cylinders and materials.

<--Back to the Unity 3D Course Contents Page