RenderSettings.skybox not working

var dayBox1:Material;

function Update(){
    RenderSettings.skybox=dayBox1;
}

I assigned the dayBox1 variable in the inspector, but for some reason the sky will always appear the default blue color. I also have assigned this script to an object in the scene. How can I make this work?

Have you tried setting the skybox on the camera instead? Something like…

   GameObject camera = Camera.main.gameObject;
   Skybox skybox = camera.GetComponent<Skybox>();
   if (skybox == null)
     skybox = camera.AddComponent<Skybox>();
   skybox.material = dayBox1;