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.
Inherited Members
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 |
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 |
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 |
See Also
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 |
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 |
InvalidOperationException | Thrown if the ARAnchorManager.subsystem is not a MetaOpenXRAnchorSubsystem. |
See Also
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 |
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 |
Exceptions
Type | Condition |
---|---|
NullReferenceException | Thrown if the anchorManager is null. |
InvalidOperationException | Thrown if the ARAnchorManager.subsystem is not a MetaOpenXRAnchorSubsystem. |
ArgumentNullException | Thrown if |
NullReferenceException | Thrown if an anchor passed in to share is null. |