Error: player.position not part of UnityEngine.GameObject
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.
Answer by jgodfrey · Jun 18, 2016 at 09:50 PM
"position" is a property of the "transform" object that's associated with a GameObject. So, in the case of your "Player" GameObject, you'd access it like:
 Player.transform.position
 
              It works (partially), the only problem is that it's working on the x axis, not the y axis. Thanks for your solution( until this point).
That's a different problem though. So, if your "player.position not part of UnityEngine.GameObject" problem is resolved, I'd suggest that you accept the answer and ask a new question for the new problem.
Your answer
 
             Follow this Question
Related Questions
LookAt but without z axis? 6 Answers
Smooth Look at... 2 Answers
IK and Aiming 0 Answers
Really basic question... 1 Answer