private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Awake() { if (!instance) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }