// UI 생성 및 가져오기 private GameObject GetUI(eUIType _uiType) { // Dictionary에 있으면 바로 리턴 if (DicUI.ContainsKey(_uiType) == true) { return(DicUI[_uiType]); } GameObject makeUI = null; GameObject prefabUI = Resources.Load("Prefabs/" + _uiType.ToString()) as GameObject; if (prefabUI != null) { if (ui == null) { ui = this.transform; } makeUI = Instantiate(prefabUI, ui); makeUI.name = _uiType.ToString(); DicUI.Add(_uiType, makeUI); makeUI.SetActive(false); // 꺼서 반환 } return(makeUI); }
GameObject GetUI(eUIType _uiType, bool isDontDestroy) { if (isDontDestroy == false) { if (DicUI.ContainsKey(_uiType) == true) { return(DicUI[_uiType]); } } else { if (DicSubUI.ContainsKey(_uiType) == true) { return(DicSubUI[_uiType]); } } GameObject makeUI = null; GameObject prefabUI = Resources.Load("Prefabs/UI/" + _uiType.ToString()) as GameObject; if (prefabUI != null) { if (isDontDestroy == false) { makeUI = NGUITools.AddChild(UI_CAMERA.gameObject, prefabUI); DicUI.Add(_uiType, makeUI); } else { if (SubRoot == null) { GameObject root = Resources.Load("Prefabs/UI/SubUI_Root") as GameObject; SubRoot = NGUITools.AddChild(this.gameObject, root); SubRoot.layer = LayerMask.NameToLayer("UI"); } makeUI = NGUITools.AddChild(SubRoot, prefabUI); DicSubUI.Add(_uiType, makeUI); } makeUI.SetActive(false); } return(makeUI); }