private void OnDestroy() { if (instance == this) { instance = null; } }
public void Awake() { Debug.Log("SingletonSetup"); Debug.Log(instance); if (instance != null) { Debug.Log(gameObject.name); Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); }