docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct OpenXRResultStatus

    Represents the status of a completed operation as a Unity-provided statusCode and a runtime-provided nativeStatusCode.

    Implements
    IEquatable<OpenXRResultStatus>
    IComparable<OpenXRResultStatus>
    IEquatable<XrResult>
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    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 statusCode is PlatformError or PlatformQualifiedSuccess, as these status codes require a corresponding nativeStatusCode.

    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 XrResult.

    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:

    ValueMeaning
    Less than zeroThe instance precedes other in the sort order.
    ZeroThe instance occurs in the same position in the sort order as other.
    Greater than zeroThis instance follows other in the sort order.

    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

    true if the objects are equal. Otherwise, false.

    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 XrResult value.

    Returns
    Type Description
    bool

    true if this instance is equal to the XrResult value. Otherwise, false.

    IsError()

    Indicates whether the operation failed with an error.

    Declaration
    public bool IsError()
    Returns
    Type Description
    bool

    true if the operation failed with error. Otherwise, false.

    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

    true if the operation was successful. Otherwise, false.

    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

    true if the operation was an unqualified success. Otherwise, false.

    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 OpenXRResultStatus.

    Returns
    Type Description
    bool

    true if the operation was successful. Otherwise, false.

    Implements

    IEquatable<T>
    IComparable<T>
    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)