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