private void OnDestroy() { if (instance == this) { instance = null; } }
void Start() { if (instance == null) { DontDestroyOnLoad(this); instance = this; } else { Destroy(gameObject); } }