docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MetaOpenXRAnchorManagerExtensions

    OpenXR Meta extension methods for the ARAnchorManager.

    Important

    These extension methods require that you enable the Meta Quest: Anchors feature in Project Settings > XR Plug-in Management > OpenXR > OpenXR Feature Groups.

    Inheritance
    object
    MetaOpenXRAnchorManagerExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.OpenXR.Features.Meta
    Assembly: Unity.XR.MetaOpenXR.dll
    Syntax
    public static class MetaOpenXRAnchorManagerExtensions

    Methods

    TryLoadAllSharedAnchorsAsync(ARAnchorManager, List<XRAnchor>, Action<ReadOnlyListSpan<XRAnchor>>)

    Attempts to load all anchors that were shared with the sharedAnchorsGroupId.

    Important

    This method requires that you enable the Meta Quest: Anchors feature in Project Settings > XR Plug-in Management > OpenXR > OpenXR Feature Groups and it's running.

    Declaration
    public static Awaitable<XRResultStatus> TryLoadAllSharedAnchorsAsync(this ARAnchorManager anchorManager, List<XRAnchor> outputLoadedAnchors, Action<ReadOnlyListSpan<XRAnchor>> incrementalResultsCallback)
    Parameters
    Type Name Description
    ARAnchorManager anchorManager

    The ARAnchorManager instance.

    List<XRAnchor> outputLoadedAnchors

    The list that will be populated with anchors as the runtime loads them.

    Action<ReadOnlyListSpan<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<XRResultStatus>

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

    Remarks

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

    Exceptions
    Type Condition
    NullReferenceException

    Thrown if the anchorManager is null.

    InvalidOperationException

    Thrown if the ARAnchorManager.subsystem is not a MetaOpenXRAnchorSubsystem.

    ArgumentNullException

    Thrown if outputLoadedAnchors is null.

    See Also
    ARAnchorFeature

    TryShareAnchorAsync(ARAnchorManager, ARAnchor)

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

    Important

    This method requires that you enable the Meta Quest: Anchors feature in Project Settings > XR Plug-in Management > OpenXR > OpenXR Feature Groups and it's running.

    Declaration
    public static Awaitable<XRResultStatus> TryShareAnchorAsync(this ARAnchorManager anchorManager, ARAnchor anchor)
    Parameters
    Type Name Description
    ARAnchorManager anchorManager

    The ARAnchorManager instance.

    ARAnchor anchor

    The anchor you wish to share.

    Returns
    Type Description
    Awaitable<XRResultStatus>

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

    Exceptions
    Type Condition
    NullReferenceException

    Thrown if anchorManager is null.

    InvalidOperationException

    Thrown if the ARAnchorManager.subsystem is not a MetaOpenXRAnchorSubsystem.

    See Also
    ARAnchorFeature

    TryShareAnchorsAsync(ARAnchorManager, IEnumerable<ARAnchor>, List<XRShareAnchorResult>)

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

    Important

    This method requires that you enable the Meta Quest: Anchors feature in Project Settings > XR Plug-in Management > OpenXR > OpenXR Feature Groups and it's running.

    Declaration
    public static Awaitable TryShareAnchorsAsync(this ARAnchorManager anchorManager, IEnumerable<ARAnchor> anchors, List<XRShareAnchorResult> outputShareAnchorResults)
    Parameters
    Type Name Description
    ARAnchorManager anchorManager

    The ARAnchorManager instance.

    IEnumerable<ARAnchor> anchors

    The anchors you wish to share.

    List<XRShareAnchorResult> outputShareAnchorResults

    The output list that will be cleared and populated with results.

    Returns
    Type Description
    Awaitable

    The async operation. You are responsible to await this Awaitable before you read the results.

    Exceptions
    Type Condition
    NullReferenceException

    Thrown if the anchorManager is null.

    InvalidOperationException

    Thrown if the ARAnchorManager.subsystem is not a MetaOpenXRAnchorSubsystem.

    ArgumentNullException

    Thrown if anchors is null or outputShareAnchorResults is null.

    NullReferenceException

    Thrown if an anchor passed in to share is null.

    See Also
    ARAnchorFeature

    See Also

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