5 private readonly UnityEngine.Pool.ObjectPool<T> pool;
9 private string exceededNumObjectsMsg;
14 this.pool =
new UnityEngine.Pool.ObjectPool<T>(createFunc);
15 this.exceededNumObjectsMsg =
16 $
"Exceeded maximum number of objects in the pool ({typeof(T)}).";
21 T obj = this.pool.Get();
22 Assert(this.pool.CountActive <=
this.maxActive, exceededNumObjectsMsg);
26 public UnityEngine.Pool.PooledObject<T>
Get(out T obj)
28 UnityEngine.Pool.PooledObject<T> pooledObj = this.pool.Get(out obj);
29 Assert(this.pool.CountActive <=
this.maxActive, exceededNumObjectsMsg);
35 this.pool.Release(obj);
UnityEngine.Pool.PooledObject< T > Get(out T obj)
ObjectPoolMaxAssert(System.Func< T > createFunc, int maxActive)