private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Awake() { if (Instance == null) //If there are no other instances of this object { Instance = this; //Set this to the Instance DontDestroyOnLoad(gameObject); //Don't destroy } else //If there ARE other instances of this object { Destroy(gameObject); //Destroy them } }