docs.unity3d.com
    Show / Hide Table of Contents

    Class GraphicsUtilities

    Inheritance
    Object
    GraphicsUtilities
    Namespace: Unity.Simulation
    Syntax
    public static class GraphicsUtilities

    Methods

    DepthFormatForDepth(Int32)

    Get the GraphicsFormat for the input number of depth bits per pixel.

    Declaration
    public static GraphicsFormat DepthFormatForDepth(int depthBpp)
    Parameters
    Type Name Description
    Int32 depthBpp

    Depth: Number of bits per pixel.

    Returns
    Type Description
    GraphicsFormat

    Graphics format for the corresponding number of depth bits per pixel.

    Exceptions
    Type Condition
    NotSupportedException

    GetBlockSize(GraphicsFormat)

    Get the size of a pixel in bytes for a given format.

    Declaration
    public static int GetBlockSize(GraphicsFormat format)
    Parameters
    Type Name Description
    GraphicsFormat format

    Graphics format you are using.

    Returns
    Type Description
    Int32

    Returns the size of the pixel in bytes.

    GetComponentCount(GraphicsFormat)

    Get the number of components for a given format.

    Declaration
    public static int GetComponentCount(GraphicsFormat format)
    Parameters
    Type Name Description
    GraphicsFormat format

    Graphics format you are using.

    Returns
    Type Description
    Int32

    Returns the number of components.

    GetPixelsSlow(RenderTexture)

    Perform the readback from the provided Render texture using ReadPixels API.

    Declaration
    public static byte[] GetPixelsSlow(RenderTexture renderTexture)
    Parameters
    Type Name Description
    RenderTexture renderTexture

    Input source Render texture for the readback.

    Returns
    Type Description
    Byte[]

    Returns a byte array of the RGB data retrieved from the readback.

    Exceptions
    Type Condition
    NotSupportedException

    SupportsAsyncReadback()

    Check if the AsyncReadback is supported by the current Graphics API.

    Declaration
    public static bool SupportsAsyncReadback()
    Returns
    Type Description
    Boolean

    Returns a bool indicating if the asyncreadback is supported.

    SupportsRenderTextureFormat(GraphicsFormat)

    Check if the given GraphicsFormat is supported by the current platform.

    Declaration
    public static bool SupportsRenderTextureFormat(GraphicsFormat format)
    Parameters
    Type Name Description
    GraphicsFormat format

    Input Graphics format.

    Returns
    Type Description
    Boolean

    Boolean indicating if the graphics format is supported.

    Back to top
    Terms of use
    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