Inspired by Signals by Yanko Oliveira.
You can find the repository of Signals by Yanko Oliveira here.
Uses the ObjectPool of UnityEngine.
Author: matt-mert
- Define your pool, eg:
public class SomePool : APool<SomeObject> {}
- Initialize your pools, eg on Awake():
Pools.Get<SomePool>().Initialize(SomePrefab);
- Grab objects from the pool, eg:
var obj = Pools.Get<SomePool>().Grab();
- Release objects to the pool, eg:
Pools.Get<SomePool>().Release(obj);
- You also have your local Pool Hub that is specific to a given object instead of using the global one. The syntax is exactly the same.
PoolHub environmentPools = new PoolHub();
var wall = environmentPools.Get<WallPool>().Grab();