void OnDisable() { if (_inst == this) { _inst = null; } }
void OnDestroy() { if (_inst == this) { _inst = null; } DestroyRenderTextures(); }
void OnEnable() { if (_inst != null) { Debug.LogError("Duplicated " + GetType() + ". Destroy this " + gameObject.name); GameObject.Destroy(this); return; } _inst = this; CreateRenderTextures(); }