docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRAnchorSubsystem

    This subsystem provides information regarding anchors. An anchor is a pose (position and rotation) in the physical environment that is tracked by an XR device. Anchors are updated as the device refines its understanding of the environment, allowing you to reliably place virtual content at a real-world pose.

    Inheritance
    object
    SubsystemWithProvider
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>
    TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>
    XRAnchorSubsystem
    SimulationAnchorSubsystem
    Implements
    ISubsystem
    Inherited Members
    TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.GetChanges(Allocator)
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.OnCreate()
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.OnStart()
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.OnStop()
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.OnDestroy()
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.subsystemDescriptor
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.provider
    SubsystemWithProvider.Start()
    SubsystemWithProvider.OnStart()
    SubsystemWithProvider.Stop()
    SubsystemWithProvider.OnStop()
    SubsystemWithProvider.Destroy()
    SubsystemWithProvider.OnDestroy()
    SubsystemWithProvider.running
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public class XRAnchorSubsystem : TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>, ISubsystem
    Remarks

    This is a base class with an abstract provider type to be implemented by provider plug-in packages. This class itself does not implement anchor tracking.

    Constructors

    XRAnchorSubsystem()

    Do not invoke this constructor directly.

    Declaration
    public XRAnchorSubsystem()
    Remarks

    If you are implementing your own custom subsystem Lifecycle management, use the SubsystemManager to enumerate the available XRAnchorSubsystemDescriptors, then call XRAnchorSubsystemDescriptor.Create() on the desired descriptor.

    Methods

    GetChanges(Allocator)

    Get the changes to anchors (added, updated, and removed) since the last call to this method.

    Declaration
    public override TrackableChanges<XRAnchor> GetChanges(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    An allocator to use for the NativeArrays in TrackableChanges<T>.

    Returns
    Type Description
    TrackableChanges<XRAnchor>

    Changes since the last call to this method.

    Overrides
    TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.GetChanges(Allocator)

    TryAddAnchor(Pose, out XRAnchor)

    Attempts to create a new anchor at the provided pose.

    Declaration
    public bool TryAddAnchor(Pose pose, out XRAnchor anchor)
    Parameters
    Type Name Description
    Pose pose

    The pose, in session space, of the new anchor.

    XRAnchor anchor

    The new anchor. Only valid if this method returns true.

    Returns
    Type Description
    bool

    true if the output anchor was added. Otherwise, false.

    TryAttachAnchor(TrackableId, Pose, out XRAnchor)

    Attempts to create a new anchor "attached" to the trackable with id trackableToAffix. The behavior of the anchor depends on the type of trackable to which this anchor is attached.

    Declaration
    public bool TryAttachAnchor(TrackableId trackableToAffix, Pose pose, out XRAnchor anchor)
    Parameters
    Type Name Description
    TrackableId trackableToAffix

    The id of the trackable to which to attach.

    Pose pose

    The pose, in session space, of the anchor to create.

    XRAnchor anchor

    The new anchor. Only valid if this method returns true.

    Returns
    Type Description
    bool

    true if the new anchor was added, otherwise false.

    TryRemoveAnchor(TrackableId)

    Attempts to remove an existing anchor with TrackableId anchorId.

    Declaration
    public bool TryRemoveAnchor(TrackableId anchorId)
    Parameters
    Type Name Description
    TrackableId anchorId

    The id of an existing anchor to remove.

    Returns
    Type Description
    bool

    true if the anchor was removed, otherwise false.

    Implements

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