Esempio n. 1
0
        public static void OnExcuteDestroy(this MBehaviour behaviour)
        {
            OnExcuteDisableDestroy(behaviour);

            if (behaviour == null)
            {
                return;
            }

            behaviour.onDestroy.SendListener();

            behaviour.onAwake.RemoveListenerAll();
            behaviour.onEnable.RemoveListenerAll();
            behaviour.onDisable.RemoveListenerAll();
            behaviour.onStart.RemoveListenerAll();
            behaviour.onUpdate.RemoveListenerAll();

            MBehaviourController.RemoveBehaviour(behaviour);
        }
 public static void OnDestroy(this MBehaviour behaviour, Action action)
 {
     behaviour.onDestroy.AddListener(action);
     MBehaviourController.RemoveBehaviour(behaviour);
 }