docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ArConfig

    Represents the configuration for an ArSession.

    Implements
    IEquatable<ArConfig>
    IDisposable
    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 ArConfig : IEquatable<ArConfig>, IDisposable
    Remarks

    This is an opaque object that represents a native ArConfig.

    Constructors

    ArConfig(ArSession)

    Creates a new session configuration and initializes it to a sensible default configuration.

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

    A non-null ArSession.

    Remarks

    Plane detection and Lighting Estimation are enabled, and blocking update is selected. This configuration is guaranteed to be supported on all devices that support ARCore.

    When you no longer need the ArConfig, you must destroy it by calling Dispose(). If you do not dispose it, ARCore will leak memory.

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    Methods

    AsIntPtr()

    Gets the native pointer for this instance.

    Declaration
    public IntPtr AsIntPtr()
    Returns
    Type Description
    IntPtr

    The native pointer.

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    Dispose()

    Destroys this instance and sets its native pointer to null.

    Declaration
    public void Dispose()
    Remarks

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

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    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 ArConfig and it compares equal to this instance using Equals(ArConfig).

    Overrides
    ValueType.Equals(object)
    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    Equals(ArConfig)

    Tests for equality.

    Declaration
    public bool Equals(ArConfig other)
    Parameters
    Type Name Description
    ArConfig 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.

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    FromIntPtr(IntPtr)

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

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

    A pointer to an existing native ArConfig.

    Returns
    Type Description
    ArConfig

    An instance whose native pointer is value.

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

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

    Overrides
    ValueType.GetHashCode()
    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    Operators

    operator ==(ArConfig?, ArConfig?)

    Tests for equality.

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

    The nullable ArConfig to compare with rhs.

    ArConfig? rhs

    The nullable ArConfig 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 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">false</a>.
    
    Remarks

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

    Examples
    bool TestForNull(ArConfig obj)
    {
        if (obj == null)
        {
            // obj.AsIntPtr() is IntPtr.Zero
        }
    }
    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    operator ==(ArConfig, ArConfig)

    Tests for equality. Equivalent to Equals(ArConfig).

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

    The instance to compare with rhs.

    ArConfig rhs

    The instance to compare with lhs.

    Returns
    Type Description
    bool

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

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    explicit operator IntPtr(ArConfig)

    Casts an instance to its native pointer.

    Declaration
    public static explicit operator IntPtr(ArConfig config)
    Parameters
    Type Name Description
    ArConfig config

    The instance to cast.

    Returns
    Type Description
    IntPtr

    The native pointer for config

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    operator !=(ArConfig?, ArConfig?)

    Tests for inequality.

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

    The nullable ArConfig to compare with rhs.

    ArConfig? rhs

    The nullable ArConfig 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 ArConfig with null to determine whether its native pointer is null.

    Examples
    bool TestForNull(ArConfig obj)
    {
        if (obj != null)
        {
            // obj.AsIntPtr() is not IntPtr.Zero
        }
    }
    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    operator !=(ArConfig, ArConfig)

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

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

    The instance to compare with rhs.

    ArConfig rhs

    The instance to compare with lhs.

    Returns
    Type Description
    bool

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

    See Also
    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs

    Implements

    IEquatable<T>
    IDisposable

    See Also

    beforeSetConfiguration
    ARCoreBeforeSetConfigurationEventArgs
    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)