Game Development Reference
In-Depth Information
Note
Unity allows you to edit your game as it is running. This is great if you
want to test out an idea to see how the game will react. Be careful
though because any changes you make in the editor, while play is on,
will revert back to their previous value when you press stop. This can
be very annoying if you've made large changes not realizing you are in
play mode as they will be wiped away as soon as you press stop. The
only exceptions to this are script files because they are edited and saved
externally to the editor. Changes made in script files are independent
of the play button.
Step 7. Although lighting is a subject usually delayed for more
advanced topics in game development, the author always like to
add a light to scenes to give them more depth and bring them
alive. In the Scene, the cube is already shaded, as this is the default
method of drawing. However, in the Game, the cube is a lifeless,
flat, gray square. To add a light, select GameObject > Create Other >
Directional Light from the main menu. A light displaying as a little
sun symbol will appear in the Scene and the cube in the Game will
become brighter.
Step 8. Now because we are looking at the cube front on in the
Game, it still appears as a little square. Therefore, we need to
transform it for viewing. A transformation modifies the properties
of position, rotation, and scale of a GameObject. The specifics of
transformation are discussed later, but for now you can transform
the cube quickly using the W key for changing position, the E key
for rotating the objects, and the R key for scaling it. Before pressing
any of these keys, ensure that the cube is selected in the Hierarchy
window. When it is selected, it will have a green and blue wireframe
displayed on it.
Step 9. In W (position) mode, the cube will be overlaid with red,
green, and blue arrows. These represent the x , y , and z axes of the
object. Clicking and dragging from any of the arrowheads will move
the object along that axis. To move the object freely, click and drag
from the central yellow box.
Step 10. In E (rotate) mode, the cube will have red, green, and blue
circles drawn around it. Click and drag any of these circles to rotate
the cube in the associated directions.
Step 11. In R (scale) mode, the red, green, and blue axes will include
small cubes on the ends. Clicking and dragging any of these will
change the scale of the object in the respective directions. You may
also click and drag the central small cube to resize the object in all
directions uniformly. Note that while you are moving, rotating, and
Search Nedrilad ::




Custom Search