docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ArCameraConfig

    Represents an ARCore camera configuration, which describes the ARCore-related properties of a device camera.

    Implements
    IDisposable
    IEquatable<ArCameraConfig>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARCore
    Assembly: Unity.XR.ARCore.dll
    Syntax
    public struct ArCameraConfig : IDisposable, IEquatable<ArCameraConfig>

    Constructors

    ArCameraConfig(ArSession)

    Creates a new instance.

    Important

    You must Dispose() this instance when you no longer need it.

    Declaration
    public ArCameraConfig(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Methods

    AsIntPtr()

    Gets the native pointer for this instance.

    Declaration
    public IntPtr AsIntPtr()
    Returns
    Type Description
    IntPtr

    The native pointer.

    Dispose()

    Destroys this instance and sets its native pointer to null.

    Declaration
    public void Dispose()
    Remarks

    You should only dispose an ArCameraConfig if you explicitly created it, e.g., by calling ArCameraConfig(ArSession). If you convert an existing config from an IntPtr (e.g., by calling FromIntPtr(IntPtr)), then you should not dispose it.

    Equals(object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    An object to compare against.

    Returns
    Type Description
    bool

    true if obj is an ArCameraConfig and it compares equal to this instance using Equals(ArCameraConfig).

    Overrides
    ValueType.Equals(object)

    Equals(ArCameraConfig)

    Tests for equality.

    Declaration
    public bool Equals(ArCameraConfig other)
    Parameters
    Type Name Description
    ArCameraConfig other

    The instance to compare against.

    Returns
    Type Description
    bool

    true if the native pointers are equal. Otherwise, returns false.

    Remarks

    Two instances are considered equal if their native pointers are equal.

    FromIntPtr(IntPtr)

    Creates a ArCameraConfig from a native pointer. The native pointer must point to an existing ArCameraConfig.

    Declaration
    public static ArCameraConfig FromIntPtr(IntPtr value)
    Parameters
    Type Name Description
    IntPtr value

    A pointer to an existing native ArCameraConfig.

    Returns
    Type Description
    ArCameraConfig

    An instance whose native pointer is value.

    GetCameraId(ArSession)

    Gets the camera ID for this instance.

    Declaration
    public string GetCameraId(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    string

    The camera ID for this instance.

    GetDepthSensorUsage(ArSession)

    Gets the depth sensor usage settings.

    Declaration
    public ArCameraConfigDepthSensorUsage GetDepthSensorUsage(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    ArCameraConfigDepthSensorUsage

    The depth sensor usage settings.

    GetFacingDirection(ArSession)

    Gets the facing direction of the camera selected by this config.

    Declaration
    public ArCameraConfigFacingDirection GetFacingDirection(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    ArCameraConfigFacingDirection

    The facing direction.

    GetFpsRange(ArSession)

    Gets the minimum and maximum camera capture rate in frames per second (fps) for the current camera config.

    Declaration
    public (int minFps, int maxFps) GetFpsRange(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    (int minFps, int maxFps)

    The minimum and maximum camera capture rate in frames per second supported by this camera config.

    Remarks

    Actual capture frame rate will vary within this range, depending on lighting conditions. Frame rates will generally be lower under poor lighting conditions to accommodate longer exposure times.

    GetHashCode()

    Generates a hash code suitable for use with a HashSet or Dictionary

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for this instance.

    Overrides
    ValueType.GetHashCode()

    GetImageDimensions(ArSession)

    Gets the camera image dimensions for this camera config.

    Declaration
    public (int width, int height) GetImageDimensions(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    (int minFps, int maxFps)

    Returns the camera image dimensions for this camera config.

    GetTextureDimensions(ArSession)

    Gets the camera texture dimensions for this camera config.

    Declaration
    public (int width, int height) GetTextureDimensions(ArSession session)
    Parameters
    Type Name Description
    ArSession session

    The ARCore session.

    Returns
    Type Description
    (int minFps, int maxFps)

    Returns the camera texture dimensions for this camera config.

    Operators

    operator ==(ArCameraConfig?, ArCameraConfig?)

    Tests for equality.

    Declaration
    public static bool operator ==(ArCameraConfig? lhs, ArCameraConfig? rhs)
    Parameters
    Type Name Description
    ArCameraConfig? lhs

    The nullable ArCameraConfig to compare with rhs.

    ArCameraConfig? rhs

    The nullable ArCameraConfig to compare with lhs.

    Returns
    Type Description
    bool

    true if any of these conditions are met: - lhs and rhs are both not null and their underlying pointers are equal. - lhs is null and rhs's underlying pointer is null. - rhs is null and lhs's underlying pointer is null. - Both lhs and rhs are null.

     Otherwise, returns <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
    
    Remarks

    This equality operator lets you compare an instance with null to determine whether its native pointer is null.

    Examples
    bool TestForNull(ArCameraConfig obj)
    {
        if (obj == null)
        {
            // obj.AsIntPtr() is IntPtr.Zero
        }
    }

    operator ==(ArCameraConfig, ArCameraConfig)

    Tests for equality. Equivalent to Equals(ArCameraConfig).

    Declaration
    public static bool operator ==(ArCameraConfig lhs, ArCameraConfig rhs)
    Parameters
    Type Name Description
    ArCameraConfig lhs

    The instance to compare with rhs.

    ArCameraConfig rhs

    The instance to compare with lhs.

    Returns
    Type Description
    bool

    true if lhs is equal to rhs using Equals(ArCameraConfig). Otherwise, returns false.

    explicit operator IntPtr(ArCameraConfig)

    Casts an instance to its native pointer.

    Declaration
    public static explicit operator IntPtr(ArCameraConfig cameraConfig)
    Parameters
    Type Name Description
    ArCameraConfig cameraConfig

    The instance to cast.

    Returns
    Type Description
    IntPtr

    The native pointer.

    operator !=(ArCameraConfig?, ArCameraConfig?)

    Tests for inequality.

    Declaration
    public static bool operator !=(ArCameraConfig? lhs, ArCameraConfig? rhs)
    Parameters
    Type Name Description
    ArCameraConfig? lhs

    The nullable ArCameraConfig to compare with rhs.

    ArCameraConfig? rhs

    The nullable ArCameraConfig to compare with lhs.

    Returns
    Type Description
    bool

    false if any of these conditions are met: - lhs and rhs are both not null and their native pointers are equal. - lhs is null and rhs's native pointer is null. - rhs is null and lhs's native pointer is null. - Both lhs and rhs are null.

     Otherwise, returns <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.
    
    Remarks

    This inequality operator lets you compare an instance with null to determine whether its native pointer is null.

    Examples
    bool TestForNull(ArCameraConfig obj)
    {
        if (obj != null)
        {
            // obj.AsIntPtr() is not IntPtr.Zero
        }
    }

    operator !=(ArCameraConfig, ArCameraConfig)

    Tests for inequality. Equivalent to the negation of Equals(ArCameraConfig).

    Declaration
    public static bool operator !=(ArCameraConfig lhs, ArCameraConfig rhs)
    Parameters
    Type Name Description
    ArCameraConfig lhs

    The instance to compare with rhs.

    ArCameraConfig rhs

    The instance to compare with lhs.

    Returns
    Type Description
    bool

    false if lhs is equal to rhs using Equals(ArCameraConfig). Otherwise, returns true.

    Implements

    IDisposable
    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2025 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)