Skip to content

ScriptableComponentPool<T> Class

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

C#
public abstract class ScriptableComponentPool<T> : ScriptablePool<T>, INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, IPoolCallbacks<T> where T : Component

T
The type of UnityEngine.Component.

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

Implements INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, IPoolCallbacks<T>

C#
public T Prefab { get; set; }

Called when a new object needs to be created.

C#
protected override T CreateObject()

T

Called when an object needs to be destroyed.

C#
protected override void DestroyObject(T item)

item T
The object to be destroyed.

Called when an object is retrieved from the pool.

C#
protected override void OnGet(T item)

item T
The object that was retrieved from the pool.

Called when an object is returned to the pool.

C#
protected override void OnReturn(T item)

item T
The object that was returned to the pool.