wiki.sine.space | sinespace

Day/night cycles

From wiki.sine.space
Revision as of 08:52, 16 January 2019 by HannahT25 (Talk | contribs)

Jump to: navigation, search


This wiki entry describes how to set up day and night on your Sinespace region using the Day Night Cycle Script component.

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.


Adddaynightscript.png
Fig. 1: Adding the Day Night Script component to the directional light

Component Settings

Preview

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.

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 "Directonal Light" controls the sun light. You can find the Quick-start region by going to Assets>Sample Art>Quickstart in the Project window.


Quickstartregion.png


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. I'm uncertain how that will play out if your day length is other than 24 hrs.

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.

Selecting some type of shadows and adjusting them will produce that effect.

You can add events like playing musics, animations. The events trigger is set to Dawn, Midday, Dusk, and Midnight.

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.

Note: When you change the colour of anything here, everything in the region will change to this colour.


Lightdetaildaynight.png
Fig. 2: Directional light details