Struct XRResultStatus
Represents the status of a completed operation as a cross-platform statusCode and a platform-specific nativeStatusCode.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public readonly struct XRResultStatus : IEquatable<XRResultStatus>, IComparable<XRResultStatus>
Constructors
XRResultStatus(bool)
Construct an instance from a boolean value.
Declaration
public XRResultStatus(bool wasSuccessful)
Parameters
Type | Name | Description |
---|---|---|
bool | wasSuccessful | If true, assigns a statusCode of UnqualifiedSuccess. Otherwise, assigns UnknownError |
XRResultStatus(int)
Construct an instance with a given native status code.
This constructor assumes that the integer value of the status code follows OpenXR conventions:
Value | Meaning |
---|---|
Less than zero | The operation failed with an error, and additional status information is available. statusCode will be assigned the value PlatformError. |
Zero | The operation was an unqualified success. statusCode will be assigned the value UnqualifiedSuccess. |
Greater than zero | The operation succeeded, and additional status information is available. statusCode will be assigned the value PlatformQualifiedSuccess. |
If your platform's native status code does not follow these conventions, use the XRResultStatus(StatusCode, int) constructor instead.
Declaration
public XRResultStatus(int nativeStatusCode)
Parameters
Type | Name | Description |
---|---|---|
int | nativeStatusCode | The integer value. |
XRResultStatus(StatusCode)
Construct an instance with a given status code. This constructor assumes that there is no platform-specific status information.
Declaration
public XRResultStatus(XRResultStatus.StatusCode statusCode)
Parameters
Type | Name | Description |
---|---|---|
XRResultStatus.StatusCode | statusCode | The platform-agnostic status code. |
XRResultStatus(StatusCode, int)
Construct an instance with a given status code and native status code.
Declaration
public XRResultStatus(XRResultStatus.StatusCode statusCode, int nativeStatusCode)
Parameters
Type | Name | Description |
---|---|---|
XRResultStatus.StatusCode | statusCode | The status code. |
int | nativeStatusCode | The native status code. |
Properties
nativeStatusCode
The platform-specific status code.
If statusCode is PlatformQualifiedSuccess or PlatformError, this property contains platform-specific status information that you can use to help debug issues on that platform. Refer to the provider plug-in documentation for your target platform(s) to further understand how to interpret this integer value.
Declaration
public int nativeStatusCode { get; }
Property Value
Type | Description |
---|---|
int |
statusCode
The cross-platform status code.
Declaration
public XRResultStatus.StatusCode statusCode { get; }
Property Value
Type | Description |
---|---|
XRResultStatus.StatusCode | The status code. |
Methods
CompareTo(XRResultStatus)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
XRResultStatus
objects are sorted first by their nativeStatusCode, then by their
statusCode.
Declaration
public int CompareTo(XRResultStatus other)
Parameters
Type | Name | Description |
---|---|---|
XRResultStatus | other | An object to compare with this instance. |
Returns
Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
int | A value that indicates the relative order of the objects being compared. The return value has these meanings:
|
Equals(XRResultStatus)
Indicates whether the current object is equal to another object of the same type. Equality is compared using both statusCode and nativeStatusCode.
Declaration
public bool Equals(XRResultStatus other)
Parameters
Type | Name | Description |
---|---|---|
XRResultStatus | other | The other object. |
Returns
Type | Description |
---|---|
bool |
IsError()
Indicates whether the operation failed with an error.
Declaration
public bool IsError()
Returns
Type | Description |
---|---|
bool |
Remarks
Equivalent to !IsSuccess()
.
IsSuccess()
Indicates whether the operation was successful, inclusive of all success codes and UnqualifiedSuccess.
Declaration
public bool IsSuccess()
Returns
Type | Description |
---|---|
bool |
Remarks
Equivalent to both !IsError()
and implicitly converting this instance to bool.
IsUnqualifiedSuccess()
Indicates whether the operation was an unqualified success. In other words, returns true if the operation succeeded and no additional status information is available.
Declaration
public bool IsUnqualifiedSuccess()
Returns
Type | Description |
---|---|
bool | true if the operation was an unqualified success. Otherwise, false. |
Operators
implicit operator XRResultStatus(bool)
Convert from bool to XRResultStatus
using the XRResultStatus(bool) constructor.
Declaration
public static implicit operator XRResultStatus(bool wasSuccessful)
Parameters
Type | Name | Description |
---|---|---|
bool | wasSuccessful | Whether the operation was successful. |
Returns
Type | Description |
---|---|
XRResultStatus | The status. |
implicit operator bool(XRResultStatus)
Convert from XRResultStatus
to bool using IsSuccess().
Declaration
public static implicit operator bool(XRResultStatus status)
Parameters
Type | Name | Description |
---|---|---|
XRResultStatus | status | The status. |
Returns
Type | Description |
---|---|
bool |