Class PooledObject
Component used to mark GameObjects as poolable by the ElasticObjectPoolManager, and with which settings to pool them.
The settings are grabbed from the original prefab. On instances of the prefab, this component is used to track the pool the instance originated from, so that it can be returned to it on release.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Runtime.dll
Syntax
[HelpURL("http://localhost:8080/api/Holoride.ElasticSDK.PooledObject.html")]
public class PooledObject : MonoBehaviour
Fields
BeforeReturnToPool
UnityEvent invoked right before game object returns to pool. This event can be used to execute de-spawning behavior like animations or in general behavior that should happen outside of Unity's life cycle calls.
Declaration
[FormerlySerializedAs("ReturnedToPool")]
public UnityEvent BeforeReturnToPool
Field Value
Type | Description |
---|---|
UnityEvent |
Init
UnityEvent invoked when object has been instantiated and initially added to the pool. This event can be used to invoke behavior that should exclusively happen when an instance of the poolable object is created.
Declaration
public UnityEvent Init
Field Value
Type | Description |
---|---|
UnityEvent |
RetrievedFromPool
UnityEvent invoked when object has been taken from pool. This event can be used to execute spawning behavior before the game object instance is set to its prefab's active state.
Declaration
public UnityEvent RetrievedFromPool
Field Value
Type | Description |
---|---|
UnityEvent |
Properties
AutoReturnToPool
Gets or sets a value indicating whether game objects automatically return to the pool when they fall outside the Spawners Moving Grid. If this is set to false, one must call ReturnToPool() to manually return the game object. This can be useful to play exit animations before an object returns.
Declaration
public bool AutoReturnToPool { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
ReturnToPool()
Used to manually return a poolable game object back to its pool, when AutoReturnToPool is set to false.
Declaration
public bool ReturnToPool()
Returns
Type | Description |
---|---|
bool | Returns false if the pool, the poolable object was associated with, is null. Otherwise returns true. |