ObjectPool<T> Class

Summary

A simple object pooling system.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["ObjectPool<T>"] class Type type-node

Syntax

public static class ObjectPool<T> where T : class, new()

Remarks

T must not inherit from UnityEngine.Component or UnityEngine.ScriptableObject.

Type Parameters

Name Description
T

Properties

Name Value Summary
Capacity int
The System.Collections.Generic.List`1.Capacity of the internal list of spare items.
static
Count int
The number of spare items currently in the pool.
static

Methods

Name Value Summary
Acquire() T
Returns a spare item if there are any, or creates a new one.
static
GetDetails() string
Returns a description of the state of this pool.
static
Release(T) void
Adds the `item` to the list of spares so it can be reused.
static
SetMinCount(int) void
If the Animancer.ObjectPool`1.Count is less than the specified value, this method increases it to that value by creating new objects.
static