docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct OpenXRResult<T>

    Represents the result of a completed operation that attempted to create an object of type T.

    Implements
    IEquatable<OpenXRResult<T>>
    IEquatable<Result<T>>
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.OpenXR.Features.SpatialEntities
    Assembly: Unity.XR.SpatialEntities.dll
    Syntax
    public readonly struct OpenXRResult<T> : IEquatable<OpenXRResult<T>>, IEquatable<Result<T>>
    Type Parameters
    Name Description
    T

    The result type.

    Constructors

    OpenXRResult(OpenXRResultStatus, T)

    Construct an instance with a given status and value.

    Declaration
    public OpenXRResult(OpenXRResultStatus status, T value)
    Parameters
    Type Name Description
    OpenXRResultStatus status

    The status.

    T value

    The result value.

    OpenXRResult(T)

    Construct a result containing an unqualified success status code and the given value.

    Declaration
    public OpenXRResult(T value)
    Parameters
    Type Name Description
    T value

    The value.

    Properties

    status

    The status of the completed operation. You should check whether the operation was successful before you access the result value.

    Declaration
    public OpenXRResultStatus status { get; }
    Property Value
    Type Description
    OpenXRResultStatus

    value

    The result value of the completed operation. Only valid if status.IsSuccess() is true.

    Declaration
    public T value { get; }
    Property Value
    Type Description
    T
    Remarks
    Important

    If the operation was unsuccessful, you should not access this value. It may be null or could contain default data.

    Methods

    Equals(Result<T>)

    Compares for equality with a Result.

    Declaration
    public bool Equals(Result<T> other)
    Parameters
    Type Name Description
    Result<T> other

    The Result.

    Returns
    Type Description
    bool

    true if both instances are equal. Otherwise, false.

    Equals(OpenXRResult<T>)

    Compares for equality with another instance.

    Declaration
    public bool Equals(OpenXRResult<T> other)
    Parameters
    Type Name Description
    OpenXRResult<T> other

    The other instance.

    Returns
    Type Description
    bool

    true if both instances are equal. Otherwise, false.

    Operators

    explicit operator OpenXRResult<T>(Result<T>)

    Convert from Result to OpenXRResult.

    Declaration
    public static explicit operator OpenXRResult<T>(Result<T> result)
    Parameters
    Type Name Description
    Result<T> result

    The Result instance.

    Returns
    Type Description
    OpenXRResult<T>

    The output instance.

    implicit operator Result<T>(OpenXRResult<T>)

    Convert from OpenXRResult to Result.

    Declaration
    public static implicit operator Result<T>(OpenXRResult<T> oxrResult)
    Parameters
    Type Name Description
    OpenXRResult<T> oxrResult

    The OpenXRResult instance.

    Returns
    Type Description
    Result<T>

    The output instance.

    Implements

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