Struct XRResultStatus
Represents the status of a completed operation as a cross-platform status
Inherited Members
Namespace: UnityEngine .XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public 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 status |
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.
status |
Zero |
The operation was an unqualified success.
status |
Greater than zero |
The operation succeeded, and additional status information is available.
status |
If your platform's native status code does not follow these conventions, use the
XRResult
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 |
---|---|---|
XRResult |
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 |
---|---|---|
XRResult |
statusCode | The status code. |
int | nativeStatusCode | The native status code. |
Properties
nativeStatusCode
The platform-specific status code.
If status
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 |
---|---|
XRResult |
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 native
Declaration
public int CompareTo(XRResultStatus other)
Parameters
Type | Name | Description |
---|---|---|
XRResult |
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 status
Declaration
public bool Equals(XRResultStatus other)
Parameters
Type | Name | Description |
---|---|---|
XRResult |
other | The other object. |
Returns
IsError()
Indicates whether the operation failed with an error.
Declaration
public bool IsError()
Returns
Remarks
Equivalent to !IsSuccess()
.
IsSuccess()
Indicates whether the operation was successful, inclusive of all success codes and
Unqualified
Declaration
public bool IsSuccess()
Returns
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
Operators
implicit operator XRResultStatus(bool)
Convert from bool to XRResultStatus
using the XRResult
Declaration
public static implicit operator XRResultStatus(bool wasSuccessful)
Parameters
Type | Name | Description |
---|---|---|
bool | wasSuccessful | Whether the operation was successful. |
Returns
Type | Description |
---|---|
XRResult |
The status. |
implicit operator bool(XRResultStatus)
Convert from XRResultStatus
to bool using Is
Declaration
public static implicit operator bool(XRResultStatus status)
Parameters
Type | Name | Description |
---|---|---|
XRResult |
status | The status. |