PoolableBehaviour<TSelf> Class
- Namespace
- SatorImaging.UnityFundamentals
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 asDontDestroyOnLoad
.
- ReturnToPool(bool)
Return instance to pool. Note that host
GameObject
will be marked asDontDestroyOnLoad
.
- 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.