void Start() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(transform.gameObject); } }
private void Awake() { if (Instance) { DestroyImmediate(gameObject); } else { DontDestroyOnLoad(gameObject); Instance = this; } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }