Skip to content

Releases

1.1.0

Choose a tag to compare

@Omerrgn Omerrgn released this 17 Nov 16:32

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, IPoolable and PooledObject.
  • A pool marked DontDestroyOnLoad, or one in an additively loaded scene, keeps its instances in its own scene.
  • An exception in an IPoolable method no longer leaves the instance stuck between the pool and the game.
  • CountInactive no 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.

1.0.0

Choose a tag to compare

@Omerrgn Omerrgn released this 03 Oct 10:22

First release.

ObjectPool component: one pool per prefab, set up in the Inspector with an initial size and an optional maximum size.
Get() and Get(position, rotation) return an active instance; Release(instance) and Release(instance, delay) put it back.
The pool grows when it runs out of instances and keeps the new ones.
IPoolable lets components reset themselves when their instance is taken from or returned to the pool.
PooledObject lets an instance release itself without a reference to its pool.
CountActive, CountInactive and CountAll report what the pool is doing.
Sample scene with a launcher that fires pooled cubes.