Struct ArConfig
Represents the configuration for an ArSession.
Inherited Members
Namespace: UnityEngine.XR.ARCore
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 should destroy it by calling Dispose(). If you do not dispose it, ARCore will leak memory.
Properties
IsNull
(Read Only) Indicates whether this ArConfig is null
.
This property is deprecated. Use the equality operator (==
) to compare with null
instead.
Declaration
[Obsolete("Compare to null instead.")]
public readonly bool IsNull { get; }
Property Value
Type | Description |
---|---|
Boolean |
Null
Represents a null ArConfig, i.e., one whose underlying native pointer is null
.
This property is deprecated. Use langword_csharp_default instead.
Declaration
[Obsolete("Use default instead.")]
public static readonly ArConfig Null { get; }
Property Value
Type | Description |
---|---|
ArConfig |
Methods
AsIntPtr()
Gets the underlying native pointer for this ArConfig.
Declaration
public IntPtr AsIntPtr()
Returns
Type | Description |
---|---|
IntPtr | Returns the underlying native pointer for this ArConfig. |
Dispose()
Destroys this ArConfig and sets the underlying native pointer to null
.
Declaration
public void Dispose()
Implements
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.
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 |
---|---|
Boolean | Returns |
Overrides
Equals(ArConfig)
Tests for equality.
Declaration
public bool Equals(ArConfig other)
Parameters
Type | Name | Description |
---|---|---|
ArConfig | other | The ArConfig to compare against. |
Returns
Type | Description |
---|---|
Boolean | Returns |
Implements
Remarks
Two ArConfigs are considered equal if their underlying pointers are equal.
FromIntPtr(IntPtr)
Creates an ArConfig from an existing 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 | Returns an ArConfig whose underlying native pointer is
|
GetHashCode()
Generates a hash code suitable for use with a HashSet
or Dictionary
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Returns a hash code for this ArConfig. |
Overrides
Operators
Equality(Nullable<ArConfig>, Nullable<ArConfig>)
Tests for equality.
Declaration
public static bool operator ==(ArConfig? lhs, ArConfig? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<ArConfig> | lhs | The nullable ArConfig to compare with |
Nullable<ArConfig> | rhs | The nullable ArConfig to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns true if any of these conditions are met:
Returns false otherwise. |
Remarks
This equality operator lets you to compare an ArConfig with null
to determine whether its
underlying pointer is null. This allows for a more natural comparison with the native ARCore object:
bool TestForNull(ArConfig obj)
{
if (obj == null)
{
// obj.AsIntPtr() is IntPtr.Zero
}
}
Equality(ArConfig, ArConfig)
Tests for equality. Same as Equals(ArConfig).
Declaration
public static bool operator ==(ArConfig lhs, ArConfig rhs)
Parameters
Type | Name | Description |
---|---|---|
ArConfig | lhs | The ArConfig to compare with |
ArConfig | rhs | The ArConfig to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |
Explicit(ArConfig to IntPtr)
Casts an ArConfig to its underlying native pointer.
Declaration
public static explicit operator IntPtr(ArConfig config)
Parameters
Type | Name | Description |
---|---|---|
ArConfig | config | The ArConfig to cast. |
Returns
Type | Description |
---|---|
IntPtr | Returns the underlying native pointer for |
Inequality(Nullable<ArConfig>, Nullable<ArConfig>)
Tests for inequality.
Declaration
public static bool operator !=(ArConfig? lhs, ArConfig? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<ArConfig> | lhs | The native object to compare with |
Nullable<ArConfig> | rhs | The native object to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns false if any of these conditions are met:
Returns true otherwise. |
Remarks
This inequality operator lets you to compare an ArConfig with null
to determine whether its
underlying pointer is null. This allows for a more natural comparison with the native ARCore object:
bool TestForNull(ArConfig obj)
{
if (obj != null)
{
// obj.AsIntPtr() is not IntPtr.Zero
}
}
Inequality(ArConfig, ArConfig)
Tests for inequality. Same as the negation of Equals(ArConfig).
Declaration
public static bool operator !=(ArConfig lhs, ArConfig rhs)
Parameters
Type | Name | Description |
---|---|---|
ArConfig | lhs | The ArConfig to compare with |
ArConfig | rhs | The ArConfig to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |