I'm trying to call the DoorOpen function from the other script called DoorBehaviour
function Update ()
{
useDoor();
}
function useDoor()
{
var doorScript : DoorBehaviour = GetComponent(DoorBehaviour);
if(Input.GetKeyDown("return"))
{
doorScript.DoorOpen();
}
}
I keep getting the "NullReferenceException: Object reference not set to an instance of an object" error.
What am I doing wrong?
Thanks,
↧