/// <summary> /// 删除加载数据,不删除实例 /// </summary> public void DestoryInDic(OTHERTAG otherTag) { if (null != _OtherPrefabsDic) { if (_OtherPrefabsDic.ContainsKey (otherTag)) { _OtherPrefabsDic.Remove (otherTag); } } else { Debug.LogError("OtherPrefabs预制体池为空!"); } }
/// <summary> /// 加载不实例化 /// </summary> public void LoadNotInstantiation(OTHERTAG otherTag) { GameObject GameObj = Resources.Load (_OtherPrefabsBindingDic [otherTag].OtherPath) as GameObject; if(!_OtherPrefabsDic.ContainsKey(otherTag)) _OtherPrefabsDic.Add (otherTag, GameObj); }
/// <summary> /// 加载并实例化 /// </summary> public void LoadAndInstantiation(OTHERTAG otherTag) { Object Obj = Resources.Load (_OtherPrefabsBindingDic [otherTag].OtherPath); GameObject GameObj = GameObject.Instantiate (Obj) as GameObject; if(!_OtherPrefabsDic.ContainsKey(otherTag)) _OtherPrefabsDic.Add (otherTag, GameObj); GameObj.name = Obj.name; GameObj.transform.parent = GameObject.Find ("UI Root").transform; GameObj.transform.localScale = Vector3.one; }