I need help with this code:
//var thetarget : Camera.main;
var cam : Camera = GameObject.Find("Main Camera");
function Update()
{
transform.LookAt(transform.position + cam.forward);
}
The issue that I am having is that on my spawned enemies the camera is lost if I uncomment the first line and set the camera. but i want it to find the main camera automatically…
i get an error with the above in that : BCE0019: ‘forward’ is not a member of ‘UnityEngine.Camera’.
does this make sense?