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 camera config object. To prevent memory leaks, this object should be disposed with Dispose() when you no longer need it.

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

    The ARCore session.

    Methods

    AsIntPtr()

    Gets the underlying native pointer for this ArCameraConfig.

    Declaration
    public IntPtr AsIntPtr()
    Returns
    Type Description
    IntPtr

    Returns the underlying native pointer for this ArCameraConfig.

    Dispose()

    Destroys this ArCameraConfig and sets its underlying 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

    Returns true if obj is an ArCameraConfig and it compares equal to this one 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 ArCameraConfig to compare against.

    Returns
    Type Description
    bool

    Returns true if the underlying native pointers are the same. Returns false otherwise.

    Remarks

    Two ArCameraConfigs are considered equal if their underlying pointers are equal.

    FromIntPtr(IntPtr)

    Creates a ArCameraConfig from an existing 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

    Returns an ArCameraConfig whose underlying native pointer is value.

    GetCameraId(ArSession)

    Obtains the camera id for this camera config.

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

    The ARCore session.

    Returns
    Type Description
    string

    Returns the camera id for this camera config.

    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

    Returns 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

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

    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)

    Returns 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

    Returns a hash code for this ArCameraConfig.

    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

    Returns 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.

     Returns false otherwise.
    
    Remarks

    This equality operator lets you to compare an ArCameraConfig with null to determine whether its underlying pointer is null. This allows for a more natural comparison with the native ARCore object:

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

    operator ==(ArCameraConfig, ArCameraConfig)

    Tests for equality. Same as Equals(ArCameraConfig).

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

    The ArCameraConfig to compare with rhs.

    ArCameraConfig rhs

    The ArCameraConfig to compare with lhs.

    Returns
    Type Description
    bool

    Returns true if lhs is equal to rhs using Equals(ArCameraConfig). Returns false otherwise.

    explicit operator IntPtr(ArCameraConfig)

    Casts an ArCameraConfig to its underlying native pointer.

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

    The ArCameraConfig to cast.

    Returns
    Type Description
    IntPtr

    Returns the underlying native pointer for cameraConfig

    operator !=(ArCameraConfig?, ArCameraConfig?)

    Tests for inequality.

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

    The native object to compare with rhs.

    ArCameraConfig? rhs

    The native object to compare with lhs.

    Returns
    Type Description
    bool

    Returns false 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.

     Returns true otherwise.
    
    Remarks

    This inequality operator lets you to compare an ArCameraConfig with null to determine whether its underlying pointer is null. This allows for a more natural comparison with the native ARCore object:

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

    operator !=(ArCameraConfig, ArCameraConfig)

    Tests for inequality. Same as the negation of Equals(ArCameraConfig).

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

    The ArCameraConfig to compare with rhs.

    ArCameraConfig rhs

    The ArCameraConfig to compare with lhs.

    Returns
    Type Description
    bool

    Returns false if lhs is equal to rhs using Equals(ArCameraConfig). Returns true otherwise.

    Implements

    IDisposable
    IEquatable<T>
    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)