First public release.
Framework-agnostic object pooling for Unity, with no dependencies. Use it through a static facade or your own injected instance — the API is the same either way.
Install
Package Manager → + → Install package from git URL…
https://github.com/VegetaAlpha/VegetaPool.git?path=Pool#v1.0.0
Unity 2022.3+. ?path= must come before #.
What's in it
PoolSystem—Register/GetObj/ReleaseObj/DestroyPool/DestroyAllPoolsover anyISpawner.Pool— static facade over a singlePoolSystem, for projects that don't inject. The two modes are mutually exclusive and enforced at runtime.IPoolable/ISubKeyPoolable— poolable on anyMonoBehaviour;ISubKeyPoolablegives one pool per variant from a string key.this.Release()— a pooled object can return itself without holding a pool reference, and still reaches the right pool when several are alive.Unregister<T>()— drops whatRegisterstored. Rarely needed, sinceDestroyPoolkeeps the config so a pool rebuilds itself; reach for it when the prefab is about to stop being valid, such as before releasing an Addressables handle.ISpawner— the one seam for instantiation, so a DI container can resolve[Inject]members on pooled instances.SO_AllPoolData— ScriptableObject prefab config with a custom Inspector that only draws the fields for the selected mode.- Samples — Static Pool Demo and VContainer Pool Demo, the same runnable scene built both ways, with no setup beyond importing.
Worth knowing before you start
The pool root is DontDestroyOnLoad and the pool never shrinks. Destroying pooled objects is always your explicit DestroyPool / DestroyAllPools call — a scene unload is never one. The README covers what that means in practice.
Released into the public domain under the Unlicense.