private void Initialize() { if (Manager == null) { DontDestroyOnLoad(transform.root.gameObject); Manager = this; } }
void Awake() { if (Instance == null) { Instance = this; panelName = ""; gameModeNr = -1; difficulty = 0; SceneManager.sceneLoaded += OnSceneLoaded; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Awake() { //Checks to see if a CSM already exists if (csm != null && csm != this) { //If so, destroy this one Destroy(this.gameObject); return; } else { //Else, make this the Main CSM csm = this; } //Make this object persist between scenes DontDestroyOnLoad(this); }