Time for action – move and rotate the light

This new light is kind of in the way, and a big chunk of our ball isn't properly lit. Let's fix that.

  1. Ensure that the Directional Light is still selected. If you deselected it, click on the Directional Light label in the Hierarchy panel.
  2. In the Inspector panel, change the light's position to move it up and out of the way. Enter 0 for the X position, 4 for the Y position, and -4 for the Z position. moving a directional light like this does not alter its intensity, but we're just making sure it's within reach in the Scene view.
  3. Rotate the light so that it shines down on the objects. Enter a value of 44 for the light's X Rotation in the Inspector panel. The other two rotation values should be zero.
    Time for action – move and rotate the light
  4. Now, the light is casting its sunny rays a bit more pleasantly on our Scene:
    Time for action – move and rotate the light

Have a go hero

If you're feeling adventurous, now's a great time to get a better feel for these virtual lights. Switch to the Rotate mode by using the controls at the top-left corner of the screen, or press the E key on your keyboard. You can freely rotate the light around to see how it affects your objects:

Have a go hero

Switch to Move mode by clicking on the Move icon or by pressing W on the keyboard. Click on the Transform gizmo to move the light around the scene. How does moving the light affect the way your objects appear?

Kill the light by pressing Delete on the keyboard (command + Delete if you're on a Mac). Add one of the other two types of lights—a spotlight or a point light—by navigate to GameObject | Create Other and choosing another light. You can also change an existing light's type in the Type drop-down menu in the Inspector panel. What's the difference between the light you chose and the directional light? Move the new light all around to get a sense of how each light type treats your objects slightly differently.

Here are the differences between the lights in a nutshell:

  • Directional light: This light can travel an infinite distance and illuminate everything in the Scene. This kind of light works like the sun. As we've seen, it doesn't matter how large or small a directional light is, or where you place it in the Scene—only by rotating it can we determine which surfaces it illuminates.
  • Point light: These lights start at a point in 3D space and shine all around like a light bulb. Unlike directional lights, point lights have a range—anything outside of that range doesn't get lit.
  • Spotlight: Spotlights are cone-shaped. They have a range and a direction. Objects outside a spotlight's cone don't get lit by that light.
  • Ambient: This is the default type of lighting that you see in your Scene, without adding any light game objects. Ambient lighting is the most efficient, but it's also the most boring. You can crank the level of ambient lighting in your Scene up and down by fiddling with the render settings (Edit | Render Settings). Try clicking on the Ambient Light swatch to cast a creepy, bright green glow over your entire Scene, as shown in the following screenshot:
    Have a go hero

Extra credit

If this lighting stuff really revs you up, check out all of the settings and things to fiddle with within the Inspector panel when you select a light. You can get more information on what these and any other Component settings do by clicking on the blue book icon with the question mark on it in each Component section in the Inspector panel.