So I’m a complete beginner at coding in general, but by going through the forums and all I was able to code my enemy to face my player…Or that’s what should be happening. The code comes up with the error:
player.position not part of UnityEngine.GameObject. Here is my code at the moment:
#pragma strict
var Player=GameObject.FindGameObjectWithTag("Player");
function LookAt () {
var rotation = Quaternion.LookRotation(Player.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 1.08f);
}
function Start () {
}
function Update ()
{
LookAt();
}
I know there already similar questions, but I didn’t understand them due to slight differences. Could anyone who answers this try to be as simple as possible? I am not very good with coding.