Hello,
I am trying to make rotating Directional Light for changing 2 skyboxes depending on transform.rotation.x value, but it doesn’t work. It is ignoring IF/ELSE statement. Anyone know how could I make it? Here is the script for better understanding:
#pragma strict
var daySpeed : float;
var DaySkybox : Material;
var NightSkybox : Material;
RenderSettings.skybox = NightSkybox;
function Start() {
daySpeed = 0.1;
}
function Update() {
transform.Rotate(daySpeed, 0, 0);
if(transform.rotation.x > 0 && transform.rotation.x < 270) {
RenderSettings.skybox = DaySkybox;
}
else{
RenderSettings.skybox = NightSkybox;
}
}