I am trying to make the skybox change when the Directional Light is on or off, but I am having trouble. I looked everywhere and can’t seem to find a working answer.
Code:
#pragma strict
var light : GameObject;
var NightSky : Material;
var DaySky : Material;
function Start () {
}
function Update () {
if ( light.active(false)){
RenderSettings.skybox = NightSky;
}
if ( light.active(true)){
RenderSettings.skybox = DaySky;
}
}
Can you edit it for me so it works? Thanks a lot.