Hello,
I’m having some issues with a day night cycle. I have a snippet below that shows what I’m trying to do with the skybox. I removed the rest of the time and lighting code bits and have tested with the bare minimum below and it won’t work after the initial change.
functionUpdate()
{
if (dayTime == true)
{
RenderSettings.skybox.Lerp (skyboxNight, skyboxDay, .01);
}
if (nightTime == true)
{
RenderSettings.skybox.Lerp (skyboxDay, skyboxNight, .01);
}
I think you need to lerp the Skybox.material.color from white to black or something.
Unity - Scripting API: Material.color,
or possibly use a shader. Do a search for Unity day/night cycle and see what comes up.
I think a good start would be to ditch the bools and instead do a time of day float.
Then you would want to transition the skybox based on that value.
That, or you could do a 3d skybox with a second camera.
At any rate, this is a little above my level. Sorry.
figured out I did need a shader to make it work.
1 Like