XRShareableAnchorSubsystem.Provider

This is an abstract class.

An abstract class to be implemented by providers of this subsystem.

Summary

Inheritance

Inherits from: SubsystemProvider< XRShareableAnchorSubsystem >

Public functions

GetChanges(XRShareableAnchor defaultAnchor, Allocator allocator)
virtual abstract TrackableChanges< XRShareableAnchor >
Gets the changes (added, updated, and removed anchors) since the last call.
TryAddAnchor(Pose pose, out XRShareableAnchor anchor)
virtual abstract bool
Attempts to create a new anchor at the given pose .
TryAttachGeospatialAnchor(XRGeospatialPose geospatialPose)
virtual Result< XRShareableAnchor >
Attempts to create a shareable anchor "attached" to the given geospatial pose.
TryAttachSurfaceAnchorAsync(XRGeospatialSurfaceType type, XRGeospatialPose geospatialPose, CancellationToken cancellationToken)
virtual Awaitable< Result< XRShareableAnchor > >
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)
virtual Awaitable< XRResultStatus >
Attempts to erase the persistent saved data associated with an anchor given its persistent GUID.
TryGetSavedAnchorIdsAsync(XRShareableAnchorHosts host, Allocator allocator, CancellationToken cancellationToken)
virtual 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)
virtual Awaitable< Result< XRShareableAnchor > >
Attempts to load a shareable anchor given its persistent GUID.
TryRemoveAnchor(TrackableId anchorId)
virtual abstract bool
Attempts to remove an existing anchor with anchorId .
TrySaveAnchorAsync(TrackableId anchorId, XRShareableAnchorHosts host, CancellationToken cancellationToken)
virtual Awaitable< Result< SerializableGuid > >
Attempts to persistently save the given anchor so that it can be loaded in a future session.

Public functions

GetChanges

virtual abstract TrackableChanges< XRShareableAnchor > GetChanges(
  XRShareableAnchor defaultAnchor,
  Allocator allocator
)

Gets the changes (added, updated, and removed anchors) since the last call.

Details
Parameters
defaultAnchor
The default shareable anchor instance (used for memory layout).
allocator
The allocator used for the returned data.
Returns
A TrackableChanges describing changes since the last call.

TryAddAnchor

virtual abstract 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
The output anchor. Valid only if this method returns true. The anchor will start with XRShareableAnchorHosts.None.
Returns
true if the new anchor was added. Otherwise, false.

TryAttachGeospatialAnchor

virtual Result< XRShareableAnchor > TryAttachGeospatialAnchor(
  XRGeospatialPose geospatialPose
)

Attempts to create a shareable anchor "attached" to the given geospatial pose.

See also: XRShareableAnchorSubsystemDescriptor.supportsAttachGeospatialAnchor

Details
Parameters
geospatialPose
The geospatial pose of the target location.
Returns
The result of the operation, containing the newly added shareable anchor if the operation succeeded.

TryAttachSurfaceAnchorAsync

virtual Awaitable< Result< XRShareableAnchor > > 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.

See also: XRShareableAnchorSubsystemDescriptor.supportsAttachSurfaceAnchor

Details
Parameters
type
The surface type of the geospatial anchor, determining how to apply the relative altitude from geospatialPose . When passing XRGeospatialSurfaceType.Default, it works the same as TryAttachGeospatialAnchor.
geospatialPose
The geospatial pose of the target location.
cancellationToken
An optional CancellationToken that you can use to cancel the operation in progress if the loaded provider XRShareableAnchorSubsystemDescriptor.supportsAsyncCancellation.
Returns
The result of the async operation, containing the newly added shareable anchor if the operation succeeded. You are responsible to await this result.

TryEraseAnchorAsync

virtual 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
A persistent GUID created by TrySaveAnchorAsync.
host
The target host to erase this persistent id.
cancellationToken
An optional CancellationToken that you can use to cancel the operation in progress if the loaded provider XRShareableAnchorSubsystemDescriptor.supportsAsyncCancellation.
Returns
The result of the async operation. You are responsible to await this result.

TryGetSavedAnchorIdsAsync

virtual 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
An optional CancellationToken that you can use to cancel the operation in progress if the loaded provider XRShareableAnchorSubsystemDescriptor.supportsAsyncCancellation.
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

virtual 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
A persistent GUID created by TrySaveAnchorAsync.
host
The target host to load this persistent id.
cancellationToken
An optional CancellationToken that you can use to cancel the operation in progress if the loaded provider XRShareableAnchorSubsystemDescriptor.supportsAsyncCancellation.
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

virtual abstract 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

virtual 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
An optional CancellationToken that you can use to cancel the operation in progress if the loaded provider XRShareableAnchorSubsystemDescriptor.supportsAsyncCancellation.
Returns
The result of the async operation, containing a new persistent GUID if the operation succeeded. You are responsible to await this result.