CPAddUI LoadCPAddPrefab(string path) { GameObject obj = ObjectPool.Instance.GetGO(path); CPAddUI cpadd = obj.GetComponent <CPAddUI>(); return(cpadd); }
void Awake() { Instance = this; for (int i = 0; i < index; i++) { CPAddUI addui = LoadCPAddPrefab(cp_path); addui.gameObject.transform.parent = transform; addui.gameObject.transform.localScale = Vector3.one; addui.gameObject.transform.localPosition = Vector3.zero; addui.gameObject.SetActive(false); CpAddList.Add(addui); } }
CPAddUI LoadCPAddPrefab(string path) { //ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.PREFAB); //if (objUnit != null && objUnit.Asset != null) //{ // GameObject obj = GameObject.Instantiate(objUnit.Asset) as GameObject; // CPAddUI cpadd = obj.GetComponent<CPAddUI>(); // return cpadd; //} //else //{ // return null; //} GameObject obj = GameObjectPool.Instance.GetGO(path); CPAddUI cpadd = obj.GetComponent <CPAddUI>(); return(cpadd); }