I’m sure this is asked a lot, but I have looked around but nothing seems to help fix this. I have a script that is going to activate image effects on a camera when the camera goes below a certain y value. I have linked the camera GameObject through the script and that seems to work fine, however, when I tried to link the three image effects, I get errors for each one stating that “The type or namespace name could not be found”
Here is the script:
using UnityEngine;
using System.Collections;
public class WaterEffect : MonoBehaviour {
GameObject WaterTop;
GameObject WaterBot;
bool UnderWater;
GameObject PlayerCamera;
private Blur BlurEffect;
private ColorCorrectionCurves ColCorEffect;
private GlobalFog GloFogEffect;
// Use this for initialization
void Start ()
{
PlayerCamera = GameObject.Find("FirstPersonCharacter");
BlurEffect = PlayerCamera.GetComponent<Blur>();
ColCorEffect = PlayerCamera.GetComponent<ColorCorrectionCurves>();
GloFogEffect = PlayerCamera.GetComponent<GlobalFog>();
}
// Update is called once per frame
void Update ()
{
if(PlayerCamera.transform.position.y < gameObject.transform.position.y){
UnderWater = true;
BlurEffect.active = true;
ColCorEffect.active = true;
GloFogEffect.active = true;
} else if(PlayerCamera.transform.position.y > gameObject.transform.position.y){
UnderWater = false;
BlurEffect.active = false;
ColCorEffect.active = false;
GloFogEffect.active = false;
}
}
}