Interface IGameObjectPoolItem
An interface describing the functionality needed for an item to be understood by GameObjectPool, if callbacks are to be made.
Namespace: GDX.Collections.Pooling
Syntax
public interface IGameObjectPoolItem
Methods
| Improve this Doc View SourceGetGameObject()
Declaration
GameObject GetGameObject()
Returns
Type | Description |
---|---|
UnityEngine.GameObject |
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
GetParentPool()
Return the IManagedPool which the IGameObjectPoolItem is currently managed by.
Declaration
IManagedPool GetParentPool()
Returns
Type | Description |
---|---|
IManagedPool | An IManagedPool if the IGameObjectPoolItem is attached to a pool, otherwise null. |
Remarks
It is possible that a pooled item may exist without a parent in some custom scenario.
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
IsValidItem()
Is the IGameObjectPoolItem thought to be valid?
Declaration
bool IsValidItem()
Returns
Type | Description |
---|---|
System.Boolean | true/false if the item is found to be valid. |
Remarks
Sometimes a UnityEngine.GameObject may get destroyed without the pool knowing, this contains checks to validate if the item can be returned to a pool and reused appropriately.
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
OnReturnedToPool()
Called when this item is returned to the IManagedPool.
Declaration
void OnReturnedToPool()
Remarks
This should handle everything, including disabling the UnityEngine.GameObject.
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
OnSpawnedFromPool()
Called when this item is spawned from the IManagedPool.
Declaration
void OnSpawnedFromPool()
Remarks
This should handle everything, including enabling the UnityEngine.GameObject.
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
ReturnToPool()
Return the item to the IManagedPool which it is associated too.
Declaration
void ReturnToPool()
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |
SetParentPool(IManagedPool)
Set the IManagedPool which this item believes it belongs too.
Declaration
void SetParentPool(IManagedPool targetManagedPool)
Parameters
Type | Name | Description |
---|---|---|
IManagedPool | targetManagedPool | The parent IManagedPool. |
Remarks
This is used during creation to assign the parent that is creating the item.
Exceptions
Type | Condition |
---|---|
UnsupportedRuntimeException | Not supported on DOTS Runtime. |