- Home /
Can't change fog color!
Hi there.
I ran into this problem: i am unable to change the fogs color, not with the scripted palette, not even without a set variable, giving it color manually in script. It always stays an ugly brown shade. Here is my script:
*var fogColor = Color (1,1,1,1);
private var defaultFog = RenderSettings.fog;
private var defaultFogColor = RenderSettings.fogColor;
private var defaultFogDensity = RenderSettings.fogDensity;
var noSkybox : Material;
var normalSkybox : Material;
function Start () {
//Set the background color
camera.backgroundColor = Color (1, 1, 1, 1);
}
function OnTriggerEnter ( other : Collider) {
if (other.gameObject.tag == "WaterCollider") {
RenderSettings.fog = true;
RenderSettings.fogColor = fogColor;
RenderSettings.fogDensity = 0.04;
RenderSettings.skybox = noSkybox;
}
}
function OnTriggerExit ( other : Collider) {
if (other.gameObject.tag == "WaterCollider") {
RenderSettings.fog = defaultFog;
RenderSettings.fogColor = defaultFogColor;
RenderSettings.fogDensity = defaultFogDensity;
RenderSettings.skybox = normalSkybox;
}
}*
All other functions work fine ,so it only triggers when entering the tagged colliders, and it reverts when the collider are left. But its no good withour a blue-ish colour,im not swimming in sewer water! Any help would be greatly appriciated.
Thank you for your time.
Are you sure that the collider exit event is not triggered while you are under water? it will happen if your trigger has a very small height (y-axis size).
I just figured out... Another script overwritten it. I are de dumb.