Struct OpenXRResultStatus
Represents the status of a completed operation as a Unity-provided statusCode and a runtime-provided nativeStatusCode.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.NativeTypes
Assembly: Unity.XR.OpenXR.dll
Syntax
public readonly struct OpenXRResultStatus : IEquatable<OpenXRResultStatus>, IComparable<OpenXRResultStatus>, IEquatable<XrResult>
Constructors
OpenXRResultStatus(StatusCode)
Construct an instance with the given status code.
Declaration
public OpenXRResultStatus(OpenXRResultStatus.StatusCode statusCode)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus.StatusCode | statusCode | The Unity-provided status code. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if |
OpenXRResultStatus(StatusCode, XrResult)
Construct an instance with the given status code and native status code.
Declaration
public OpenXRResultStatus(OpenXRResultStatus.StatusCode statusCode, XrResult nativeStatusCode)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus.StatusCode | statusCode | The status code. |
| XrResult | nativeStatusCode | The native status code. |
OpenXRResultStatus(XrResult)
Construct an instance from an XrResult.
Declaration
public OpenXRResultStatus(XrResult nativeStatusCode)
Parameters
| Type | Name | Description |
|---|---|---|
| XrResult | nativeStatusCode | The |
Properties
nativeStatusCode
The runtime-provided status code, if statusCode is PlatformQualifiedSuccess or PlatformError.
Declaration
public XrResult nativeStatusCode { get; }
Property Value
| Type | Description |
|---|---|
| XrResult | The native status code. |
statusCode
The Unity-provided status code.
Declaration
public OpenXRResultStatus.StatusCode statusCode { get; }
Property Value
| Type | Description |
|---|---|
| OpenXRResultStatus.StatusCode | The status code. |
Remarks
If this value is PlatformQualifiedSuccess or PlatformError, read the nativeStatusCode for more detailed information.
unqualifiedSuccess
Get a default-initialized successful instance, convenient for testing.
Declaration
public static OpenXRResultStatus unqualifiedSuccess { get; }
Property Value
| Type | Description |
|---|---|
| OpenXRResultStatus |
Methods
CompareTo(OpenXRResultStatus)
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.
OpenXRResultStatus objects are sorted first by their nativeStatusCode, then by their
statusCode.
Declaration
public int CompareTo(OpenXRResultStatus other)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus | 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(OpenXRResultStatus)
Compares for equality. Two instances are equal if their statusCode and nativeStatusCode are equal.
Declaration
public bool Equals(OpenXRResultStatus other)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus | other | The other instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(XrResult)
Compares for equality with an XrResult.
An OpenXRResultStatus is equal to an XrResult if its nativeStatusCode is equal to the
XrResult, and its statusCode value correctly matches the XrResult value.
For example, an XrResult error value must have a matching statusCode of
PlatformError. Likewise, a qualified success must have a
PlatformQualifiedSuccess status code, and an unqualified success must have
UnqualifiedSuccess to be considered equal to the XrResult.
Declaration
public bool Equals(XrResult other)
Parameters
| Type | Name | Description |
|---|---|---|
| XrResult | other | The |
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 !IsError() or 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 |
|
ToString()
Creates a string suitable for debugging purposes.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The string. |
Overrides
Operators
implicit operator bool(OpenXRResultStatus)
Convert from OpenXRResultStatus to bool using IsSuccess().
Declaration
public static implicit operator bool(OpenXRResultStatus status)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus | status | The |
Returns
| Type | Description |
|---|---|
| bool |
|