// Use this for initializations void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
/// <summary> /// Awake funtion is called before Start(). /// </summary> private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else { Destroy(gameObject); } }
void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
// Use this for initialization void Start() { //this maintains persistance of objects between scenes without creating multiple instances of the same object if (control == null) { DontDestroyOnLoad(gameObject); control = this; } else if (control != this) { Destroy(gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }