Day/night cycle
This describes how to set up day and night on your Sinespace region using the Day Night Cycle Script component.
Last updated
This describes how to set up day and night on your Sinespace region using the Day Night Cycle Script component.
Last updated
Sinespace® is a registered trademark of Sine Wave Entertainment Ltd, All Rights Reserved.
First you will need a directional light to which to attach the script component. A directional light was included when you created a new scene. If one isn't in the hierarchy panel (maybe you deleted it), you'll need to add one. Go to the menus at the top of the editor window and click Game Object - Light - Directional Light.
You'll need to add the Day Night Circle component (script) to your directional light. You can create a new empty object to attach with this component.
Preview is where you can toggle on and off 'Preview Enabled' to be able to see the lighting for different times of day in your Unity scene. You can drag the Preview Time of Day along to see what different times of day look like. The slider is set to 0 to begin with, this is midnight. 0.5 is midday. You should disable the preview before uploading the region.
By default, the light will be particularly harsh, the cycle will be set to 1440 minutes (a full 24 hr day), and start from mid night. You can modify the duration as you wish. Toggle the "Use local System Clock" on will use your local timestamp instead of using server time.
If you pick "Use Fixed", the time will be locked, you can set the time you want fixed by modify the slider bar of "Fixed Time of Day", the value is from 0 to 1, corresponding the color bar of sun.
Next drag the "Sun light" object into the Sun Light slot. If you create the region by using quick start, then it's the object called "Directional Light" that controls the sun light. You can find the Quick-start region by going to Assets>Sample Art>Quickstart in the Project window.
Fig. 2: How to find quickstart
Fig. 3: Directional Light Settings
If white light is too harsh for you, you can change the color of this by changing the 'Sun Light' color on the Day /Night cycle component, not on the directional light.
You will need to change the 'Flare' setting on the Directional Light so that the flare is set to Sun. You can do this by clicking on the circle next to the Flare box, and choose Sun.
This is to update the reflection probes in the region. The 'Update Cubemap Frequency' number is in seconds, so if you want to update the cubemap frequency every 30 seconds, leave it as it is. This basically changes the amount of light reflection on objects in the region, e.g. at night time you don't want reflective surfaces to reflect too much light.
This is where you drag in the directional light for the 'Sun'. You can set the color of the sunlight here, and also set the Sun Offset Rotation and Sun Rotation Axis. The Sun Offset Rotation and Sun Rotation Axis control the value of the movement of the sun during the day time. If you don't need a custom trail of movement for the sun, just leave it as default.
The Sun Shafts image effect simulates the radial light scattering (also known as the “god ray” effect) that arises when a very bright light source is partly obscured. Here you can change the colors of the sun shafts. You can check the 'Update Sun Shafts' to keep the sun shafts updated when objects are placed in the region.
This will change the ambient light in the region. You can change the sky color, Equator color (This is the horizon area) and ground color.
You can change the colors for fog here and change the fog minimum curve and maximum curve. The fog curves set the minimum distance and maximum distance of fog, which in turn changes the amount of fog at certain times of day. You can click on the fog bar to change the curve between the values of 0 and 1.
If you have water-like things in your scene, you can attach its material to the water material slot, which can make the light affect to the water too. You can change the colors for the water here if you wish.
You can add events like playing music and animations. The events trigger is set to Dawn, Midday, Dusk, and Midnight. You can set this up to notify specific animators as well.
Toggling the 'Use local System Clock' and 'Shader send time of day' together will align your day/night cycle with your real-world local time. The Shader Send Color option will send the colors under the shader bar to the Lighting, meaning the lighting will change to these colors at certain times of day.