// Code that runs on entering the state. public override void OnEnter() { door = Owner.GetComponent<Ticket_Door>(); // change the mode if (door.Is_Ready_For_Enter()) door.Mode_Passage(); }
void Start() { // find the door in parent if (!door) { door = gameObject.GetComponentInParent<Ticket_Door>(); } }