void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
void Awake() { //if we don't have an [_instance] set yet if (!obj) { obj = this; } //otherwise, if we do, kill this thing else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); if (!audioSource.isPlaying) { audioSource.Play(); } }