void OnEnable() { if (Application.isPlaying) { Debug.Assert(Instance == null); } Instance = this; }
void OnDisable() { if (Application.isPlaying) { Debug.Assert(Instance == this); } if (Instance == this) { Instance = null; } }