Table of Contents

PoolableBehaviour<TSelf> Class

public abstract class PoolableBehaviour<TSelf> : MonoBehaviour, IPoolableBehaviour where TSelf : PoolableBehaviour<TSelf>

Self-contained MonoBehaviour pool. Note that host GameObject is automatically managed.

Type Parameters

TSelf
Inheritance
PoolableBehaviour<TSelf>
Implements
Extension Methods

Methods

OnWillReturnToPool()

This method is only called if instance is not returned to pool.

Populate(int, bool)

Populate instances in pool. (aka. Warmup)

Rent(bool, Transform?, bool)

Get pooled instance or create new if pool is empty. Call ReturnToPool() to reuse instance.

ReturnToPool()

Return instance to pool. Note that host GameObject will be marked as DontDestroyOnLoad.

ReturnToPool(bool)

Return instance to pool. Note that host GameObject will be marked as DontDestroyOnLoad.

ReturnToPoolIfCanceled(CancellationToken)

Bind instance to cancellation token.

ThrowIfAlreadyReturnedToPool(string)

Throw exception if instance has already returned to pool.

TrimExcess(int)

Trim instance pool to specified size.