docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class ObjectPool<T>

    Provides a generic object pool implementation.

    Inheritance
    object
    ObjectPool<T>
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.XR.CoreUtils
    Assembly: solution.dll
    Syntax
    public class ObjectPool<T> where T : class, new()
    Type Parameters
    Name Description
    T

    The Type of objects in this pool.

    Fields

    Name Description
    PooledQueue

    All objects currently in this pool.

    Methods

    Name Description
    ClearInstance(T)

    Implement this function in a derived class to automatically clear an instance when Recycle(T) is called.

    Get()

    Gets an object instance from the pool. Creates a new instance if the pool is empty.

    Recycle(T)

    Returns an object instance to the pool.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)