Ok, I have a total of 3 cams on all the time, the main view, a Minimap cam that follows you around, and a panel cam off screen pointing on stats and info.
I am trying to make a code that when you are underwater, it would fog the maincamera, atm, it fogs, just the mini map camera not the main camera.
I attached the script to the main camera that is attached to the player, but it dosent change renders I guess on that cam for some reason changing a diffrent cam also attached to the user, the mini map cam. With this code, can someone show me how to assign the fog to only one camera, the maincamera, and not to touch/change the panel or mini map cam?
var WaterLevel : float;
private var isUnderWater : boolean;
private var normalColor : Color;
private var underwaterColor : Color;
function Start ()
{
normalColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
underwaterColor = new Color(0.22f, 0.65f, 0.77f, 0.5f);
}
function Update ()
{
if((transform.position.y < WaterLevel) != isUnderWater)
{
isUnderWater = transform.position.y < WaterLevel;
if(isUnderWater) SetUnderWater();
if(!isUnderWater) SetNormal();
}
}
function SetNormal()
{
RenderSettings.fogColor = normalColor;
RenderSettings.fogDensity = 0.002f;
}
function SetUnderWater()
{
RenderSettings.fogColor = underwaterColor;
RenderSettings.fogDensity = 0.03f;
}