I am trying to make a homing bullet that follows the enemies in my game. At the start, I want it to randomly choose an enemy that is active in the scene (the enemies are all clones of the same object), and then follow it.
private var enemy : GameObject;
function Start () {
enemy = GameObject.Find("Enemy_(Clone)");
}
function Update() {
transform.LookAt(enemy);transform.Translate(Vector3.forward * 10 * Time.deltaTime); Destroy (gameObject, 5);
}
But, I get the error "No appropriate version of 'UnityEngine.Transform.LookAt' for the argument list '(UnityEngine.GameObject)' was found."
what is wrong?