Constructor UnsafePool
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
UnsafePool(int, Func<T>, Action<T>, Action<T>, Action<T>)
Initializes a new instance of UnsafePool<T> with the given capacity and callbacks.
public UnsafePool(int initialCapacity, Func<T> create, Action<T> destroy = null, Action<T> activate = null, Action<T> deactivate = null)
Parameters
initialCapacityintThe number of objects to pre-create.
createFunc<T>A factory function to create new pool objects.
destroyAction<T>An optional callback invoked when an object is permanently removed from the pool.
activateAction<T>An optional callback invoked when an object is retrieved from the pool.
deactivateAction<T>An optional callback invoked when an object is returned to the pool.
Exceptions
- ArgumentOutOfRangeException
initialCapacityis negative.- ArgumentNullException
createis null.