Here is a screen shot of the glitch. As you can see, Sight Start has an assigned variable but the error still pops up. Am I missing something? Thanks in advance for the help :D
![alt text][1]
[1]: /storage/temp/24563-sightstart+glitch.png
Here is the script code..
using UnityEngine;
using System.Collections;
public class PlayerDetect : MonoBehaviour {
public Transform sightStart;
public Transform sightEnd;
public bool spotted = false;
void Update () {
Raycasting ();
Behaviors ();
}
void Raycasting(){
Debug.DrawLine(sightStart.position, sightEnd.position, Color.blue);
spotted = Physics.Linecast(sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer("player"));
}
void Behaviors(){
}
}
↧