Underwater Script

So i was browsing the answer forums and i could not find anything similar to what i needed. I tried my own script, but it didn’t work. Nothing at all

public var underwater = 90;

function Update() {

if(transform.position.y < underwater)

{

color = Color (56, 166, 198, 122);

RenderSettings.fogColor = color;

RenderSettings.fogDensity = 0.1;

}

else

{

color = Color (78, 142, 149, 122);

RenderSettings.fogColor = color;

RenderSettings.fogDensity = 0.0004;

}

}

1 Answer

1

That’s not how 1 works