Struct ArCameraConfig
Represents an ARCore camera configuration, which describes the ARCore-related properties of a device camera.
Inherited Members
Namespace: UnityEngine.XR.ARCore
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. |
Properties
IsNull
(Read Only) Indicates whether this ArCameraConfig 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 ArCameraConfig, i.e., one whose underlying native pointer is null
.
This property is deprecated. Use default instead.
Declaration
[Obsolete("Use default instead.")]
public static readonly ArCameraConfig Null { get; }
Property Value
Type | Description |
---|---|
ArCameraConfig |
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()
Implements
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 |
---|---|
Boolean | Returns |
Overrides
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 |
---|---|
Boolean | Returns |
Implements
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
|
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 |
---|---|
(T1, T2)<Int32, Int32> | 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 |
---|---|
Int32 | Returns a hash code for this ArCameraConfig. |
Overrides
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 |
---|---|
(T1, T2)<Int32, Int32> | 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 |
---|---|
(T1, T2)<Int32, Int32> | Returns the camera texture dimensions for this camera config. |
Operators
Equality(Nullable<ArCameraConfig>, Nullable<ArCameraConfig>)
Tests for equality.
Declaration
public static bool operator ==(ArCameraConfig? lhs, ArCameraConfig? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<ArCameraConfig> | lhs | The nullable ArCameraConfig to compare with |
Nullable<ArCameraConfig> | rhs | The nullable ArCameraConfig 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 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
}
}
Equality(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 |
ArCameraConfig | rhs | The ArCameraConfig to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |
Explicit(ArCameraConfig to IntPtr)
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 |
Inequality(Nullable<ArCameraConfig>, Nullable<ArCameraConfig>)
Tests for inequality.
Declaration
public static bool operator !=(ArCameraConfig? lhs, ArCameraConfig? rhs)
Parameters
Type | Name | Description |
---|---|---|
Nullable<ArCameraConfig> | lhs | The native object to compare with |
Nullable<ArCameraConfig> | 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 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
}
}
Inequality(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 |
ArCameraConfig | rhs | The ArCameraConfig to compare with |
Returns
Type | Description |
---|---|
Boolean | Returns |