docs.unity3d.com
    Show / Hide Table of Contents

    Class XRAnchorSubsystem

    Base class for a anchor subsystem.

    Inheritance
    Object
    Subsystem
    Subsystem<XRAnchorSubsystemDescriptor>
    XRSubsystem<XRAnchorSubsystemDescriptor>
    TrackingSubsystem<XRAnchor, XRAnchorSubsystemDescriptor>
    XRAnchorSubsystem
    XRAnchorSubsystemImpl
    Inherited Members
    TrackingSubsystem<XRAnchor, XRAnchorSubsystemDescriptor>.GetChanges(Allocator)
    XRSubsystem<XRAnchorSubsystemDescriptor>.running
    XRSubsystem<XRAnchorSubsystemDescriptor>.OnDestroy()
    XRSubsystem<XRAnchorSubsystemDescriptor>.Start()
    XRSubsystem<XRAnchorSubsystemDescriptor>.Stop()
    Subsystem<XRAnchorSubsystemDescriptor>.SubsystemDescriptor
    Subsystem.Destroy()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public abstract class XRAnchorSubsystem : TrackingSubsystem<XRAnchor, XRAnchorSubsystemDescriptor>, ISubsystem
    Remarks

    An anchor is a pose in the physical environment that is tracked by an XR device. As the device refines its understanding of the environment, anchors will be updated, allowing developers to keep virtual content connected to a real-world position and orientation.

    This abstract class should be implemented by an XR provider and instantiated using the SubsystemManager to enumerate the available XRAnchorSubsystemDescriptors.

    Constructors

    XRAnchorSubsystem()

    Constructor. Do not invoke directly; use the SubsystemManager to enumerate the available XRAnchorSubsystemDescriptors and call Create on the desired descriptor.

    Declaration
    public XRAnchorSubsystem()

    Properties

    provider

    The provider created by the implementation that contains the required anchor functionality.

    Declaration
    protected XRAnchorSubsystem.Provider provider { get; }
    Property Value
    Type Description
    XRAnchorSubsystem.Provider

    Methods

    CreateProvider()

    Should return an instance of XRAnchorSubsystem.Provider.

    Declaration
    protected abstract XRAnchorSubsystem.Provider CreateProvider()
    Returns
    Type Description
    XRAnchorSubsystem.Provider

    The interface to the implementation-specific provider.

    GetChanges(Allocator)

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

    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 GetChanges(Allocator).

    Overrides
    UnityEngine.XR.ARSubsystems.TrackingSubsystem<UnityEngine.XR.ARSubsystems.XRAnchor, UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor>.GetChanges(Unity.Collections.Allocator)

    OnDestroyed()

    Destroys the subsystem.

    Declaration
    protected sealed override void OnDestroyed()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor>.OnDestroyed()

    OnStart()

    Starts the subsystem.

    Declaration
    protected sealed override void OnStart()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor>.OnStart()

    OnStop()

    Stops the subsystem.

    Declaration
    protected sealed override void OnStop()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor>.OnStop()

    TryAddAnchor(Pose, out XRAnchor)

    Attempts to create a new anchor with the provide 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
    Boolean

    true if the new 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
    Boolean

    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
    Boolean

    true if the anchor was removed, otherwise false.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023