Table of Contents

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

initialCapacity int

The number of objects to pre-create.

create Func<T>

A factory function to create new pool objects.

destroy Action<T>

An optional callback invoked when an object is permanently removed from the pool.

activate Action<T>

An optional callback invoked when an object is retrieved from the pool.

deactivate Action<T>

An optional callback invoked when an object is returned to the pool.

Exceptions

ArgumentOutOfRangeException

initialCapacity is negative.

ArgumentNullException

create is null.