Class ARCameraManager | AR Foundation | 2.2.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Class ARCameraManager

    Manages the lifetime of the XRCameraSubsystem. Add one of these to a Camera in your scene if you want camera texture and light estimation information to be available.

    Inheritance
    Object
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>
    ARCameraManager
    Inherited Members
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.subsystem
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.descriptor
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.CreateSubsystem()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.CreateSubsystemIfNecessary()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.GetActiveSubsystemInstance()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnEnable()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnDisable()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnDestroy()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnBeforeStart()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnAfterStart()
    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    public sealed class ARCameraManager : SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>

    Properties

    currentConfiguration

    The current camera configuration.

    Declaration
    public XRCameraConfiguration? currentConfiguration { get; set; }
    Property Value
    Type Description
    Nullable<XRCameraConfiguration>

    The current camera configuration, if it exists. Otherise, null.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown when setting the current configuration if the implementation does not support camera configurations.

    ArgumentNullException

    Thrown when setting the current configuration if the given configuration is null.

    ArgumentException

    Thrown when setting the current configuration if the given configuration is not a supported camera configuration.

    InvalidOperationException

    Thrown when setting the current configuration if the implementation is unable to set the current camera configuration.

    focusMode

    The CameraFocusMode for the camera.

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

    The focus mode for the camera.

    lightEstimationMode

    The LightEstimationMode for the camera.

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

    The light estimation mode for the camera.

    permissionGranted

    Determines whether camera permission has been granted.

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

    true if permission has been granted. Otherwise, false.

    shaderName

    The name of the shader used in background rendering.

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

    The name of the shader used in background rendering.

    Methods

    GetConfigurations(Allocator)

    Get the camera configurations currently supported for the implementation.

    Declaration
    public NativeArray<XRCameraConfiguration> GetConfigurations(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocation strategy to use for the returned data.

    Returns
    Type Description
    NativeArray<XRCameraConfiguration>

    The supported camera configurations.

    OnBeforeStart()

    Callback before the subsystem is started (but after it is created).

    Declaration
    protected override void OnBeforeStart()
    Overrides
    UnityEngine.XR.ARFoundation.SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnBeforeStart()

    TryGetIntrinsics(out XRCameraIntrinsics)

    Tries to get camera intrinsics. Camera intrinsics refers to properties of a physical camera which may be useful when performing additional computer vision processing on the camera image.

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

    The camera intrinsics to be populated if the camera supports intrinsics

    Returns
    Type Description
    Boolean

    true if cameraIntrinsics was populated. Otherwise, false.

    TryGetLatestImage(out XRCameraImage)

    Attempt to get the latest camera image. This provides directly access to the raw pixel data, as well as utilities to convert to RGB and Grayscale formats.

    Declaration
    public bool TryGetLatestImage(out XRCameraImage cameraImage)
    Parameters
    Type Name Description
    XRCameraImage cameraImage

    A valid XRCameraImage if this method returns true.

    Returns
    Type Description
    Boolean

    true if the image was acquired. Otherwise, false.

    Remarks

    The XRCameraImage must be disposed to avoid resource leaks.

    Events

    frameReceived

    An event which fires each time a new camera frame is received.

    Declaration
    public event Action<ARCameraFrameEventArgs> frameReceived
    Event Type
    Type Description
    Action<ARCameraFrameEventArgs>
    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