docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class UnsafeGenericPool<T>

    Generic pool without collection checks. This class is an alternative for the GenericPool for object that allocate memory when they are being compared. It is the case for the CullingResult class from Unity, and because of this in HDRP HDCullingResults generates garbage whenever we use ==, .Equals or ReferenceEquals. This pool doesn't do any of these comparison because we don't check if the stack already contains the element before releasing it.

    Inheritance
    object
    UnsafeGenericPool<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public static class UnsafeGenericPool<T> where T : new()
    Type Parameters
    Name Description
    T

    Type of the objects in the pull.

    Methods

    Get()

    Get a new object.

    Declaration
    public static T Get()
    Returns
    Type Description
    T

    A new object from the pool.

    Get(out T)

    Get a new PooledObject

    Declaration
    public static ObjectPool<T>.PooledObject Get(out T value)
    Parameters
    Type Name Description
    T value

    Output typed object.

    Returns
    Type Description
    ObjectPool<T>.PooledObject

    A new PooledObject.

    Release(T)

    Release an object to the pool.

    Declaration
    public static void Release(T toRelease)
    Parameters
    Type Name Description
    T toRelease

    Object to release.

    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)