private void Awake() { //Check if Instance already exists if (Instance == null) { //if not, set Instance to this Instance = this; } //If Instance already exists and it's not this: else { if (Instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one Instance of a GameManager. Destroy(this.gameObject); } } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(this.gameObject); this._levelManager = this.GetComponent<LevelManager>(); this._uiManager = this.GetComponent<UIManager>(); this.InitGame(); }
public void Start() { StartCoroutine(CountDown()); iManager = GetComponent <UIManager>(); }