docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct TextureHandle

    An abstract handle representing a texture resource as known by one particular record + execute of the render graph. TextureHandles should not be used outside of the context of a render graph execution.

    A render graph needs to do additional state tracking on texture resources (lifetime, how is it used,...) to enable this all textures relevant to the render graph need to be make known to it. A texture handle specifies such a texture as known to the render graph.

    It is important to understand that a render graph texture handle does not necessarily represent an actual texture. For example textures could be created the render graph that are only referenced by passes that are later culled when executing the graph. Such textures would never be allocated as actual RenderTextures.

    Texture handles are only relevant to one particular record+execute phase of the render graph. After execution all texture handles are invalidated. The system will catch texture handles from a different execution of the render graph but still users should be careful to avoid keeping texture handles around from other render graph executions.

    Texture handles do not need to be disposed/freed (they are auto-invalidated at the end of graph execution). The RenderTextures they represent are either freed by the render graph internally (when the handle was acquired through RenderGraph.CreateTexture) or explicitly managed by some external system (when acquired through RenderGraph.ImportTexture).

    Implements
    IEquatable<TextureHandle>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Rendering.RenderGraphModule
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    [MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule", null)]
    public readonly struct TextureHandle : IEquatable<TextureHandle>

    Properties

    nullHandle

    Returns a null texture handle

    Declaration
    public static TextureHandle nullHandle { get; }
    Property Value
    Type Description
    TextureHandle

    A null texture handle.

    Methods

    Equals(object)

    Determines whether the specified object is equal to the current TextureHandle.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current instance.

    Returns
    Type Description
    bool

    True if the specified object is a TextureHandle and references the same underlying resource; otherwise, false.

    Overrides
    ValueType.Equals(object)

    Equals(TextureHandle)

    Determines whether this instance and another specified TextureHandle object have the same underlying resource handle.

    Declaration
    public bool Equals(TextureHandle other)
    Parameters
    Type Name Description
    TextureHandle other

    The texture handle to compare with the current instance.

    Returns
    Type Description
    bool

    True if both texture handles reference the same underlying resource; otherwise, false.

    GetDescriptor(RenderGraph)

    Get the Descriptor of the texture. This simply calls RenderGraph.GetTextureDesc but is more easily discoverable through auto complete.

    Declaration
    public TextureDesc GetDescriptor(RenderGraph renderGraph)
    Parameters
    Type Name Description
    RenderGraph renderGraph

    The rendergraph instance that was used to create the texture on. Texture handles are a lightweight object, all information is stored on the RenderGraph itself.

    Returns
    Type Description
    TextureDesc

    The texture descriptor for the given texture handle.

    GetHashCode()

    Returns the hash code for this TextureHandle.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    The hash code of the current TextureHandle.

    Overrides
    ValueType.GetHashCode()

    IsValid()

    Return true if the handle is valid.

    Declaration
    public bool IsValid()
    Returns
    Type Description
    bool

    True if the handle is valid.

    Operators

    operator ==(TextureHandle, TextureHandle)

    Determines whether two TextureHandle instances reference the same underlying resource.

    Declaration
    public static bool operator ==(TextureHandle lhs, TextureHandle rhs)
    Parameters
    Type Name Description
    TextureHandle lhs

    The first texture handle to compare.

    TextureHandle rhs

    The second texture handle to compare.

    Returns
    Type Description
    bool

    True if both handles reference the same underlying resource; otherwise, false.

    implicit operator RenderTexture(TextureHandle)

    Cast to RenderTexture

    Declaration
    public static implicit operator RenderTexture(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Input TextureHandle.

    Returns
    Type Description
    RenderTexture

    Resource as a RenderTexture.

    implicit operator RTHandle(TextureHandle)

    Cast to RTHandle

    Declaration
    public static implicit operator RTHandle(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Input TextureHandle.

    Returns
    Type Description
    RTHandle

    Resource as a RTHandle.

    implicit operator RenderTargetIdentifier(TextureHandle)

    Cast to RenderTargetIdentifier

    Declaration
    public static implicit operator RenderTargetIdentifier(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Input TextureHandle.

    Returns
    Type Description
    RenderTargetIdentifier

    Resource as a RenderTargetIdentifier.

    implicit operator Texture(TextureHandle)

    Cast to Texture

    Declaration
    public static implicit operator Texture(TextureHandle texture)
    Parameters
    Type Name Description
    TextureHandle texture

    Input TextureHandle.

    Returns
    Type Description
    Texture

    Resource as a Texture.

    operator !=(TextureHandle, TextureHandle)

    Determines whether two TextureHandle instances reference different underlying resources.

    Declaration
    public static bool operator !=(TextureHandle lhs, TextureHandle rhs)
    Parameters
    Type Name Description
    TextureHandle lhs

    The first texture handle to compare.

    TextureHandle rhs

    The second texture handle to compare.

    Returns
    Type Description
    bool

    True if the handles reference different underlying resources; otherwise, false.

    Implements

    IEquatable<T>

    Extension Methods

    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2026 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)