I’d like to find a camera that is tagged “MainCamera” and change some of the values for the variables in the “SmoothFollow” Script.
However, this isn’t working as I planned. I keep getting an error that says the camera object isn’t referenced when I try to manipulate the vars. Here is the code I have.
**var currentcamera:GameObject; var currentcamerainfo; if(Input.GetButtonDown("CamButton"))// { currentcamerainfo.Distance+=1; currentcamerainfo.Height+=1.5; }**
This is all set to be setup during the awaken function. Which is this segment of code:
**function Awake() { currentcamera=GameObject.FindGameObjectWithTag("MainCamera"); currentcamerainfo=currentcamera.GetComponent("SmoothFollow.js"); }**
Does anyone know why the camera isn’t being assigned to the current camera variable?