Search Results for

    Show / Hide Table of Contents

    Class CameraExtensions

    UnityEngine.Camera Based Extension Methods

    Inheritance
    System.Object
    CameraExtensions
    Namespace: GDX
    Syntax
    [VisualScriptingCompatible((short)2)]
    public static class CameraExtensions

    Methods

    | Improve this Doc View Source

    RenderToPNG(Camera, String, Int32, Int32, Int32)

    Forces a UnityEngine.Camera through RenderToTexture(Camera, Int32, Int32, Int32) encoding to PNG.

    Declaration
    public static bool RenderToPNG(this Camera targetCamera, string outputPath, int width = 1920, int height = 1080, int depthBuffer = 24)
    Parameters
    Type Name Description
    UnityEngine.Camera targetCamera

    The target UnityEngine.Camera to use.

    System.String outputPath

    The full path to output the PNG bytes.

    System.Int32 width

    The desired width of the rendered texture.

    System.Int32 height

    The desired height of the rendered texture.

    System.Int32 depthBuffer

    The desired depth of the rendered texture.

    Returns
    Type Description
    System.Boolean

    true/false if the capture was successful.

    Remarks

    This does not indicate if the writing of the PNG was successful.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    | Improve this Doc View Source

    RenderToTexture(Camera, Int32, Int32, Int32)

    Forces a UnityEngine.Camera to render it's view into a texture.

    Declaration
    public static Texture2D RenderToTexture(this Camera targetCamera, int width = 1920, int height = 1080, int depthBuffer = 24)
    Parameters
    Type Name Description
    UnityEngine.Camera targetCamera

    The target UnityEngine.Camera to use.

    System.Int32 width

    The desired width of the rendered texture.

    System.Int32 height

    The desired height of the rendered texture.

    System.Int32 depthBuffer

    The desired depth of the rendered texture.

    Returns
    Type Description
    UnityEngine.Texture2D

    The rendered view.

    Remarks

    This behaves differently then using UnityEngine.ScreenCapture.

    Exceptions
    Type Condition
    UnsupportedRuntimeException

    Not supported on DOTS Runtime.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.