PoolBaseTSource, TInstance, TSettings Class |
[This is preliminary documentation and is subject to change.]
Namespace: Umbrace.Unity.PurePool
public abstract class PoolBase<TSource, TInstance, TSettings> : MonoBehaviour, ISharedPoolSettings<TSource>, ISharedPoolSettings, IObjectPool<TInstance>, IObjectPool, IPoolBase, ISerializationCallbackReceiver where TSettings : new(), SharedPoolSettings<TSource>
The PoolBaseTSource, TInstance, TSettings type exposes the following members.
| Name | Description | |
|---|---|---|
| PoolBaseTSource, TInstance, TSettings | Initializes a new instance of the PoolBaseTSource, TInstance, TSettings class |
| Name | Description | |
|---|---|---|
| CanAcquire | Gets a value indicating whether an instance can be acquired from the pool. An instance can be acquired when the pool contains at least one instance, or when InstantiateWhenEmpty is . | |
| Count |
Gets the number of objects currently contained by the pool.
| |
| Definition |
Gets the settings that were used to initialise this pool.
| |
| DontDestroyOnLoad |
Gets or sets a value indicating whether the pool should persist between scene changes.
| |
| Enabled |
Gets or sets a value indicating whether pooling is enabled.
| |
| InitialiseOnStart |
Gets or sets a value indicating whether to initialise the pool in the MonoBehaviour Start method.
Cannot be set once the pool has been initialised.
| |
| InitialSize |
Gets or sets the initial size of the pool.
Cannot be set once the pool has been initialised.
| |
| InstantiateWhenEmpty |
Gets or sets a value indicating whether to instantiate a new object when the pool is empty, and an attempt is made to acquire from the pool.
| |
| IsEmpty |
Gets a value indicating whether the pool is empty and contains no objects.
| |
| IsInitialised |
Gets a value indicating whether the pool has been initialised.
| |
| Items |
Gets a list of items currently contained by the pool.
| |
| LogMessages |
Gets or sets the level of log messaging that the pool will output.
| |
| MaximumSize |
Gets or sets the maximum size of the pool, which is the maximum number of objects it can contain.
| |
| NotificationMode |
Gets or sets the modes in which pooled objects are notified of their acquisition from, and release to, the pool.
| |
| Pool |
When implemented in a derived class, gets or sets the internal object pool.
| |
| RecordStatistics |
Gets or sets a value indicating whether to record pool statistics.
| |
| ReparentPooledObjects |
Gets or sets a value indicating whether to re-parent the pooled objects to the pool's Transform,
after the objects are returned to the pool.
| |
| Source |
Gets or sets the source object that will be pooled.
| |
| Statistics |
Gets an object containing general operational statistics about the pool.
| |
| WarnOnDestroy |
Gets or sets a value indicating whether to log a warning message when a poolable object is destroyed (either inside of the pool, or while in use).
|
| Name | Description | |
|---|---|---|
| Acquire |
Acquires an instance from the pool.
| |
| CanInitialise |
When overridden in a derived class, determines whether the pool can be initialised.
| |
| Clear |
Clears the pool, emptying it of all pooled objects.
| |
| CreateInternalPool |
When implemented in a derived class, creates the internal object pool.
| |
| CreateSettingsClone |
When implemented in a derived class, creates a new instance of TSettings that is an exact copy of the specified settings.
| |
| DestroyInstance |
When implemented in a derived class, destroys the specified instance.
| |
| Equals | (Inherited from Object.) | |
| Fill |
Fills the pool, populating it with pooled objects until it reaches the maximum pool size.
| |
| Finalize | (Inherited from Object.) | |
| GetHashCode | (Inherited from Object.) | |
| GetItems |
Gets a list of items currently contained by the pool, and stores them in the specified ListT.
| |
| GetType | (Inherited from Object.) | |
| Grow |
Increases the number of objects contained by the pool by the specified amount.
| |
| Initialise |
Initialises the pool, populating it with the initial number of objects.
| |
| Initialise(TSettings) |
Initialises the pool, populating it with the initial number of objects.
| |
| MemberwiseClone | (Inherited from Object.) | |
| OnCanAcquireChanged |
Raises the CanAcquireChanged event.
| |
| OnCountChanged |
Raises the CountChanged event.
| |
| OnDestroy | ||
| OnDestroyed |
Raises the Destroyed event.
| |
| OnInitialised |
Raises the Initialised event.
| |
| OnObjectAcquired |
Raises the ObjectAcquired event.
| |
| OnObjectDestroyed |
Raises the ObjectDestroyed event.
| |
| OnObjectInstantiated |
Raises the ObjectInstantiated event.
| |
| OnObjectReleased |
Raises the ObjectReleased event.
| |
| Release |
Releases an instance back to the pool.
| |
| SetSize |
Sets the number of objects contained by the pool, either destroying excess pooled objects, or instantiating new ones.
| |
| Shrink |
Decreases the number of objects contained by the pool by the specified amount.
| |
| Start | ||
| ToString | (Inherited from Object.) | |
| TryAcquire |
Acquires an instance from the pool.
|
| Name | Description | |
|---|---|---|
| CanAcquireChanged |
Occurs when the value of CanAcquire changes.
| |
| CountChanged |
Occurs when Count changes.
| |
| Destroyed |
Occurs when the pool is destroyed.
| |
| Initialised |
Occurs when the pool is initialised.
| |
| ObjectAcquired |
Occurs when an instance of the source object is acquired from the pool.
| |
| ObjectDestroyed |
Occurs when an instance of the source object is destroyed.
| |
| ObjectInstantiated |
Occurs when a new instance of the source object is instantiated.
| |
| ObjectReleased |
Occurs when an instance of the source object is released back to the pool.
|
By virtue of being serialisable, PoolBaseTSource, TInstance, TSettings can survive an assembly reload caused by live recompilation inside of the Unity editor.
TSource and TInstance may differ in the case of a source that is a Type. For example, a TSource of Type where the provided source is typeof(Component), will result in instances of Component, and therefore TInstance should be Component.