Struct ArCameraConfig
Represents an ARCore camera configuration, which describes the ARCore-related properties of a device camera.
Inherited Members
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 |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
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 |
Returns
Type | Description |
---|---|
ArCameraConfig | An instance whose native pointer is |
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
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? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | true if any of these conditions are met:
-
|
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 |
ArCameraConfig | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | true if |
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? | rhs | The nullable |
Returns
Type | Description |
---|---|
bool | false if any of these conditions are met:
-
|
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 |
ArCameraConfig | rhs | The instance to compare with |
Returns
Type | Description |
---|---|
bool | false if |