docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MetaOpenXRAnchorSubsystem

    The Meta-OpenXR implementation of the XRAnchorSubsystem. Do not create this directly. Use the SubsystemManager instead.

    Inheritance
    object
    SubsystemWithProvider
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>
    TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>
    XRAnchorSubsystem
    MetaOpenXRAnchorSubsystem
    Implements
    ISubsystem
    Inherited Members
    XRAnchorSubsystem.GetChanges(Allocator)
    XRAnchorSubsystem.TryAddAnchor(Pose, out XRAnchor)
    XRAnchorSubsystem.TryAddAnchorAsync(Pose)
    XRAnchorSubsystem.TryAttachAnchor(TrackableId, Pose, out XRAnchor)
    XRAnchorSubsystem.TryRemoveAnchor(TrackableId)
    XRAnchorSubsystem.TrySaveAnchorAsync(TrackableId, CancellationToken)
    XRAnchorSubsystem.TrySaveAnchorsAsync(NativeArray<TrackableId>, Allocator, CancellationToken)
    XRAnchorSubsystem.TryLoadAnchorAsync(SerializableGuid, CancellationToken)
    XRAnchorSubsystem.TryLoadAnchorsAsync(NativeArray<SerializableGuid>, Allocator, Action<NativeArray<XRLoadAnchorResult>>, CancellationToken)
    XRAnchorSubsystem.TryEraseAnchorAsync(SerializableGuid, CancellationToken)
    XRAnchorSubsystem.TryEraseAnchorsAsync(NativeArray<SerializableGuid>, Allocator, CancellationToken)
    XRAnchorSubsystem.TryGetSavedAnchorIdsAsync(Allocator, CancellationToken)
    TrackingSubsystem<XRAnchor, XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.GetChanges(Allocator)
    SubsystemWithProvider<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchorSubsystem.Provider>.subsystemDescriptor
    SubsystemWithProvider.Start()
    SubsystemWithProvider.Stop()
    SubsystemWithProvider.Destroy()
    SubsystemWithProvider.running
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.OpenXR.Features.Meta
    Assembly: Unity.XR.MetaOpenXR.dll
    Syntax
    [Preserve]
    public sealed class MetaOpenXRAnchorSubsystem : XRAnchorSubsystem, ISubsystem

    Properties

    isSharedAnchorsSupported

    Get whether shared anchors is supported by the OpenXR runtime.

    Declaration
    public Supported isSharedAnchorsSupported { get; }
    Property Value
    Type Description
    Supported
    • Unknown if the OpenXR instance has not yet been created.
    • Unsupported if shared anchors is not supported.
    • Supported if shared anchors is supported.

    sharedAnchorsGroupId

    The group ID that anchors are shared with and loaded from.

    Declaration
    public SerializableGuid sharedAnchorsGroupId { get; set; }
    Property Value
    Type Description
    SerializableGuid

    Methods

    TryLoadAllSharedAnchorsAsync(Allocator, Action<NativeArray<XRAnchor>>)

    Attempts to load a batch of anchors that were shared with sharedAnchorsGroupId.

    Declaration
    public Awaitable<Result<NativeArray<XRAnchor>>> TryLoadAllSharedAnchorsAsync(Allocator allocator, Action<NativeArray<XRAnchor>> incrementalResultsCallback)
    Parameters
    Type Name Description
    Allocator allocator

    The allocation strategy to use for the resulting NativeArray.

    Action<NativeArray<XRAnchor>> incrementalResultsCallback

    A callback method that will be called when any anchors are loaded. This callback is invoked at least once if any anchors are successfully loaded, and possibly multiple times before the async operation completes. Pass a null argument for this parameter to ignore it.

    Returns
    Type Description
    Awaitable<Result<NativeArray<XRAnchor>>>

    A NativeArray containing the complete set of XRAnchors that were loaded with sharedAnchorsGroupId. You are responsible to await this result.

    Remarks

    If no anchors were shared to the sharedAnchorsGroupId then this method will return 0 anchors and status.IsSuccess() will be true.

    TryShareAnchorAsync(TrackableId)

    Attempts to share an anchor so that it can be loaded by colocated users of your app. Notify colocated users of your app to load shared anchors from the sharedAnchorsGroupId. Once shared, anchors cannot be unshared. Shared anchors remain shared for 30 days until they expire.

    Declaration
    public Awaitable<XRResultStatus> TryShareAnchorAsync(TrackableId anchorId)
    Parameters
    Type Name Description
    TrackableId anchorId

    The TrackableId of the anchor you wish to share.

    Returns
    Type Description
    Awaitable<XRResultStatus>

    The result of the async operation. You are responsible to await this result.

    TryShareAnchorsAsync(NativeArray<TrackableId>, Allocator)

    Attempts to share a batch of anchors so that they can be loaded by colocated users of your app. Notify colocated users of your app to load shared anchors from the sharedAnchorsGroupId. Once shared, anchors cannot be unshared. Shared anchors remain shared for 30 days until they expire.

    Declaration
    public Awaitable<NativeArray<XRShareAnchorResult>> TryShareAnchorsAsync(NativeArray<TrackableId> anchorIds, Allocator allocator)
    Parameters
    Type Name Description
    NativeArray<TrackableId> anchorIds

    The TrackableIds of the anchors you wish to share.

    Allocator allocator

    The allocation strategy to use for the resulting NativeArray.

    Returns
    Type Description
    Awaitable<NativeArray<XRShareAnchorResult>>

    The result of the async operation, containing a NativeArray of XRShareAnchorResults allocated with the given allocator if the operation succeeded. You are responsible to await this result.

    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)