Home

Awesome

UnityObjectPooler

Simple object pool for Unity

This is a quick and lightweight solution that you can just immediately throw objects at to be pooled. (.Net 4.6+)

Instantiating objects (taking them from the pool):
var obj = ObjectPooler.Instance.Spawn(prefab, position, rotation);
Destroying objects (adding them back into the pool):
ObjectPooler.Instance.Despawn(gameObject);   
Preparing objects for re-use.
public class Enemy : MonoBehaviour, IPoolable
{
    public void Spawn()
    {
        // do stuff...
    }

    public void Despawn()
    {
        // do stuff...
    }
}