/// <summary> /// 加载对象池 /// </summary> /// <param name="prefab">对象路径</param> /// <param name="capacity">容量</param> /// <param name="preload">是否预加载</param> /// <param name="group">组名</param> public void LoadPool(GameObject prefab, int capacity, bool preload, string group) { string poolName = prefab.name; if (HasPool(poolName)) { return; } if (prefab == null) { Debug.LogErrorFormat("创建对象池,加载对象失败!请检查路径:{0}", prefab.name); return; } UnityObjectPool.CreatePool(poolName, prefab, capacity, preload, group); }
/// <summary> /// 创建一个Unity对象池 /// </summary> /// <param name="poolName">对象池名称</param> /// <param name="prefab">预制体</param> /// <param name="capacity">容量</param> /// <param name="preload">是否预加载</param> /// <param name="group">组名</param> /// <returns></returns> public UnityObjectPool CreatePool(string poolName, GameObject prefab, int capacity, bool preload, string group) { return(UnityObjectPool.CreatePool(poolName, prefab, capacity, preload, group)); }