Example 1 - Day Night Cycle

Example 1 shows how to utilise the Day/Night manager system with Game Creator. The Day/Night manager component must be added to your scene and this is easily done by creating an empty Game Object and adding the component.

You will also see that in the example, we have added a Sun and Moon object using Unity's Light components. These are then added to the Visual Settings in the Manager script. The Moon is optional.

The start time and start day can be configured from GC Variables or just added as a value. The advantage of using Variables, is that you can increment them and allow the game to start from the same time/day as it was when the game was saved. Real Time speed can also be used, or you can use your own minutes per day. By allowing this to be a variable, you could also let your player set their own time speed. The Sun curve lets you change when the sun rises and sets, and the Season setting changes the path of the sun through the sky. You can also allow the Skybox to rotate, and this can imitate moving clouds.

Finally, there is the ability to execute Actions. These Actions are created as any Actions are, and then dragged into the Action to Execute slot. You can chose which day of the week, what Hour and minute, or allow it to happen everyday. As shown in the example. we have an Action to start rain, and then to stop rain, and Action to start snow, and to stop snow, and an Action to rotate the day skybox, and to swap the skybox to night time.

This Module comes with many other useful Actions. You can advance the time of day, change the sun intensity, change the weather, and even set the terrain texture. Procedural Skyboxes can to modified, the time (virtual game time) can be saved at any point in your game.

Please review the Actions we have used in this example and experiment with them to learn more.

Last updated