Time for action – manipulating the scene
When you've opened your project, you'll notice that there's only one object in your Hierarchy menu by default; the Main Camera object, which projects the game screen. Now perform the following steps:
- Select that camera by clicking on it in the Hierarchy menu once. While the camera is selected, you can see an outline of its view plane in the Scene window.
Tip
Think of the camera in Unity as a cameraman on a movie set. Everything he sees ends up on the screen, and if something is out of his view, it doesn't make it into the movie. As a developer, you can see everything in your Unity scene at all times, but when you publish your game, the player will only be able to see what the camera captures. Don't worry about this yet—we'll get into camera programming later.
You'll also notice that while the camera is selected, there are three colored arrows pointing in different directions from the camera's origin. These arrows represent the three axes of position in the game world.
- Click-and-drag on these arrows to move the camera back and forth on their respective axes. If you grab the camera from the center cube, you can move it across all three axes at the same time. All other game objects can be moved with this same method.
Notice the values in the Inspector window while you drag the camera. As you move it through the game world, its coordinates update in the Transform pane. Alternatively, you can enter a set of coordinates manually into the position axes, and the selected object will move to those coordinates in the scene.
Moving objects in your scene isn't too helpful from just a single perspective, so Unity has keyboard controls to navigate all dimensions of your scene.
To enter the navigation mode, hold down your right mouse button while your cursor is over the Scene view. You can move the mouse while the button is held down to look around, or use the W, A, S, and D keys to move forward, left, backwards, and right, respectively. You can also move upwards with the E key and downwards with the Q key. If you wish to move faster at any time, holding down the Shift key will increase your speed.
Moving around in an empty world isn't going to do anything for us, so let's add some objects to the scene. Before we can see any physical object clearly, we need to light the scene, so a light will be the first object we add.
- At the top of your Hierarchy window, there's a button labeled Create. Click on it and select Directional Light from the drop-down menu. Your light will then appear in the Hierarchy and Scene views, with outlines to show the orientation of the light.
We picked a directional light because it's a simple and fast way to light any scene, but there are four main types of lights in Unity that offer their own uses. They are as listed in the following table:
Each light also has its own individual properties that can be changed in the Inspector menu. These properties include Color, Intensity, Shadow Type, and so on. Once you've set up a scene, don't be afraid to play with light settings and watch the game world change in real time in the Scene window.
You now have an empty, lit world and you're ready to fill it with physical objects.
- Go back to the Create button at the top of the Hierarchy window and select Plane. Set every position axis to
0
in the Inspector window so that the plane is in the middle of the scene, and then set your camera's X, Y, and Z position axes to0
,2.5
, and-10
so it has a good view of the plane we placed.When you're finished, your environment should look something like as shown in the following screenshot (your Scene view will vary based on where you positioned it):
What just happened?
Thoroughly remember the steps you just performed, because it's how you'll start every project in Unity. Cameras and lighting may not be things we actively notice in games, but they're of paramount importance in Unity. Without them, everything we'd see would be dark or out of the frame, which isn't a suitable stage for your creations.