void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; }else { instance = this; } if (Application.loadedLevel == 0 || Application.loadedLevel == 2 || Application.loadedLevel == 3) { DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } else { instance = this; } if (!AudioBegin) { music.Play(); DontDestroyOnLoad(this.gameObject); AudioBegin = true; } }