Skip to content

ScriptableGameObjectPool Class

A UnityEngine.ScriptableObject that holds a pool of UnityEngine.GameObject.

C#
[CreateAssetMenu(fileName = "New Game Object Pool", menuName = "Hertzole/Scriptable Values/Pools/Game Object Pool", order = -850)]
public class ScriptableGameObjectPool : ScriptablePool<GameObject>, INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, IPoolCallbacks<GameObject>

Inheritance object → UnityEngine.Object → UnityEngine.ScriptableObject → RuntimeScriptableObjectScriptablePoolScriptablePool<GameObject>

Implements INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, IPoolCallbacks<GameObject>

C#
public GameObject Prefab { get; set; }

Called when a new object needs to be created.

C#
protected override GameObject CreateObject()

UnityEngine.GameObject

Called when an object needs to be destroyed.

C#
protected override void DestroyObject(GameObject item)

item UnityEngine.GameObject
The object to be destroyed.

Called when an object is retrieved from the pool.

C#
protected override void OnGet(GameObject item)

item UnityEngine.GameObject
The object that was retrieved from the pool.

Called when an object is returned to the pool.

C#
protected override void OnReturn(GameObject item)

item UnityEngine.GameObject
The object that was returned to the pool.