Repository navigation
The pool is now a Unity package. Install it from the Package Manager with Install package from git URL:
https://github.com/Omerrgn/unity-object-pool.git?path=/Packages/com.omerrgn.objectpool#v1.1.0
- The scripts compile into their own assembly,
Omerrgn.ObjectPooling, and the sample scene is imported from the package's Samples tab. Requires Unity 6 (6000.0) or newer. - Play mode tests cover reuse, growing, Max Size, rejected releases, delayed releases,
IPoolableandPooledObject. - A pool marked
DontDestroyOnLoad, or one in an additively loaded scene, keeps its instances in its own scene. - An exception in an
IPoolablemethod no longer leaves the instance stuck between the pool and the game. CountInactiveno longer counts instances destroyed while they waited in the pool.- Delayed releases are timed in the pool's own
Update: no allocation per release, an instance due back is available before other scripts ask for one in the same frame, and the timers wait while the pool is inactive. - The sample works in Built-in, URP and HDRP projects and shows the cubes' flight from the side.