//Singleton Pattern private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(transform.gameObject); } }
public void Awake() { 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 Start() { if (Instance != null) { GameObject.Destroy(this.gameObject); return; } Instance = this; if (DontDestoryOnLoad) { GameObject.DontDestroyOnLoad(this); } }