docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRCameraSubsystem.Provider

    Interface for providing camera functionality for the implementation.

    Inheritance
    object
    SubsystemProvider
    SubsystemProvider<XRCameraSubsystem>
    XRCameraSubsystem.Provider
    Inherited Members
    SubsystemProvider<XRCameraSubsystem>.TryInitialize()
    SubsystemProvider.running
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public class XRCameraSubsystem.Provider : SubsystemProvider<XRCameraSubsystem>

    Properties

    autoFocusEnabled

    Get whether auto focus is enabled.

    Declaration
    public virtual bool autoFocusEnabled { get; }
    Property Value
    Type Description
    bool

    true if auto focus is enabled. Otherwise, false.

    See Also
    autoFocusRequested

    autoFocusRequested

    Get or set whether auto focus is requested.

    Declaration
    public virtual bool autoFocusRequested { get; set; }
    Property Value
    Type Description
    bool

    true if auto focus is requested. Otherwise, false.

    cameraMaterial

    Get the Material used by this XRCameraSubsystem to render the camera texture.

    Declaration
    public virtual Material cameraMaterial { get; }
    Property Value
    Type Description
    Material

    The Material to render the camera texture.

    cpuImageApi

    An instance of the XRCpuImage.Api used to operate on XRCpuImage objects.

    Declaration
    public virtual XRCpuImage.Api cpuImageApi { get; }
    Property Value
    Type Description
    XRCpuImage.Api

    currentBackgroundRenderingMode

    Get the current XRCameraBackgroundRenderingMode.

    Declaration
    public virtual XRCameraBackgroundRenderingMode currentBackgroundRenderingMode { get; }
    Property Value
    Type Description
    XRCameraBackgroundRenderingMode

    The current XRCameraBackgroundRenderingMode.

    See Also
    requestedBackgroundRenderingMode

    currentCamera

    Get the actual camera facing direction.

    Declaration
    public virtual Feature currentCamera { get; }
    Property Value
    Type Description
    Feature

    The current camera facing direction.

    See Also
    requestedCamera

    currentConfiguration

    Property to be implemented by the provider to query or set the current camera configuration.

    Declaration
    public virtual XRCameraConfiguration? currentConfiguration { get; set; }
    Property Value
    Type Description
    XRCameraConfiguration?

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

    Exceptions
    Type Condition
    NotSupportedException

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

    ArgumentException

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

    InvalidOperationException

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

    currentLightEstimation

    Get the current light estimation mode in use by the subsystem.

    Declaration
    public virtual Feature currentLightEstimation { get; }
    Property Value
    Type Description
    Feature

    The current light estimation mode.

    See Also
    requestedLightEstimation

    imageStabilizationEnabled

    Get whether Image Stabilization is enabled.

    Declaration
    public virtual bool imageStabilizationEnabled { get; }
    Property Value
    Type Description
    bool

    true if EIS is enabled. Otherwise, false.

    See Also
    imageStabilizationRequested

    imageStabilizationRequested

    Get or set whether Image Stabilization is requested.

    Declaration
    public virtual bool imageStabilizationRequested { get; set; }
    Property Value
    Type Description
    bool

    true if EIS is requested. Otherwise, false.

    invertCulling

    Get whether culling should be inverted during rendering. Some front-facing camera modes might require this.

    Declaration
    public virtual bool invertCulling { get; }
    Property Value
    Type Description
    bool

    true if culling should be inverted during rendering. Otherwise, false.

    permissionGranted

    Get whether camera permission has been granted.

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

    true if camera permission has been granted. Otherwise, false.

    requestedBackgroundRenderingMode

    Get or set the requested XRCameraBackgroundRenderingMode.

    Declaration
    public virtual XRSupportedCameraBackgroundRenderingMode requestedBackgroundRenderingMode { get; set; }
    Property Value
    Type Description
    XRSupportedCameraBackgroundRenderingMode

    The requested background rendering mode.

    requestedCamera

    Get or set the requested camera facing direction, that is, the AnyCamera bits.

    Declaration
    public virtual Feature requestedCamera { get; set; }
    Property Value
    Type Description
    Feature

    The requested camera facing direction

    requestedLightEstimation

    Get or set the requested light estimation mode.

    Declaration
    public virtual Feature requestedLightEstimation { get; set; }
    Property Value
    Type Description
    Feature

    The requested light estimation mode.

    supportedBackgroundRenderingMode

    Get the supported XRCameraBackgroundRenderingModes defined as XRSupportedCameraBackgroundRenderingModes.

    Declaration
    public virtual XRSupportedCameraBackgroundRenderingMode supportedBackgroundRenderingMode { get; }
    Property Value
    Type Description
    XRSupportedCameraBackgroundRenderingMode

    The supported background rendering modes.

    Methods

    CreateCameraMaterial(string)

    Create the camera material from the given camera shader name.

    Declaration
    protected Material CreateCameraMaterial(string cameraShaderName)
    Parameters
    Type Name Description
    string cameraShaderName

    The name of the camera shader.

    Returns
    Type Description
    Material

    The created camera material shader.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the shader cannot be found or if a material cannot be created for the shader.

    Destroy()

    Destroy the camera for the subsystem.

    Declaration
    public override void Destroy()
    Overrides
    UnityEngine.SubsystemsImplementation.SubsystemProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem>.Destroy()

    GetConfigurations(XRCameraConfiguration, Allocator)

    Get the supported camera configurations.

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

    A default value used to fill the returned array before copying in real values. This ensures future additions to this struct are backwards compatible.

    Allocator allocator

    The allocation strategy to use for the returned data.

    Returns
    Type Description
    NativeArray<XRCameraConfiguration>

    The supported camera configurations.

    GetMaterialKeywords(out List<string>, out List<string>)

    Get the enabled and disabled shader keywords for the Material.

    Declaration
    [Obsolete("GetMaterialKeywords(out List<string>, out List<string>) has been deprecated in AR Foundation version 6.0. Use GetShaderKeywords() instead.")]
    public virtual void GetMaterialKeywords(out List<string> enabledKeywords, out List<string> disabledKeywords)
    Parameters
    Type Name Description
    List<string> enabledKeywords

    The keywords to enable for the Material.

    List<string> disabledKeywords

    The keywords to disable for the Material.

    GetShaderKeywords()

    Get the enabled and disabled shader keywords for the Material.

    Declaration
    public virtual ShaderKeywords GetShaderKeywords()
    Returns
    Type Description
    ShaderKeywords

    Returns an ShaderKeywords with the enabled and disabled shader keywords for the Material.

    GetTextureDescriptors(XRTextureDescriptor, Allocator)

    Get the XRTextureDescriptors associated with the current XRCameraFrame.

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

    A default value used to fill the returned array before copying in real values. This ensures future additions to this struct are backwards compatible.

    Allocator allocator

    The allocation strategy to use for the returned data..

    Returns
    Type Description
    NativeArray<XRTextureDescriptor>

    The current texture descriptors.

    OnBeforeBackgroundRender(int)

    Method to be implemented by the provider to handle any required platform-specific functionality immediately before rendering the camera background. This method will always be called on the render thread and should only be called by the code responsible for executing background rendering on mobile AR platforms.

    Declaration
    public virtual void OnBeforeBackgroundRender(int id)
    Parameters
    Type Name Description
    int id

    Platform-specific identifier.

    Start()

    Start the camera for the subsystem.

    Declaration
    public override void Start()
    Overrides
    UnityEngine.SubsystemsImplementation.SubsystemProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem>.Start()

    Stop()

    Stop the camera for the subsystem.

    Declaration
    public override void Stop()
    Overrides
    UnityEngine.SubsystemsImplementation.SubsystemProvider<UnityEngine.XR.ARSubsystems.XRCameraSubsystem>.Stop()

    TryAcquireLatestCpuImage(out Cinfo)

    Get the latest native camera image.

    Declaration
    public virtual bool TryAcquireLatestCpuImage(out XRCpuImage.Cinfo cameraImageCinfo)
    Parameters
    Type Name Description
    XRCpuImage.Cinfo cameraImageCinfo

    The metadata required to construct a XRCpuImage.

    Returns
    Type Description
    bool

    true if the camera image is acquired. Otherwise, false.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if the implementation does not support camera image.

    TryGetFrame(XRCameraParams, out XRCameraFrame)

    Get the camera frame for the subsystem.

    Declaration
    public virtual bool TryGetFrame(XRCameraParams cameraParams, out XRCameraFrame cameraFrame)
    Parameters
    Type Name Description
    XRCameraParams cameraParams

    The current Unity Camera parameters.

    XRCameraFrame cameraFrame

    The current camera frame returned by the method.

    Returns
    Type Description
    bool

    true if the method successfully got a frame. Otherwise, false.

    TryGetIntrinsics(out XRCameraIntrinsics)

    Get the camera intrinsics information.

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

    The camera intrinsics information returned from the method.

    Returns
    Type Description
    bool

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

    TryGetRenderingParameters(out XRCameraBackgroundRenderingParams)

    Attempts to get the platform specific rendering parameters for rendering the camera background texture.

    Declaration
    public virtual bool TryGetRenderingParameters(out XRCameraBackgroundRenderingParams cameraBackgroundRenderingParameters)
    Parameters
    Type Name Description
    XRCameraBackgroundRenderingParams cameraBackgroundRenderingParameters

    The platform specific rendering parameters for rendering the camera background texture.

    Returns
    Type Description
    bool

    true if the platform provides specialized rendering parameters. Otherwise, false.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)