Table of Contents

Class ObjectPool<T>

Namespace
Framework.Patterns.Pure.Pool
Assembly
Assembly-CSharp.dll

UnityEngine.Pool.ObjectPool<T> 래퍼. IPoolable 콜백 자동 호출. IObjectPool<T> 구현체. [규칙] DI 등록 금지 — PlaySceneScope에서 new로 생성 후 등록. [규칙] Get 반환 null 허용 금지.

public class ObjectPool<T> : IObjectPool<T> where T : class, IPoolable

Type Parameters

T
Inheritance
object
ObjectPool<T>
Implements

Constructors

ObjectPool(Func<T>, int)

풀 생성.

public ObjectPool(Func<T> createFunc, int initialCapacity = 10)

Parameters

createFunc Func<T>

신규 인스턴스 생성 함수.

initialCapacity int

초기 용량 — 예상 최대 동시 수량 기준.

Properties

CountActive

현재 활성 오브젝트 수.

public int CountActive { get; }

Property Value

int

CountInactive

현재 비활성(풀 대기) 오브젝트 수.

public int CountInactive { get; }

Property Value

int

Methods

Dispose()

public void Dispose()

Get()

풀에서 오브젝트 획득.

public T Get()

Returns

T

Release(T)

사용 완료된 오브젝트 반환. Release 후 참조 사용 금지.

public void Release(T obj)

Parameters

obj T