Class XRCameraSubsystem | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class XRCameraSubsystem

    Provides access to a device's camera.

    Inheritance
    System.Object
    XRCameraSubsystem
    XRCameraSubsystemImpl
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public abstract class XRCameraSubsystem : Subsystem<XRCameraSubsystemDescriptor>
    Remarks

    The XRCameraSubsystem links a Unity Camera to a device camera for video overlay (pass-thru rendering). It also allows developers to query for environmental light estimation, when available.

    Constructors

    XRCameraSubsystem()

    Construct the XRCameraSubsystem.

    Declaration
    public XRCameraSubsystem()

    Properties

    focusMode

    Specifies the focus mode for the camera.

    Declaration
    public CameraFocusMode focusMode { get; set; }
    Property Value
    Type Description
    CameraFocusMode

    The focus mode for the camera.

    lightEstimationMode

    Specifies the light estimation mode.

    Declaration
    public LightEstimationMode lightEstimationMode { get; set; }
    Property Value
    Type Description
    LightEstimationMode

    The light estimation mode.

    permissionGranted

    Determines whether camera permission has been granted.

    Declaration
    public bool permissionGranted { get; }
    Property Value
    Type Description
    System.Boolean

    true if permission has been granted; otherwise, false.

    running

    Indicates whether this subsystem is running (i.e., Start() has been called).

    Declaration
    public override bool running { get; }
    Property Value
    Type Description
    System.Boolean

    shaderName

    Provides shader name used by XRCameraSubsystem to render texture.

    Declaration
    public string shaderName { get; }
    Property Value
    Type Description
    System.String

    Methods

    CreateProvider()

    Method for the implementation to create the camera functionality provider.

    Declaration
    protected abstract XRCameraSubsystem.IProvider CreateProvider()
    Returns
    Type Description
    XRCameraSubsystem.IProvider

    The camera functionality provider.

    Destroy()

    Destroy the camera subsystem.

    Declaration
    public override sealed void Destroy()

    GetTextureDescriptors(Allocator)

    Gets the XRTextureDescriptors associated with the current frame. The caller owns the returned NativeArray and is responsible for calling Dispose on it.

    Declaration
    public NativeArray<XRTextureDescriptor> GetTextureDescriptors(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use when creating the returned NativeArray.

    Returns
    Type Description
    NativeArray<XRTextureDescriptor>

    An array of texture descriptors.

    Register(XRCameraSubsystemCinfo)

    Registers a camera subsystem implementation based on the given subsystem parameters.

    Declaration
    public static bool Register(XRCameraSubsystemCinfo cameraSubsystemParams)
    Parameters
    Type Name Description
    XRCameraSubsystemCinfo cameraSubsystemParams

    The parameters defining the camera subsystem functionality implemented by the subsystem provider.

    Returns
    Type Description
    System.Boolean

    true if the subsystem implementation is registered. Otherwise, false.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the values specified in the XRCameraSubsystemCinfo parameter are invalid. Typically, this will occur

    • if id is null or empty
    • if implementationType is null
    • if implementationType does not derive from the XRCameraSubsystem class

    Start()

    Start the camera subsystem.

    Declaration
    public override sealed void Start()

    Stop()

    Stop the camera subsystem.

    Declaration
    public override sealed void Stop()

    TryGetIntrinsics(out XRCameraIntrinsics)

    Returns the camera intrinisics information.

    Declaration
    public bool TryGetIntrinsics(out XRCameraIntrinsics cameraIntrinsics)
    Parameters
    Type Name Description
    XRCameraIntrinsics cameraIntrinsics

    The camera intrinsics information returned from the method.

    Returns
    Type Description
    System.Boolean

    true if the method successfully gets the camera intrinsics information. Otherwise, false.

    TryGetLatestFrame(XRCameraParams, out XRCameraFrame)

    Update the camera subsystem.

    Declaration
    public bool TryGetLatestFrame(XRCameraParams cameraParams, out XRCameraFrame frame)
    Parameters
    Type Name Description
    XRCameraParams cameraParams
    XRCameraFrame frame
    Returns
    Type Description
    System.Boolean
    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