private void Awake() { if (instance) { Destroy(this); } else { instance = this; } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { //If an UILevelManager exists and it is not this... if (Instance != null && Instance != this) { Debug.LogError("Error with UILevelManager script components, 2 instances " + this); //...destroy this and exit. There can be only one UILevelManager. Destroy(gameObject); return; } //This is the Instance UILevelManager. Instance = this; }
UILevelManager InstantiateLevelManager(LevelConfig l, int i) { GameObject o = Instantiate <GameObject>(uiLevelManagerPrefab); o.GetComponent <RectTransform>().SetParent(this.canvas.GetComponent <RectTransform>(), false); this.SetPosition(o, i); UILevelManager mng = o.GetComponent <UILevelManager>(); mng.Init(this, l, i, this.config.Levels.Count - 1); return(mng); }
void Awake() { if (instance == null) { instance = this; bombPanel.SetActive(true); goldPanel.SetActive(false); exitPanel.SetActive(false); awakeTimeStamp = Time.time; isLevelFinished = false; } else if (instance != this) { Destroy(gameObject); } }
private void SetStayingPosition(UILevelManager o, int i) { o.GetComponent <UILevelManager>().StayingPoint = this.nextPoint * (i - this.activeLevelManager); }