Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Accessing C# scripts from other objects

$
0
0
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(); ColCorEffect = PlayerCamera.GetComponent(); GloFogEffect = PlayerCamera.GetComponent(); } // 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; } } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>