Release(T)
Returns the instance back to the pool. If the pool has reached maximum size, the returned instance is destroyed.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Pool
- Assembly: UnityEngine.CoreModule
public void Release(T element)
Parameters
Remarks
Calls to invoke the delegate passed to the constructor as the parameter.
ReleaseactionOnReleaseAny instance returned to a pool that's already full is destroyed and the delegate is invoked if one was provided to the constructor. The pool is considered full when the number of objects it contains is equal to the pool's maximum size, as defined by the value of the parameter passed to the constructor.
actionOnDestroymaxSizeIf collection checks are enabled, then calling on an instance that is already in the pool throws an exception. Collection checks are enabled by passing as the value of the argument to the constructor. Collection checks only run in the Editor and not in a Player build.
ReleasetruecollectionCheckAdditional Resources: ctor.