void OnDestroy() { if (instance == this) { instance = null; } }
void Awake() { if (!instance) { DontDestroyOnLoad(this.gameObject); instance = this; } else if (instance != this) { DestroyImmediate(this.gameObject); } }