Creating a flashlight
Now that our level looks like a dark night, we still want to give our players the ability to see what's in front of them with a flashlight. We will customize the First Person Controller object to fit our needs:
Create a spotlight by navigating to GameObject | Create Other | Spotlight. Once created, we are going to make the spotlight a child of the First Person Controller object's Main Camera object by dragging-and-dropping it on top of it.
Once a child, change the Transform Position value to (
0
,-.95
,0
). Since positions are relative to your parent's position, this places the light slightly lower than the camera's center, just like a hand holding a flashlight. Now change the Rotation value to (0
,0
,0
) or give it a slight diagonal effect across the scene if you don't want it to look like it's coming straight out:Now, we want the flashlight to reach out into the distance. So we will change the Range value to
1000
, and to make the light wider, we will change the Spot Angle...