void Awake() { if (Instance != null) Debug.LogError("More than one GameManager in scene."); else Instance = this; }
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(); }
void Awake() { if (Manager != null) Destroy(Manager); else Manager = this; DontDestroyOnLoad(this); }
void Awake() { if (Instance == null) Instance = this; else if (Instance != this) Destroy(this); DontDestroyOnLoad(gameObject); }
//Awake is always called before any Start functions void Awake() { if (Instance == null) Instance = this; else if (Instance != this) Destroy(gameObject); DontDestroyOnLoad(gameObject); _enemies = new List<Enemy>(); _boardScript = GetComponent<BoardManager>(); InitGame(); }
void Awake() { Instance = this; }
public void Init( ) { m_manager = GameManager.Instance; gameObject.SetActive ( true ); }
//Singleton pattern void Awake() { if (!instance) { instance = this; } else { Destroy(this); } }
//public IOMouseHandler(SubScene subscene) { // m_Subscene = subscene; // m_SceneIndex = m_Subscene.GetIndex(); //} public void Start() { m_GameManager = GameManager.GetInstance(); }