/// <summary> /// 删除指定的缓存池 /// </summary> /// <param name="name">资源唯一标签,一般使用资源路径</param> public void DeleteGroup(string name) { GOPoolItemGroup itemGroup = GetGroup(name); if (itemGroup != null) { itemGroupDic.Remove(name); itemGroup.Dispose(); } else { GOPoolUtil.LogWarning("The pool is not found.name = " + name); } }
/// <summary> /// 使用给定的GameObject创建缓存池 /// </summary> /// <param name="itemName">资源唯一标签,一般使用资源路径</param> /// <param name="itemTemplate">模板GameObject</param> /// <returns></returns> public GOPoolItemGroup CreateGroup(string itemName, ItemTemplateType itemType, GameObject itemTemplate) { if (itemTemplate == null) { GOPoolUtil.LogError("Template is Null"); return(null); } if (!itemGroupDic.TryGetValue(itemName, out GOPoolItemGroup itemGroup)) { itemGroup = new GOPoolItemGroup(Name, categoryTransform, itemName, itemType, itemTemplate); itemGroupDic.Add(itemName, itemGroup); } else { GOPoolUtil.LogWarning("The pool has been created.uniqueName = " + itemName); } return(itemGroup); }