im always getting a NullReferenceException: Object reference not set to an instance of an object at line 4 no matter what i try, there is a game object with tag Enemy but it wount work
function Update () {
var target = GameObject.FindWithTag ("Enemy");
if ( Vector3.Distance(target.position, transform.position ) < 25) {
print("found it");
}
}
↧