Class ObjectPool<T> | Unity Reflect | 1.1.0-preview.6
docs.unity.cn
    Show / Hide Table of Contents

    Class ObjectPool<T>

    Inheritance
    Object
    ObjectPool<T>
    Namespace: Unity.Labs.Utils
    Syntax
    public class ObjectPool<T>
        where T : class, new()
    Type Parameters
    Name Description
    T

    Fields

    m_Queue

    Declaration
    protected readonly Queue<T> m_Queue
    Field Value
    Type Description
    Queue<T>

    Methods

    ClearInstance(T)

    Implement a clearing function in this in a derived class to have the Recycle(T) method automatically clear the item.

    Declaration
    protected virtual void ClearInstance(T instance)
    Parameters
    Type Name Description
    T instance

    The object to return to the pool

    Get()

    Declaration
    public virtual T Get()
    Returns
    Type Description
    T

    Recycle(T)

    Declaration
    public void Recycle(T instance)
    Parameters
    Type Name Description
    T instance
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX