Game Development Reference
In-Depth Information
effects or music. 3D sounds are location dependent in the scene; they get louder when approached
and fainter the farther away they are. This variation in volume to produce the 3D effect is handled
automatically by Unity, so there are no properties in the Audio Listener to adjust.
The Audio Listener gathers the sound from the various audio sources to deliver to the player through
their device speakers. Only one Audio Listener is needed for each scene. Unity attaches it to the
Main Camera so any new scene will be audio capable, but you could move it to another game
object, typically the player, depending on your game needs.
Light
At this point you have a new scene with a skybox background and a Cube game object. If you
enter Play mode, the cube remains dark. No matter how much light might be present in the skybox
texture, it is just a texture, or image of a sky, and does not project light onto the game objects in the
scene. For this you need a Light game object. Examples include:
1.
Directional light : Acts like sunlight to illuminate every game object in the
scene, though it does not come from a single point source.
2.
Spot light : Cone-shaped area of light from a single point that acts like a
spotlight or flashlight.
3.
Point light : Acts like a light bulb, shining in all directions from a central point.
4.
Area light : Used for baking into lightmaps and is beyond the scope of this topic.
Using either the Create button in Hierarchy view or Game Object ➤ Create Other from the top menu,
add a directional light to the scene. If you select Main Camera, you'll see in the Camera Preview that
the cube has brightened considerably. Reselect the Directional light and take a look at the properties
in the Inspector.
The first property is Type. Even though you created a directional light, you can change it to another
type of light using this drop-down menu. Notice the Inspector remains context sensitive and the
properties change depending on the type selected, but the name “Directional light” in the Hierarchy
view does not reflect any changes made here.
Common Light Properties
I want to mention again the importance of hands-on experimenting with Unity. The following
description of light properties is not meant to come across as a droning lecture—these properties
are better seen and experienced rather than passively read about. Though I'm not including
step-by-step instructions for each one, I highly encourage you to test each one in Unity so you can
see what it does both in the Scene view and in Play mode. Remember, you can always use the Light
component's gear icon to reset the properties.
 
Search WWH ::




Custom Search