void Start() { if (instance == null) { instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
void Awake() { DontDestroyOnLoad(gameObject); print("instance " + instance); if (instance != null) { Destroy(gameObject); print("destroy"); } else { instance = this; } }
private void Awake() { if (BgMusic.bgMusic == null) { BgMusic.bgMusic = this; } else { if (BgMusic.bgMusic != this) { Destroy(this.gameObject); } } DontDestroyOnLoad(this.gameObject); }
IEnumerator mainStep() { yield return(new WaitUntil(() => bStart == true)); while (bStart) { yield return(new WaitForSeconds(1)); MyNotifications.CallNotification("Listen Background Music", 5); yield return(new WaitForSeconds(1)); BgMusic.Play(); yield return(new WaitForSeconds(5)); MyNotifications.CallNotification("Listen Music Note", 20); string[] requirtNote = { "", "", "" }; requirtNote = muiscNote[0].Split(','); PlayRequire(requirtNote); yield return(new WaitForSeconds(20)); MyNotifications.CallNotification("Goodbye World!", 3); } }