 | ObjectXGetFromPoolT Method |
Gets the next suitable inactive object in the pool. Instantiates a new one if none is available.
Namespace: CandlelightAssembly: Assembly-CSharp-firstpass (in Assembly-CSharp-firstpass.dll) Version: 0.0.0.0
Syntaxpublic static T GetFromPool<T>(
List<T> pool,
T prefab,
Transform parent = null,
Predicate<T> isElementSuitable = null
)
where T : Component
Parameters
- pool
- Type: System.Collections.GenericListT
Pool. - prefab
- Type: T
Prefab to instantiate if no instance is available in pool. If , then an empty GameObject with the
component will be created and used.
- parent (Optional)
- Type: Transform
Optional object that should become the parent of the retrieved instance. Set this value in particular for
e.g., UI prefabs.
- isElementSuitable (Optional)
- Type: SystemPredicateT
Optional predicate to determine if an inactive item in the pool is suitable for use.
Type Parameters
- T
- The type of object in the pool.
Return Value
Type:
TThe next suitable inactive object from the pool.
See Also