when i run the scene with this code and i’m neer the door taged “door” i have an error:
NullReferenceException: Object reference not set to an instance of an object
(i’m sure it’s taged correctly i used the tag in other script)
function Update () {
var hit:RaycastHit;
if(Physics.Raycast(transform.position,transform.forward,5)){
if(hit.collider.gameObject.tag == "door"){
hit.collider.gameObject.animation.Play("ouvrir");
}
}
}