docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XRAnchor

    Describes session-relative data for an anchor.

    Implements
    ITrackable
    IEquatable<XRAnchor>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public struct XRAnchor : ITrackable, IEquatable<XRAnchor>

    Constructors

    XRAnchor(TrackableId, Pose, TrackingState, IntPtr)

    Construct an instance.

    Declaration
    public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr)
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable ID.

    Pose pose

    The pose in session space.

    TrackingState trackingState

    The tracking state.

    IntPtr nativePtr

    The native pointer.

    See Also
    XRAnchorSubsystem

    XRAnchor(TrackableId, Pose, TrackingState, IntPtr, Guid)

    Construct an instance.

    Declaration
    public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, Guid sessionId)
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable ID.

    Pose pose

    The pose in session space.

    TrackingState trackingState

    The tracking state.

    IntPtr nativePtr

    The native pointer.

    Guid sessionId

    The ID of the session from which this anchor originated.

    See Also
    XRAnchorSubsystem

    XRAnchor(TrackableId, Pose, TrackingState, IntPtr, Guid, TrackableId)

    Construct an instance.

    Declaration
    public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, Guid sessionId, TrackableId parentId)
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable ID.

    Pose pose

    The pose in session space.

    TrackingState trackingState

    The tracking state.

    IntPtr nativePtr

    The native pointer.

    Guid sessionId

    The ID of the session from which this anchor originated.

    TrackableId parentId

    The trackable ID of the parent trackable.

    See Also
    XRAnchorSubsystem

    XRAnchor(TrackableId, Pose, TrackingState, IntPtr, TrackableId)

    Construct an instance.

    Declaration
    public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, TrackableId parentId)
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable ID.

    Pose pose

    The pose in session space.

    TrackingState trackingState

    The tracking state.

    IntPtr nativePtr

    The native pointer.

    TrackableId parentId

    The trackable ID of the parent trackable.

    See Also
    XRAnchorSubsystem

    Properties

    defaultValue

    Get a default-initialized XRAnchor, which is distinct from C# default as Pose.identity is not equal to 0.

    Declaration
    public static XRAnchor defaultValue { get; }
    Property Value
    Type Description
    XRAnchor
    See Also
    XRAnchorSubsystem

    nativePtr

    Get this anchor's native pointer. The data pointed to by this pointer is implementation-specific.

    Declaration
    public IntPtr nativePtr { get; }
    Property Value
    Type Description
    IntPtr
    See Also
    XRAnchorSubsystem

    parentId

    Get the trackable ID of this anchor's parent trackable.

    Declaration
    public TrackableId parentId { get; }
    Property Value
    Type Description
    TrackableId
    See Also
    XRAnchorSubsystem

    pose

    Get this anchor's pose in session space.

    Declaration
    public Pose pose { get; }
    Property Value
    Type Description
    Pose
    See Also
    XRAnchorSubsystem

    sessionId

    Get the ID of the session from which this anchor originated.

    Declaration
    public Guid sessionId { get; }
    Property Value
    Type Description
    Guid
    See Also
    XRAnchorSubsystem

    trackableId

    Get this anchor's trackable ID.

    Declaration
    public TrackableId trackableId { get; }
    Property Value
    Type Description
    TrackableId
    See Also
    XRAnchorSubsystem

    trackingState

    Get this anchor's tracking state.

    Declaration
    public TrackingState trackingState { get; }
    Property Value
    Type Description
    TrackingState
    See Also
    XRAnchorSubsystem

    Methods

    Equals(object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare against.

    Returns
    Type Description
    bool

    true if obj is of type XRAnchor and Equals(XRAnchor) also returns true. Otherwise, false.

    Overrides
    ValueType.Equals(object)
    See Also
    XRAnchorSubsystem

    Equals(XRAnchor)

    Tests for equality.

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

    The other XRAnchor to compare against.

    Returns
    Type Description
    bool

    true if every field in other is equal to this XRAnchor. Otherwise, false.

    See Also
    XRAnchorSubsystem

    GetHashCode()

    Generates a hash suitable for use with containers like HashSet and Dictionary.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code generated from this object's fields.

    Overrides
    ValueType.GetHashCode()
    See Also
    XRAnchorSubsystem

    Operators

    operator ==(XRAnchor, XRAnchor)

    Tests for equality. Equivalent to Equals(XRAnchor).

    Declaration
    public static bool operator ==(XRAnchor lhs, XRAnchor rhs)
    Parameters
    Type Name Description
    XRAnchor lhs

    The left-hand side of the comparison.

    XRAnchor rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    true if lhs is equal to rhs. Otherwise, false.

    See Also
    XRAnchorSubsystem

    operator !=(XRAnchor, XRAnchor)

    Tests for inequality. Equivalent to !Equals(XRAnchor).

    Declaration
    public static bool operator !=(XRAnchor lhs, XRAnchor rhs)
    Parameters
    Type Name Description
    XRAnchor lhs

    The left-hand side of the comparison.

    XRAnchor rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    true if lhs is not equal to rhs. Otherwise, false.

    See Also
    XRAnchorSubsystem

    Implements

    ITrackable
    IEquatable<T>

    See Also

    XRAnchorSubsystem
    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)