Version 2018.2.11f Personal
I’m trying to rotate a Directional Light to achieve a sun 360 smooth rotation in my scene. I wrote this function and called it in the Update function. The directional light does rotate as expected, but its movement generates an annoying flickering. I’m guessing the Update function and the light calculations rate do not match, but calling the function in FixedUpdate makes the flickering worse (the skybox becomes alternately black and blue). What am I missing?
//Updates Skybox
void UpdateSkybox()
{
//Calculates new directional light x angle
currentRotation += rotationSpeed * Time.deltaTime;
if (currentRotation >= 360)
currentRotation -= 360;
//Updates Skybox
skybox_rot_buffer = Quaternion.Euler(currentRotation, skybox_rot_buffer.eulerAngles.y, skybox_rot_buffer.z);
directionalLight.rotation = skybox_rot_buffer;
}