API reference
API reference
Select your platform
No SDKs available
No versions available

SpatialAnchorCoreBuildingBlock Class

Extends MonoBehaviour
A helper class for creating, loading, and erasing a OVRSpatialAnchor easily.
See Editor/BuildingBlocks/BlockData/SampleSpatialAnchorController in the Meta XR Core SDK for an example of how to use this class.

Protected Properties

Signature
OVRSpatialAnchor.OperationResult Result

Properties

OnAnchorCreateCompleted : UnityEvent< OVRSpatialAnchor, OVRSpatialAnchor.OperationResult >
[Get][Set]
This event will trigger after a call to InstantiateSpatialAnchor when the creation of the OVRSpatialAnchor is completed.
Signature
UnityEvent<OVRSpatialAnchor, OVRSpatialAnchor.OperationResult> OnAnchorCreateCompleted
OnAnchorEraseCompleted : UnityEvent< OVRSpatialAnchor, OVRSpatialAnchor.OperationResult >
[Get][Set]
This event will trigger after a call to EraseAnchorByUuid when the OVRSpatialAnchor erasure is completed.
Signature
UnityEvent<OVRSpatialAnchor, OVRSpatialAnchor.OperationResult> OnAnchorEraseCompleted
OnAnchorsEraseAllCompleted : UnityEvent< OVRSpatialAnchor.OperationResult >
[Get][Set]
This event will trigger after a call to EraseAllAnchors when all the OVRSpatialAnchor(s) erasure is completed.
Signature
UnityEvent<OVRSpatialAnchor.OperationResult> OnAnchorsEraseAllCompleted
OnAnchorsLoadCompleted : UnityEvent< List< OVRSpatialAnchor > >
[Get][Set]
This event will trigger after a call to LoadAndInstantiateAnchors when the list of OVRSpatialAnchors is finished loading.
This should only be used for normal Spatial Anchors, use OnSharedSpatialAnchorsLoadCompleted for the Shared Spatial Anchor loaded event.
Signature
UnityEvent<List<OVRSpatialAnchor> > OnAnchorsLoadCompleted

Protected Methods

LoadAnchorsAsync ( prefab , uuids )
Signature
async void LoadAnchorsAsync(GameObject prefab, IEnumerable< Guid > uuids)
Parameters
prefab: GameObject
uuids: IEnumerable< Guid >
Returns
async void
SaveAsync ( anchor )
Signature
async Task SaveAsync(OVRSpatialAnchor anchor)
Parameters
Returns
async Task
WaitForInit ( anchor )
Signature
async Task WaitForInit(OVRSpatialAnchor anchor)
Parameters
Returns
async Task

Methods

EraseAllAnchors ()
Erase all instantiated OVRSpatialAnchor(s).
It'll collect the uuid(s) of the instantiated OVRSpatialAnchor(s) and erase them. Use the OnAnchorsEraseAllCompleted event to be notified when this operation is complete. /remarks>
Signature
void EraseAllAnchors()
Returns
void
EraseAnchorByUuid ( uuid )
Erases an OVRSpatialAnchor by Guid.
Use the OnAnchorEraseCompleted event to be notified when this operation is completed.
Signature
async void EraseAnchorByUuid(Guid uuid)
Parameters
uuid: Guid  Anchor's uuid to erase.
Returns
async void
InstantiateSpatialAnchor ( prefab , position , rotation )
Creates and instantiates an OVRSpatialAnchor.
Use the OnAnchorCreateCompleted event to be notified when this operation is complete. Once the instantiation completed you can retrieve the OVRSpatialAnchor from the OnAnchorCreateCompleted callback. For more information, see Creating a New Spatial Anchor.
Signature
void InstantiateSpatialAnchor(GameObject prefab, Vector3 position, Quaternion rotation)
Parameters
prefab: GameObject  A prefab to add the OVRSpatialAnchor component.
position: Vector3  Position for the new anchor.
rotation: Quaternion  Orientation of the new anchor
Returns
void
LoadAndInstantiateAnchors ( prefab , uuids )
Loads and instantiates anchors from a list of Guids.
Use the OnAnchorsLoadCompleted event to be notified when this operation is complete.
Signature
void LoadAndInstantiateAnchors(GameObject prefab, List< Guid > uuids)
Parameters
prefab: GameObject  Prefab for instantiating the loaded anchors.
uuids: List< Guid >  List of anchor's Guid to load.
Returns
void
Throws
ArgumentNullException  Throws when uuids is null.