Example #1
0
 protected virtual void OnDisable()
 {
     if (!Application.isPlaying)
     {
         ObjectChangeState?.Invoke(this, false);
     }
     else if (activeObjects != null)
     {
         if (activeObjects.Remove(this))
         {
             ObjectChangeState?.Invoke(this, false);
         }
     }
 }
Example #2
0
 protected virtual void OnEnable()
 {
     if (!Application.isPlaying)
     {
         ObjectChangeState?.Invoke(this, false);
     }
     else
     {
         GetActiveObjects();
         if (!activeObjects.Contains(this))
         {
             activeObjects.Add(this);
             ObjectChangeState?.Invoke(this, true);
         }
     }
 }