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
IncreaseCapacityTo(int) void
Increases the Animancer.ObjectPool`1.Capacity to equal the `capacity` if it was lower.
static
IncreaseCountTo(int) void
Increases the Animancer.ObjectPool`1.Count to equal the `count` if it was lower.
static
Release(T) void
Adds the `item` to the list of spares so it can be reused.
static