PoolGroup Class

Ultimate Pooling

PoolGroup Class
Represents a spawn pool for a specfific type of prefab. Valid types are game objects and components.
Inheritance Hierarchy
SystemObject  Object
    Component
      Behaviour
        MonoBehaviour
          UltimatePoolingPoolGroup
            UltimatePoolingGenericPoolGroup

Namespace: UltimatePooling
Assembly: Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
public abstract class PoolGroup : MonoBehaviour
UltimatePooling.PoolGroup = function();

Type.createClass(
	'UltimatePooling.PoolGroup',
	UnityEngine.MonoBehaviour);

The PoolGroup type exposes the following members.

Constructors
  NameDescription
Protected methodPoolGroup
Initializes a new instance of the PoolGroup class
Top
Methods
  NameDescription
Public methoddespawn(Object)
Indicates that the specified instance can be returned to the pool and re-used at a later time.
Public methoddespawn(Object, Single)
Indicates that the specified instance can be returned to the pool and re-used at a later time.
Public methoddespawnAll
Attempts to reclaim all instances spawned by this pool and return them to the pool. Any instances spawned by this pool will be forcefully returned without warning.
Public methoddespawnAll(Single)
Attempts to reclaim all instances spawned by this pool after the specified time delay. Any instances spawned by this pool will be forcefully returned without warning.
Public methoddestroy
Attempts to destroy a specific instance from the pool. Note that 'OnDespawn' will not be called on the instance. Instead you should handle any cleanup in 'OnDestroy'
Public methoddestroyAll
Attempts to destroy all pooled objects effectivley emptying the pool and resetting its state. Note that 'OnDespawn' will not be called on the pooled objects. Instead you should handle any cleanup in 'OnDestroy'
Public methoddestroySelf
Attempts to destroy all pooled objects effectivley emptying the pool as well as destroying the pool instance. This is the prefered way of destroying an object pool as it allows the spawned objects to remain in the scene if required as opposed to being destroyed along with the pool. Note that 'OnDespawn' will not be called on any of the pooled objects. Instead you should handle any cleanup in 'OnDestroy'
Public methoddidSpawn
Returns true if this spawn group created the instance specified. Useful for spawn validation to make sure multiple pools are not attempting to manage the same instance.
Protected methodonInstanceDespawned
Should be implemented by the inheriting class. Called when the object is about to be returned to the pool.
Protected methodonInstanceSpawned
Should be implemented by the inheriting class. Called when the object has been taken from the pool and will be re-used.
Public methodspawn
Spawn an instance from the pool.
Public methodspawn(Vector3, Quaternion)
Spawn an instance from the pool using the specified position and rotation.
Protected methodStart
Called by Unity on the first frame.
Public methodToString
Override the string value to return detaild state information about the pool.
(Overrides Object.ToString.)
Top
Fields
  NameDescription
Public fieldeventType
The method used to inform a spawned instance when it is added to or removed from the pool.
Public fieldmaxAmount
The max amount of instances that the pool can contain. If this amount is exceeded then the pool will need to destroy some objects.
Public fieldparentInstances
When true, all spawned instances will be added as child objects to the managing pool group.
Protected fieldpooled
A collection of objects that are ready to be spawned.
Public fieldprewarmAmount
The amount of inctances to preload.
Public fieldprewarmPerFrame
The max amount of instances to preload per frame.
Public fieldprewarmPool
Should the pool preload a set number of objects at startup. This can avoid frame spikes cause by calls to 'Instantiate' but may increase loading time.
Protected fieldtracked
A collection of objects that have been spawned by this pool.
Top
Properties
  NameDescription
Public propertyIsFull
Returns true if the pool is unable to store anymore pooled instances.
Public propertyIsPrewarming
Returns true if the pool is currently prewarming.
Public propertyPrefab
Should be implemented by the inheritng class. Should return the specific prefab type, For example 'GameObject'.
Top
See Also