Stay organized with collections
Save and categorize content based on your preferences.
SpatialShareableAnchorSubsystem
The spatial entity implementation of the XRShareableAnchorSubsystem.
Summary
Inheritance
Inherits from:
Google.XR.Extensions.ARSubsystems.XRShareableAnchorSubsystem
Public functions
|
GetChanges(Allocator allocator)
|
|
TryAddAnchor(Pose pose, out XRShareableAnchor anchor)
|
bool
Attempts to create a new anchor at the given pose .
|
TryAttachGeospatialAnchor(XRGeospatialPose geospatialPose)
|
Attempts to create a shareable anchor "attached" to the given geospatial pose.
|
TryAttachSurfaceAnchorAsync(XRGeospatialSurfaceType type, XRGeospatialPose geospatialPose, CancellationToken cancellationToken)
|
Attempts to create a shareable anchor "attached" to the given geospatial pose relative to the location's surface.
|
TryEraseAnchorAsync(SerializableGuid shareableId, XRShareableAnchorHosts host, CancellationToken cancellationToken)
|
Awaitable< XRResultStatus >
Attempts to erase the persistent saved data associated with an anchor given its persistent GUID.
|
TryGetSavedAnchorIdsAsync(XRShareableAnchorHosts host, Allocator allocator, CancellationToken cancellationToken)
|
Awaitable< Result< NativeArray< SerializableGuid > > >
Attempts to get a NativeArray containing all saved persistent GUIDs from the given host.
|
TryLoadAnchorAsync(SerializableGuid shareableId, XRShareableAnchorHosts host, CancellationToken cancellationToken)
|
Attempts to load a shareable anchor given its persistent GUID.
|
TryRemoveAnchor(TrackableId anchorId)
|
bool
Attempts to remove an existing anchor with anchorId .
|
TrySaveAnchorAsync(TrackableId anchorId, XRShareableAnchorHosts host, CancellationToken cancellationToken)
|
Awaitable< Result< SerializableGuid > >
Attempts to persistently save the given anchor so that it can be loaded in a future session.
|
Public functions
GetChanges
override TrackableChanges< XRShareableAnchor > GetChanges(
Allocator allocator
)
TryAddAnchor
bool TryAddAnchor(
Pose pose,
out XRShareableAnchor anchor
)
Attempts to create a new anchor at the given pose .
| Details |
| Parameters |
pose
|
The pose, in Unity world space, of the new anchor.
|
anchor
|
|
|
|
Returns
|
true if the new anchor was added. Otherwise, false.
|
TryEraseAnchorAsync
Awaitable< XRResultStatus > TryEraseAnchorAsync(
SerializableGuid shareableId,
XRShareableAnchorHosts host,
CancellationToken cancellationToken
)
Attempts to erase the persistent saved data associated with an anchor given its persistent GUID.
See also:
XRShareableAnchorSubsystemDescriptor.supportsEraseAnchor
| Details |
| Parameters |
shareableId
|
|
host
|
The target host to erase this persistent id.
|
cancellationToken
|
|
|
|
Returns
|
The result of the async operation. You are responsible to await this result.
|
TryGetSavedAnchorIdsAsync
Awaitable< Result< NativeArray< SerializableGuid > > > TryGetSavedAnchorIdsAsync(
XRShareableAnchorHosts host,
Allocator allocator,
CancellationToken cancellationToken
)
Attempts to get a NativeArray containing all saved persistent GUIDs from the given host.
See also:
XRShareableAnchorSubsystemDescriptor.supportsGetSavedAnchorIds
| Details |
| Parameters |
host
|
The host to retrieve all saved anchors.
|
allocator
|
The allocation strategy to use for the resulting NativeArray.
|
cancellationToken
|
|
|
|
Returns
|
The result of the async operation, containing a NativeArray of persistent GUIDs allocated with the given allocator if the operation succeeded. You are responsible to await this result.
|
TryLoadAnchorAsync
Awaitable< Result< XRShareableAnchor > > TryLoadAnchorAsync(
SerializableGuid shareableId,
XRShareableAnchorHosts host,
CancellationToken cancellationToken
)
Attempts to load a shareable anchor given its persistent GUID.
See also:
XRShareableAnchorSubsystemDescriptor.supportsLoadAnchor
| Details |
| Parameters |
shareableId
|
|
host
|
The target host to load this persistent id.
|
cancellationToken
|
|
|
|
Returns
|
The result of the async operation, containing the newly added shareable anchor if the operation succeeded. You are responsible to await this result.
|
TryRemoveAnchor
bool TryRemoveAnchor(
TrackableId anchorId
)
Attempts to remove an existing anchor with anchorId .
If it has been saved by TrySaveAnchorAsync, the persistent data is not affected.
| Details |
| Parameters |
anchorId
|
The TrackableId of an existing anchor to remove.
|
|
|
Returns
|
true if the anchor was removed. Otherwise, false.
|
TrySaveAnchorAsync
Awaitable< Result< SerializableGuid > > TrySaveAnchorAsync(
TrackableId anchorId,
XRShareableAnchorHosts host,
CancellationToken cancellationToken
)
Attempts to persistently save the given anchor so that it can be loaded in a future session.
Use the SerializableGuid returned by this method as an input parameter to TryLoadAnchorAsync or TryEraseAnchorAsync.
See also:
XRShareableAnchorSubsystemDescriptor.supportsSaveAnchor
| Details |
| Parameters |
anchorId
|
The TrackableId of the shareable anchor to save.
|
host
|
The target host to save this anchor.
|
cancellationToken
|
|
|
|
Returns
|
The result of the async operation, containing a new persistent GUID if the operation succeeded. You are responsible to await this result.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-10-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-28 UTC."],[],[]]