Language
Edit

IDataObjectPool Interface

Definition

A data pool of objects that can be used for object re-use.

This is designed to reduce memory allocations and hence the frequency and duration of garbage collections. It can also reduce the instantiation time of a prefab when populating large lists.

public interface IDataObjectPool
type IDataObjectPool = interface
Public Interface IDataObjectPool
Derived

Methods

Name Description
AddPrefetchedObjectToPool(Int32, Object, Boolean)

Add a prefetched object to the pool with the specified ID.

GetObjectFromPool(Boolean)

Get an object from the pool, with option to forfeit a prefetched object

IsEmpty()

Determine if the pool is currently empty.

IsFull()

Determine if the pool is currently full and can't accept more objects.

MaximumObjectsCount()

Get the maximum allowed number of unused and prefetched objects.

ObjectIsPrefetched(Int32)

Check if an object is already in the prefab prefetch pool.

PrefetchedObjectsCount()

Get the number of prefetched objects in the pool.

ReturnAllPrefetchedObjects(Action<Int32,Object>)

Return all prefectehd objects to the pool for reuse.

ReturnObjectToPool(Object)

Return an object to the pool in a reset, unused state.

SetMaximumPoolSize(Int32, Boolean)

Establish the maximum number of items to allow in the data object pool.

TryGetPrefetchedObject(Int32, Object)

Get prefetched object for specified id and if not found, return a generic non-prefetched object instead.

UnusedObjectsCount()

Get the number of unused objects in the pool.

Applies to