Skip to content

VegetaPool 1.0.0

Latest

Choose a tag to compare

@VegetaAlpha VegetaAlpha released this 01 Sep 01:52
· 4 commits to main since this release

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

  • PoolSystemRegister / GetObj / ReleaseObj / DestroyPool / DestroyAllPools over any ISpawner.
  • Pool — static facade over a single PoolSystem, for projects that don't inject. The two modes are mutually exclusive and enforced at runtime.
  • IPoolable / ISubKeyPoolable — poolable on any MonoBehaviour; ISubKeyPoolable gives 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 what Register stored. Rarely needed, since DestroyPool keeps 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.
  • SamplesStatic 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.