If we are creating an open world title or any kind of game where the player is outdoors, one thing that would be nice is the ability to have our world change the time of day at the same rate.
Before we start working, we should have a level created with a Sky_Sphere
and a directional light (the default map has this). To be sure, you can use the DayNightCycle-Before
map from the example code folder.
Perform the following steps to create a day/night cycle:
As we discussed before, we can use Directional Lights to act like the sun. For our day/night cycle we will want our lighting to change over time, so let's select the
DirectionalLightStationary
object from the Scene Outliner tab and then from the Details tab, change the Mobility property toMovable
. Finally, change the name of the object toDirectionalLightMovable
.Note
You can either rename the object from the Details tab or press F2 when selected in the Scene Outliner tab.