#pragma strict
var player : GameObject;
function Start () {
player = GameObject.FindWithTag("Player");
}
function Update () {
if (!Physics.Linecast (transform.position, player.position)) {
Debug.DrawLine (transform.position, player.position, Color.green);
Debug.Log ("Player in sight!");
}
else{
Debug.DrawLine (transform.position, player.transform.position, Color.red);
Debug.Log ("NO Player in sight!");
}
}
Why does this not work? It says (10,51): BCE0019: ‘position’ is not a member of ‘UnityEngine.GameObject’.
How can i fix this?