Class CoreUtils | Core RP Library | 7.2.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class CoreUtils

    Set of utility functions for the Core Scriptable Render Pipeline Library

    Inheritance
    Object
    CoreUtils
    Namespace: UnityEngine.Rendering
    Syntax
    public static class CoreUtils

    Fields

    assetCreateMenuPriority1

    Asset Create Menu priority 1

    Declaration
    public const int assetCreateMenuPriority1 = 230
    Field Value
    Type Description
    Int32

    assetCreateMenuPriority2

    Asset Create Menu priority 2

    Declaration
    public const int assetCreateMenuPriority2 = 241
    Field Value
    Type Description
    Int32

    assetCreateMenuPriority3

    Asset Create Menu priority 3

    Declaration
    public const int assetCreateMenuPriority3 = 300
    Field Value
    Type Description
    Int32

    editMenuPriority1

    Edit Menu priority 1

    Declaration
    public const int editMenuPriority1 = 320
    Field Value
    Type Description
    Int32

    editMenuPriority2

    Edit Menu priority 2

    Declaration
    public const int editMenuPriority2 = 331
    Field Value
    Type Description
    Int32

    editMenuPriority3

    Edit Menu priority 3

    Declaration
    public const int editMenuPriority3 = 342
    Field Value
    Type Description
    Int32

    editMenuPriority4

    Edit Menu priority 4

    Declaration
    public const int editMenuPriority4 = 353
    Field Value
    Type Description
    Int32

    gameObjectMenuPriority

    Game Object Menu priority

    Declaration
    public const int gameObjectMenuPriority = 10
    Field Value
    Type Description
    Int32

    lookAtList

    List of look at matrices for cubemap faces. Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204881(v=vs.85).aspx

    Declaration
    public static readonly Vector3[] lookAtList
    Field Value
    Type Description
    Vector3[]

    upVectorList

    List of up vectors for cubemap faces. Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204881(v=vs.85).aspx

    Declaration
    public static readonly Vector3[] upVectorList
    Field Value
    Type Description
    Vector3[]

    Properties

    blackCubeTexture

    Black cubemap texture.

    Declaration
    public static Cubemap blackCubeTexture { get; }
    Property Value
    Type Description
    Cubemap

    blackVolumeTexture

    Black 3D texture.

    Declaration
    public static Texture3D blackVolumeTexture { get; }
    Property Value
    Type Description
    Texture3D

    emptyUAV

    Empty 1x1 texture usable as a dummy UAV.

    Declaration
    public static RenderTexture emptyUAV { get; }
    Property Value
    Type Description
    RenderTexture

    magentaCubeTexture

    Magenta cubemap texture.

    Declaration
    public static Cubemap magentaCubeTexture { get; }
    Property Value
    Type Description
    Cubemap

    magentaCubeTextureArray

    Black cubemap array texture.

    Declaration
    public static CubemapArray magentaCubeTextureArray { get; }
    Property Value
    Type Description
    CubemapArray

    whiteCubeTexture

    White cubemap texture.

    Declaration
    public static Cubemap whiteCubeTexture { get; }
    Property Value
    Type Description
    Cubemap

    Methods

    AreAnimatedMaterialsEnabled(Camera)

    Returns true if "Animated Materials" are enabled for the view associated with the given camera.

    Declaration
    public static bool AreAnimatedMaterialsEnabled(Camera camera)
    Parameters
    Type Name Description
    Camera camera

    Input camera.

    Returns
    Type Description
    Boolean

    True if "Animated Materials" are enabled for the view associated with the given camera.

    ArePostProcessesEnabled(Camera)

    Returns true if "Post Processes" are enabled for the view associated with the given camera.

    Declaration
    public static bool ArePostProcessesEnabled(Camera camera)
    Parameters
    Type Name Description
    Camera camera

    Input camera.

    Returns
    Type Description
    Boolean

    True if "Post Processes" are enabled for the view associated with the given camera.

    ClearCubemap(CommandBuffer, RenderTexture, Color, Boolean)

    Clear a cubemap render texture.

    Declaration
    public static void ClearCubemap(CommandBuffer cmd, RenderTexture renderTexture, Color clearColor, bool clearMips = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTexture renderTexture

    Cubemap render texture that needs to be cleared.

    Color clearColor

    Color used for clearing.

    Boolean clearMips

    Set to true to clear the mip maps of the render texture.

    ClearRenderTarget(CommandBuffer, ClearFlag, Color)

    Clear the currently bound render texture.

    Declaration
    public static void ClearRenderTarget(CommandBuffer cmd, ClearFlag clearFlag, Color clearColor)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    ClearFlag clearFlag

    Specify how the render texture should be cleared.

    Color clearColor

    Specify with which color the render texture should be cleared.

    ConvertLinearToActiveColorSpace(Color)

    Converts the provided linear color to the current active color space.

    Declaration
    public static Color ConvertLinearToActiveColorSpace(Color color)
    Parameters
    Type Name Description
    Color color

    Input color.

    Returns
    Type Description
    Color

    sRGB color if the active color space is ColorSpace.Gamma, the original input otherwise.

    ConvertSRGBToActiveColorSpace(Color)

    Converts the provided sRGB color to the current active color space.

    Declaration
    public static Color ConvertSRGBToActiveColorSpace(Color color)
    Parameters
    Type Name Description
    Color color

    Input color.

    Returns
    Type Description
    Color

    Linear color if the active color space is ColorSpace.Linear, the original input otherwise.

    CreateCubeMesh(Vector3, Vector3)

    Creates a cube mesh.

    Declaration
    public static Mesh CreateCubeMesh(Vector3 min, Vector3 max)
    Parameters
    Type Name Description
    Vector3 min

    Minimum corner coordinates in local space.

    Vector3 max

    Maximum corner coordinates in local space.

    Returns
    Type Description
    Mesh

    A new instance of a cube Mesh.

    CreateEngineMaterial(Shader)

    Creates a Material with the provided shader. hideFlags will be set to HideFlags.HideAndDontSave.

    Declaration
    public static Material CreateEngineMaterial(Shader shader)
    Parameters
    Type Name Description
    Shader shader

    Shader used for the material.

    Returns
    Type Description
    Material

    A new Material instance using the provided shader.

    CreateEngineMaterial(String)

    Creates a Material with the provided shader path. hideFlags will be set to HideFlags.HideAndDontSave.

    Declaration
    public static Material CreateEngineMaterial(string shaderPath)
    Parameters
    Type Name Description
    String shaderPath

    Path of the shader used for the material.

    Returns
    Type Description
    Material

    A new Material instance using the shader found at the provided path.

    Destroy(Object)

    Destroys a UnityObject safely.

    Declaration
    public static void Destroy(Object obj)
    Parameters
    Type Name Description
    UnityEngine.Object obj

    Object to be destroyed.

    DrawFullScreen(CommandBuffer, Material, MaterialPropertyBlock, Int32)

    Draws a full screen triangle.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    CommandBuffer used for rendering commands.

    Material material

    Material used on the full screen triangle.

    MaterialPropertyBlock properties

    Optional material property block for the provided material.

    Int32 shaderPassId

    Index of the material pass.

    DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, MaterialPropertyBlock, Int32)

    Draws a full screen triangle.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier colorBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    CommandBuffer used for rendering commands.

    Material material

    Material used on the full screen triangle.

    RenderTargetIdentifier colorBuffer

    RenderTargetIdentifier of the color buffer that needs to be set before drawing the full screen triangle.

    MaterialPropertyBlock properties

    Optional material property block for the provided material.

    Int32 shaderPassId

    Index of the material pass.

    DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, RenderTargetIdentifier, MaterialPropertyBlock, Int32)

    Draws a full screen triangle.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    CommandBuffer used for rendering commands.

    Material material

    Material used on the full screen triangle.

    RenderTargetIdentifier colorBuffer

    RenderTargetIdentifier of the color buffer that needs to be set before drawing the full screen triangle.

    RenderTargetIdentifier depthStencilBuffer

    RenderTargetIdentifier of the depth buffer that needs to be set before drawing the full screen triangle.

    MaterialPropertyBlock properties

    Optional material property block for the provided material.

    Int32 shaderPassId

    Index of the material pass.

    DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], MaterialPropertyBlock, Int32)

    Draws a full screen triangle.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier[] colorBuffers, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    CommandBuffer used for rendering commands.

    Material material

    Material used on the full screen triangle.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color buffers that needs to be set before drawing the full screen triangle.

    MaterialPropertyBlock properties

    Optional material property block for the provided material.

    Int32 shaderPassId

    Index of the material pass.

    DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], RenderTargetIdentifier, MaterialPropertyBlock, Int32)

    Draws a full screen triangle.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    CommandBuffer used for rendering commands.

    Material material

    Material used on the full screen triangle.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color buffers that needs to be set before drawing the full screen triangle.

    RenderTargetIdentifier depthStencilBuffer

    RenderTargetIdentifier of the depth buffer that needs to be set before drawing the full screen triangle.

    MaterialPropertyBlock properties

    Optional material property block for the provided material.

    Int32 shaderPassId

    Index of the material pass.

    GetAllAssemblyTypes()

    Returns all assembly types.

    Declaration
    public static IEnumerable<Type> GetAllAssemblyTypes()
    Returns
    Type Description
    IEnumerable<Type>

    The list of all assembly types of the current domain.

    GetAllTypesDerivedFrom<T>()

    Returns a list of types that inherit from the provided type.

    Declaration
    public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()
    Returns
    Type Description
    IEnumerable<Type>

    A list of types that inherit from the provided type.

    Type Parameters
    Name Description
    T

    Parent Type

    GetRenderTargetAutoName(Int32, Int32, Int32, GraphicsFormat, String, Boolean, Boolean, MSAASamples)

    Generate a name based on render texture parameters.

    Declaration
    public static string GetRenderTargetAutoName(int width, int height, int depth, GraphicsFormat format, string name, bool mips = false, bool enableMSAA = false, MSAASamples msaaSamples = MSAASamples.None)
    Parameters
    Type Name Description
    Int32 width

    With of the texture.

    Int32 height

    Height of the texture.

    Int32 depth

    Depth of the texture.

    GraphicsFormat format

    Graphics format of the render texture.

    String name

    Base name of the texture.

    Boolean mips

    True if the texture has mip maps.

    Boolean enableMSAA

    True if the texture is multisampled.

    MSAASamples msaaSamples

    Number of MSAA samples.

    Returns
    Type Description
    String

    Generated names bassed on the provided parameters.

    GetRenderTargetAutoName(Int32, Int32, Int32, RenderTextureFormat, String, Boolean, Boolean, MSAASamples)

    Generate a name based on render texture parameters.

    Declaration
    public static string GetRenderTargetAutoName(int width, int height, int depth, RenderTextureFormat format, string name, bool mips = false, bool enableMSAA = false, MSAASamples msaaSamples = MSAASamples.None)
    Parameters
    Type Name Description
    Int32 width

    With of the texture.

    Int32 height

    Height of the texture.

    Int32 depth

    Depth of the texture.

    RenderTextureFormat format

    Format of the render texture.

    String name

    Base name of the texture.

    Boolean mips

    True if the texture has mip maps.

    Boolean enableMSAA

    True if the texture is multisampled.

    MSAASamples msaaSamples

    Number of MSAA samples.

    Returns
    Type Description
    String

    Generated names bassed on the provided parameters.

    GetTextureAutoName(Int32, Int32, GraphicsFormat, TextureDimension, String, Boolean, Int32)

    Generate a name based on texture parameters.

    Declaration
    public static string GetTextureAutoName(int width, int height, GraphicsFormat format, TextureDimension dim = null, string name = "", bool mips = false, int depth = 0)
    Parameters
    Type Name Description
    Int32 width

    With of the texture.

    Int32 height

    Height of the texture.

    GraphicsFormat format

    Graphics format of the texture.

    TextureDimension dim

    Dimension of the texture.

    String name

    Base name of the texture.

    Boolean mips

    True if the texture has mip maps.

    Int32 depth

    Depth of the texture.

    Returns
    Type Description
    String

    Generated names based on the provided parameters.

    GetTextureAutoName(Int32, Int32, TextureFormat, TextureDimension, String, Boolean, Int32)

    Generate a name based on texture parameters.

    Declaration
    public static string GetTextureAutoName(int width, int height, TextureFormat format, TextureDimension dim = null, string name = "", bool mips = false, int depth = 0)
    Parameters
    Type Name Description
    Int32 width

    With of the texture.

    Int32 height

    Height of the texture.

    TextureFormat format

    Format of the texture.

    TextureDimension dim

    Dimension of the texture.

    String name

    Base name of the texture.

    Boolean mips

    True if the texture has mip maps.

    Int32 depth

    Depth of the texture.

    Returns
    Type Description
    String

    Generated names based on the provided parameters.

    HasFlag<T>(T, T)

    Bitfield flag test.

    Declaration
    public static bool HasFlag<T>(T mask, T flag)
        where T : IConvertible
    Parameters
    Type Name Description
    T mask

    Bitfield to test the flag against.

    T flag

    Flag to be tested against the provided mask.

    Returns
    Type Description
    Boolean

    True if the flag is present in the mask.

    Type Parameters
    Name Description
    T

    Type of the enum flag.

    IsSceneLightingDisabled(Camera)

    Returns true if "Scene Lighting" is enabled for the view associated with the given camera.

    Declaration
    public static bool IsSceneLightingDisabled(Camera camera)
    Parameters
    Type Name Description
    Camera camera

    Input camera.

    Returns
    Type Description
    Boolean

    True if "Scene Lighting" is enabled for the view associated with the given camera.

    IsSceneViewFogEnabled(Camera)

    Returns true if "Fog" is enabled for the view associated with the given camera.

    Declaration
    public static bool IsSceneViewFogEnabled(Camera camera)
    Parameters
    Type Name Description
    Camera camera

    Input camera.

    Returns
    Type Description
    Boolean

    True if "Fog" is enabled for the view associated with the given camera.

    SafeRelease(ComputeBuffer)

    Safely release a Compute Buffer.

    Declaration
    public static void SafeRelease(ComputeBuffer buffer)
    Parameters
    Type Name Description
    ComputeBuffer buffer

    Compute Buffer that needs to be released.

    SetKeyword(CommandBuffer, String, Boolean)

    Set a global keyword using a CommandBuffer

    Declaration
    public static void SetKeyword(CommandBuffer cmd, string keyword, bool state)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer on which to set the global keyword.

    String keyword

    Keyword to be set.

    Boolean state

    Value of the keyword to be set.

    SetKeyword(Material, String, Boolean)

    Set a keyword immediatly on a Material.

    Declaration
    public static void SetKeyword(Material material, string keyword, bool state)
    Parameters
    Type Name Description
    Material material

    Material on which to set the keyword.

    String keyword

    Keyword to set on the material.

    Boolean state

    Value of the keyword to set on the material.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier colorBuffer

    Color buffer RenderTargetIdentifier.

    RenderBufferLoadAction colorLoadAction

    Color buffer load action.

    RenderBufferStoreAction colorStoreAction

    Color buffer store action.

    RenderTargetIdentifier depthBuffer

    Depth buffer RenderTargetIdentifier.

    RenderBufferLoadAction depthLoadAction

    Depth buffer load action.

    RenderBufferStoreAction depthStoreAction

    Depth buffer store action.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthBuffer, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction, ClearFlag clearFlag, Color clearColor)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier colorBuffer

    Color buffer RenderTargetIdentifier.

    RenderBufferLoadAction colorLoadAction

    Color buffer load action.

    RenderBufferStoreAction colorStoreAction

    Color buffer store action.

    RenderTargetIdentifier depthBuffer

    Depth buffer RenderTargetIdentifier.

    RenderBufferLoadAction depthLoadAction

    Depth buffer load action.

    RenderBufferStoreAction depthStoreAction

    Depth buffer store action.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier buffer

    Color buffer RenderTargetIdentifier.

    RenderBufferLoadAction loadAction

    Load action.

    RenderBufferStoreAction storeAction

    Store action.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, ClearFlag clearFlag, Color clearColor)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier buffer

    Color buffer RenderTargetIdentifier.

    RenderBufferLoadAction loadAction

    Load action.

    RenderBufferStoreAction storeAction

    Store action.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Int32, CubemapFace, Int32)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier colorBuffer

    RenderTargetIdentifier of the color render texture.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, Color, Int32, CubemapFace, Int32)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier colorBuffer

    RenderTargetIdentifier of the color render texture.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, Int32, CubemapFace, Int32)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier colorBuffer

    RenderTargetIdentifier of the color render texture.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, Color, Int32, CubemapFace, Int32)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier buffer

    RenderTargetIdentifier of the render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, Int32, CubemapFace, Int32)

    Set the current render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier buffer, ClearFlag clearFlag = ClearFlag.None, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier buffer

    RenderTargetIdentifier of the render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag = ClearFlag.None)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag, Color)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthBuffer, ClearFlag clearFlag, Color clearColor)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RenderTargetIdentifier depthBuffer

    RenderTargetIdentifier of the depth render texture.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RTHandle depthBuffer

    Depth Buffer RTHandle.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer, ClearFlag clearFlag = ClearFlag.None)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RTHandle depthBuffer

    Depth Buffer RTHandle.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag, Color)

    Set the current multiple render texture.

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier[] colorBuffers, RTHandle depthBuffer, ClearFlag clearFlag, Color clearColor)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RenderTargetIdentifier[] colorBuffers

    RenderTargetIdentifier array of the color render textures.

    RTHandle depthBuffer

    Depth Buffer RTHandle.

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, Color, Int32, CubemapFace, Int32)

    Setup the current render texture using an RTHandle

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RTHandle buffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands

    RTHandle buffer

    Color buffer RTHandle

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, Int32, CubemapFace, Int32)

    Setup the current render texture using an RTHandle

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RTHandle buffer, ClearFlag clearFlag = ClearFlag.None, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands

    RTHandle buffer

    Color buffer RTHandle

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RTHandle, RTHandle, Int32, CubemapFace, Int32)

    Setup the current render texture using an RTHandle

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands

    RTHandle colorBuffer

    Color buffer RTHandle

    RTHandle depthBuffer

    Depth buffer RTHandle

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, Color, Int32, CubemapFace, Int32)

    Setup the current render texture using an RTHandle

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, ClearFlag clearFlag, Color clearColor, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands

    RTHandle colorBuffer

    Color buffer RTHandle

    RTHandle depthBuffer

    Depth buffer RTHandle

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Color clearColor

    If applicable, color with which to clear the render texture after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, Int32, CubemapFace, Int32)

    Setup the current render texture using an RTHandle

    Declaration
    public static void SetRenderTarget(CommandBuffer cmd, RTHandle colorBuffer, RTHandle depthBuffer, ClearFlag clearFlag, int miplevel = 0, CubemapFace cubemapFace = null, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands

    RTHandle colorBuffer

    Color buffer RTHandle

    RTHandle depthBuffer

    Depth buffer RTHandle

    ClearFlag clearFlag

    If not set to ClearFlag.None, specifies how to clear the render target after setup.

    Int32 miplevel

    Mip level that should be bound as a render texture if applicable.

    CubemapFace cubemapFace

    Cubemap face that should be bound as a render texture if applicable.

    Int32 depthSlice

    Depth slice that should be bound as a render texture if applicable.

    SetViewport(CommandBuffer, RTHandle)

    Setup the viewport to the size of the provided RTHandle.

    Declaration
    public static void SetViewport(CommandBuffer cmd, RTHandle target)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer used for rendering commands.

    RTHandle target

    RTHandle from which to compute the proper viewport.

    Swap<T>(ref T, ref T)

    Swaps two values.

    Declaration
    public static void Swap<T>(ref T a, ref T b)
    Parameters
    Type Name Description
    T a

    First value.

    T b

    Second value.

    Type Parameters
    Name Description
    T

    Type of the values

    In This Article
    • Fields
      • assetCreateMenuPriority1
      • assetCreateMenuPriority2
      • assetCreateMenuPriority3
      • editMenuPriority1
      • editMenuPriority2
      • editMenuPriority3
      • editMenuPriority4
      • gameObjectMenuPriority
      • lookAtList
      • upVectorList
    • Properties
      • blackCubeTexture
      • blackVolumeTexture
      • emptyUAV
      • magentaCubeTexture
      • magentaCubeTextureArray
      • whiteCubeTexture
    • Methods
      • AreAnimatedMaterialsEnabled(Camera)
      • ArePostProcessesEnabled(Camera)
      • ClearCubemap(CommandBuffer, RenderTexture, Color, Boolean)
      • ClearRenderTarget(CommandBuffer, ClearFlag, Color)
      • ConvertLinearToActiveColorSpace(Color)
      • ConvertSRGBToActiveColorSpace(Color)
      • CreateCubeMesh(Vector3, Vector3)
      • CreateEngineMaterial(Shader)
      • CreateEngineMaterial(String)
      • Destroy(Object)
      • DrawFullScreen(CommandBuffer, Material, MaterialPropertyBlock, Int32)
      • DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, MaterialPropertyBlock, Int32)
      • DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier, RenderTargetIdentifier, MaterialPropertyBlock, Int32)
      • DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], MaterialPropertyBlock, Int32)
      • DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], RenderTargetIdentifier, MaterialPropertyBlock, Int32)
      • GetAllAssemblyTypes()
      • GetAllTypesDerivedFrom<T>()
      • GetRenderTargetAutoName(Int32, Int32, Int32, GraphicsFormat, String, Boolean, Boolean, MSAASamples)
      • GetRenderTargetAutoName(Int32, Int32, Int32, RenderTextureFormat, String, Boolean, Boolean, MSAASamples)
      • GetTextureAutoName(Int32, Int32, GraphicsFormat, TextureDimension, String, Boolean, Int32)
      • GetTextureAutoName(Int32, Int32, TextureFormat, TextureDimension, String, Boolean, Int32)
      • HasFlag<T>(T, T)
      • IsSceneLightingDisabled(Camera)
      • IsSceneViewFogEnabled(Camera)
      • SafeRelease(ComputeBuffer)
      • SetKeyword(CommandBuffer, String, Boolean)
      • SetKeyword(Material, String, Boolean)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, ClearFlag, Color)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, Color, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, ClearFlag, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, Color, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier, ClearFlag, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RenderTargetIdentifier, ClearFlag, Color)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag)
      • SetRenderTarget(CommandBuffer, RenderTargetIdentifier[], RTHandle, ClearFlag, Color)
      • SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, Color, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RTHandle, ClearFlag, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RTHandle, RTHandle, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, Color, Int32, CubemapFace, Int32)
      • SetRenderTarget(CommandBuffer, RTHandle, RTHandle, ClearFlag, Int32, CubemapFace, Int32)
      • SetViewport(CommandBuffer, RTHandle)
      • Swap<T>(ref T, ref T)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023