Skip to main content

MaxLimitPooledObjectPool

A class in Root.Township, the global namespace.

Object pool with a hard limit (MaximumPoolSize): when it runs out it recycles the oldest active object instead of making a new one. PooledObjectDefinition creates it.

Constructors​

MemberWhat it is
MaxLimitPooledObjectPool(PooledObjectDefinition definition)Creates a MaxLimitPooledObjectPool from definition.

Fields​

2 private and internal fields
MemberWhat it is
private LinkedList<PooledObject> activeObjectsObjects handed out, oldest first.
private static Logger loggerNLog logger for this class.

Methods​

MemberWhat it is
override void Release(PooledObject pooledObject, Action releaseCallback)Takes an object back: removes it from the active list and stores it inactive, or destroys it if the pool is full. Warns on double release.
override PooledObject Request(Vector3 position, Quaternion rotation)Returns a pooled object, a new one, or the oldest active one when at the limit, placed at the given position and rotation.