private void AddEventsInGameButtons() { btnInGameSetting.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); //this.uiPopup_InGameSetting.gameObject.SetActive(true); //this.uiPopup_InGameSetting.Init(); if (this.uiPopup_InGameSetting != null) { this.uiPopup_InGameSetting.Open(); } else { //var prefab = (GameObject)(from obj in App.instance.resource // where obj.name == "UIPopup_InGameSetting" // select obj).FirstOrDefault(); var prefab = Resources.Load <GameObject>("Prefab/UI/UIPopup_InGameSetting"); this.uiPopup_InGameSetting = Instantiate <GameObject>(prefab).GetComponent <UIPopup_InGameSetting>(); this.uiPopup_InGameSetting.transform.SetParent(this.uiRoot.transform); this.uiPopup_InGameSetting.transform.localScale = Vector3.one; this.uiPopup_InGameSetting.transform.localPosition = Vector3.zero; this.uiPopup_InGameSetting.CheckMusic(); this.uiPopup_InGameSetting.Init(); } })); }
// Start is called before the first frame update void Start() { if (this.uiPopup_InGameSetting != null) { this.uiPopup_InGameSetting.Open(); } else { //var prefab = (GameObject)(from obj in App.instance.resource // where obj.name == "UIPopup_InGameSetting" // select obj).FirstOrDefault(); var prefab = Resources.Load <GameObject>("Prefab/UI/UIPopup_InGameSetting"); this.uiPopup_InGameSetting = Instantiate <GameObject>(prefab).GetComponent <UIPopup_InGameSetting>(); this.uiPopup_InGameSetting.transform.SetParent(this.uiRoot.transform); this.uiPopup_InGameSetting.transform.localScale = Vector3.one; this.uiPopup_InGameSetting.transform.localPosition = Vector3.zero; this.uiPopup_InGameSetting.Init(); } }