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>.OnEnable()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.OnDisable()
    SubsystemLifecycleManager<XRCameraSubsystem, XRCameraSubsystemDescriptor>.GetActiveSubsystemInstance()
    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.

    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()

    OnDisable()

    Callback when the manager is disabled.

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

    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.

    Remarks
    Note

    The intrinsics may change each frame. You should call this each frame that you need intrinsics in order to ensure you are using the intrinsics for the current frame.

    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.

    Note

    Starting November 2022, this method will always return false and not acquire a camera image on Android platforms due to API deprecation in ARCore SDK. Update to package version 4.x or higher to use supported version of the API. See https://developers.google.com/ar/develop/unity-arf/ndk-camera-deprecation.

    This methods will not be affected on iOS platforms and will continue to work same as before.

    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 © 2022 Unity Technologies
    Generated by DocFX
    on Friday, January 7, 2022
    Terms of use