docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Struct XRResultStatus

    This struct uses an integer to represent the status of a completed operation.

    Implements
    IEquatable<XRResultStatus>
    IComparable<XRResultStatus>
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: solution.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 value of zero. Otherwise, assigns -1.

    XRResultStatus(int)

    Construct an instance with a given integer value.

    Declaration
    public XRResultStatus(int value)
    Parameters
    Type Name Description
    int value

    The integer value.

    Properties

    value

    Get the integer value of this struct. The integer value has these meanings:

    ValueMeaning
    Less than zeroThe operation failed with an error.
    ZeroThe operation was an unqualified success.
    Greater than zeroThe operation succeeded but additional status information is available.
    Declaration
    public int value { get; }
    Property Value
    Type Description
    int
    Remarks

    Platforms may assign integer values to specific error codes and success codes associated with that platform. Refer to the provider plug-in documentation for your target platform(s) to further understand how to interpret this integer value on each platform.

    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 by their value.

    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:

    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(XRResultStatus)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public bool Equals(XRResultStatus other)
    Parameters
    Type Name Description
    XRResultStatus other

    The other object.

    Returns
    Type Description
    bool

    true if the objects are equal. 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. If value is greater than 0, additional status information may be available. Refer to your provider plug-in documentation for more information about the possible success codes on that platform.

    Declaration
    public bool IsSuccess()
    Returns
    Type Description
    bool

    true if the operation was successful. Otherwise, false.

    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.

    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 XRResultStatus(int)

    Convert from int to XRResultStatus.

    Declaration
    public static implicit operator XRResultStatus(int value)
    Parameters
    Type Name Description
    int value

    The integer value.

    Returns
    Type Description
    XRResultStatus

    The status.

    implicit operator bool(XRResultStatus)

    Convert from XRResultStatus to bool.

    Declaration
    public static implicit operator bool(XRResultStatus status)
    Parameters
    Type Name Description
    XRResultStatus status

    The status.

    Returns
    Type Description
    bool

    true if the operation was successful. Otherwise, false.

    implicit operator int(XRResultStatus)

    Convert from XRResultStatus to int.

    Declaration
    public static implicit operator int(XRResultStatus status)
    Parameters
    Type Name Description
    XRResultStatus status

    The status.

    Returns
    Type Description
    int

    The integer value.

    Implements

    IEquatable<T>
    IComparable<T>
    In This Article
    Back to top
    Copyright © 2024 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)