public void turnMusicOff() { if (_instance != null) { //if (instance.audio.isPlaying) // instance.audio.Stop(); Destroy(this.gameObject); _instance = null; } }
void Awake() { DontDestroyOnLoad(this.gameObject); if (instance == null) { instance = this; } else { Destroy(this.gameObject); } }
// Background audio continues to play after changing the scene void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(transform.gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; DontDestroyOnLoad(this.gameObject); } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
private 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(gameObject); return; } source = GetComponent <AudioSource>(); instance = this; DontDestroyOnLoad(gameObject); }
private void Awake() { DontDestroyOnLoad(transform.gameObject); if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(gameObject); } }
// Use this for initialization void Awake() { //there's no audio if (instance == null) { instance = this; } //audio already exists and this instance is not the original else if (instance != this) { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this.gameObject); } DontDestroyOnLoad(gameObject); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } // GameObject[] objs = GameObject.FindGameObjectsWithTag("Music"); // if(objs.Length > 1){ // Destroy(this.gameObject); // } // DontDestroyOnLoad(transform.gameObject); DontDestroyOnLoad(this.gameObject); }
void OnApplicationQuit() { _instance = null; }