UniPool
UniPool provides efficient object pooling for Unity, reducing garbage collection overhead by reusing frequently instantiated objects. The library includes specialized pools for GameObjects and Components with automatic resource loading, collection pools for Lists, Sets, and Dictionaries, and optional automatic object allocation. Ideal for performance-critical gameplay systems that require frequent object creation and destruction.
com.ms.pool 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/pool.git README Markdown
Copy this to your project's README.md
## Installation
Add **UniPool** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/pool.git
```
[](https://www.pkglnk.dev/pkg/pool)Used By (4)
README
UniPool
Simple Object Pool Library for Unity
ObjectPools
1. ObjectPool<T>
最基础的Pool,可以通过:
Request- 获取对象,如果Pool为空,则抛出PoolExceptionRelease- 放回对象
2. AutoAllocatePool<T>
在ObjectPool的基础上,拥有自动创建对象功能, T满足new()约束。
在作Request请求时,若Pool为空,则自动new T();
3. ComponentPool<T>
1 . 基本特性
这个类型的Pool专门用来存储
UnityEngine.Component类型的对象。每个
ComponentPool在场景中都有一个与之绑定的gameObject对象. 且该gameObject默认为active=false所有释放回Pool中的对象,都会成为Pool的gameObject的子节点
2 . Global模式
ComponentPool的构造函数中有global变量, 默认为true,即会gameObject标记为DontDestroyOnLoad,不会随场景销毁而销毁。
4. ResourcesComponentPool<T>
在ComponentPool基础上,拥有了从Resources目录下自动加载Prefab的功能.
构造函数
ResourcesComponentPool(string name,string path)
path 指定了prefab要加载的路径
Collections Pools
1. ListPool<T>
可获取List<T>对象
2. SetPool<T>
可获取HashSet<T>对象
3. DictPool<K,V>
可获取Dictionary<K,V>对象
No comments yet. Be the first!