Table of Contents

Class MonoBehaviourPool<T>

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

A pool suitable for MonoBehaviour objects that can be instantiated from a given prefab.

public class MonoBehaviourPool<T> : IPool<T> where T : Component

Type Parameters

T

The MonoBehaviour type of the objects to pool.

Inheritance
MonoBehaviourPool<T>
Implements
Inherited Members
Extension Methods

Constructors

MonoBehaviourPool(T, GameObject, int, Action<T>, Action<T>)

Initializes a new instance of the MonoBehaviourPool<T> class.

Properties

ActiveCount

The number of objects that are currently active.

Capacity

The total number of objects in the pool (active and inactive), the maximum number of objects that can be returned by Get().

HasAvailableObject

Returns whether there is an inactive object available to get.

IsObjectAvailable

Returns whether there is an inactive object available to get.

Methods

DecCapacity(int)

Decreases the capacity of the pool.

DecreaseCapacity(int, bool)

Decreases the capacity of the pool.

Get()

Gets a new object from the pool.

GetNewObject()

Gets a new object from the pool.

IncCapacity(int)

Increases the capacity of the pool.

IncreaseCapacity(int)

Increases the capacity of the pool.

Release(T)

Releases the specified object back to the pool.

ReleaseAll()

Releases all objects in the pool.

ReleaseObject(T)

Releases the specified object back to the pool.