I’m trying to get an enemy to look at a target, but I can’t get it to work. I tried using this too:
var target : Transform; function Update () { transform.LookAt(target); }
But I can’t set the value of “target” because the enemy is a prefab! Is there anyway to set the value of target in the script? I tried using this:
var target : Transform; function Update () { target = GameObject.Find("I put the name of my target here"); transform.LookAt(target); }
But I can’t use that because it can’t convert a GameObject to a transform. I also tried using “transform.Find” but that didn’t work either. Thanks in advance! (P.S. I’m using unity 3.5)