Animated Skybox

Hey,

I was wondering if there is a way to change the color of the sky (via Skybox materials) based on the players score increasing or decreasing.

If the players score increases, I want the sky to dynamically go from dark to light based on the score(maybe through an Animated Skybox, if possible).

Is anything like this possible in Unity? If so, does anyone know if a Script needs to be involved and where I can find it?

Thank you so much, once again =)

–Velk

This might work for what you want to do, or it may need to be modified. I haven’t tried it with Unity 2.0 yet.

I’ll try it out right now and let you know how it works!!

Once again, BIG THANK YOU and /bow

–Velk :lol:

Other than that, the color of the skybox is controlled by “Tint Color” in the skybox material. So you can control that color from your script somehow (how exactly is up to you).

RenderSettings.skybox gets to the skybox material, and then use SetColor to change the color.

For example, this script attached to any game object will make skybox intensity randomly change a bit 20 times a second. Does not look very good, but that’s only an example :slight_smile:

function Start() {
    Flicker();
}

function Flicker() {
    while( true ) {
        var val = Random.Range(0.45,0.55);
        RenderSettings.skybox.SetColor( "_Tint", Color( val, val, val, val ) );
        yield WaitForSeconds(0.05); // wait 1/20th of a second
    }
}

Thanks Aras, I’ll try that out and let you know how it works =)

cheers

–Velk

This doesn’t seem to work.

RenderSettings.skybox.color nor RenderSettings.skybox.SetColor seem to have any effect. Is this a bug?
Or is their another way to change the skybox color?

Found it! :slight_smile:

var theSkybox : Material;

function Start () {
theSkybox.SetColor("_Tint", Color (1.0, 0.0, 0.0) );
}

And then you just drop the skybox material onto the scripts variable slot.