async void CreateSpatialAnchor(GameObject gameObject) {
// Add the component to a GameObject
var anchor = gameObject.AddComponent<OVRSpatialAnchor>();
// Wait for creation+localization
await anchor.WhenLocalizedAsync();
// Anchor is ready to use
Debug.Log($"Anchor created at {anchor.transform.position}");
}Created
: bool
[Get] |
Whether the spatial anchor is created.
Creation is asynchronous and may take several frames. If creation fails, the component is destroyed.
Signature
bool Created |
IsTracked
: bool
[Get] |
Whether this anchor is current considered tracked.
An anchor may become temporarily untracked if, for example, it cannot be seen by the device.
Signature
bool IsTracked |
Localized
: bool
[Get] |
Whether the spatial anchor is localized.
When you create a new spatial anchor, it may take a few frames before it is localized. Once localized, its transform updates automatically.
Signature
bool Localized |
OnLocalize
: Action< OperationResult > |
Event that is dispatched when the anchor is localized.
If the anchor is already localized when a subscriber is added, the subscriber is invoked immediately.
Consider WhenLocalizedAsync for a more flexible way to await anchor localization.
Signature
Action<OperationResult> OnLocalize |
PendingCreation
: bool
[Get] |
Checks whether the spatial anchor is pending creation.
Signature
bool PendingCreation |
Space
: OVRSpace
[Get] |
(Obsolete) The space associated with the spatial anchor.
DeprecatedThis property is obsolete. This class provides all spatial anchor functionality and it should not be necessary to use this low-level handle directly. See SaveAsync(), ShareAsync(OVRSpaceUser), and EraseAsync().
The OVRSpace represents the runtime instance of the spatial anchor and will change across different sessions.
Signature
OVRSpace Space |
Uuid
: Guid
[Get] |
The UUID associated with the spatial anchor.
UUIDs persist across sessions. If you load a persisted anchor, you can use the UUID to identify it.
Signature
Guid Uuid |
Erase
(
onComplete
)
|
(Obsolete) Erases the OVRSpatialAnchor from persistent storage.
DeprecatedThis method is obsolete. Use EraseAsync(). To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion. Erasing an OVRSpatialAnchor does not destroy the anchor.
Signature
void Erase(Action< OVRSpatialAnchor, bool > onComplete=null) Parameters onComplete: Action< OVRSpatialAnchor, bool >
Invoked when the erase operation completes. May be null. Parameters are
Returns void |
Erase
(
eraseOptions
, onComplete
)
|
(Obsolete) Erases the OVRSpatialAnchor from specified storage.
DeprecatedThis method is obsolete. Use EraseAsync(EraseOptions). To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion. Erasing an OVRSpatialAnchor does not destroy the anchor.
Signature
void Erase(EraseOptions eraseOptions, Action< OVRSpatialAnchor, bool > onComplete=null) Parameters eraseOptions: EraseOptions
Options how the anchor should be erased.
onComplete: Action< OVRSpatialAnchor, bool >
Invoked when the erase operation completes. May be null. Parameters are
Returns void |
EraseAnchorAsync
()
|
Erase the anchor from persistent storage.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
NOTE: If you have a collection of anchors to save, it is more efficient to use EraseAnchorsAsync.
Signature
OVRTask< OVRResult< OVRAnchor.EraseResult > > EraseAnchorAsync() Returns OVRTask< OVRResult< OVRAnchor.EraseResult > >
Returns an awaitable OVRTask representing the asynchronous erase operation.
|
EraseAsync
()
|
(Obsolete) Erases the OVRSpatialAnchor from specified storage.
DeprecatedThis method is obsolete. Use EraseAnchorAsync instead.
This method is asynchronous; use the returned OVRTask to be notified of completion. Erasing an OVRSpatialAnchor does not destroy the anchor.
Signature
OVRTask< bool > EraseAsync() |
EraseAsync
(
eraseOptions
)
|
(Obsolete) Erases the OVRSpatialAnchor from specified storage.
DeprecatedThis method is obsolete. Use EraseAnchorAsync instead.
This method is asynchronous; use the returned OVRTask to be notified of completion. Erasing an OVRSpatialAnchor does not destroy the anchor.
Signature
OVRTask< bool > EraseAsync(EraseOptions eraseOptions) Parameters eraseOptions: EraseOptions
Options for how the anchor should be erased.
|
InitializeFromExisting
(
space
, uuid
)
|
(Obsolete) Initializes this component from an existing space handle and uuid, for example, the result of a call to OVRPlugin.QuerySpaces.
DeprecatedThis method is obsolete. To create a new anchor, use
AddComponent<OVRSpatialAnchor>()
. To load a previously saved anchor, use LoadUnboundAnchorsAsync.
This method associates the component with an existing spatial anchor, for example, the one that was saved in a previous session. Do not call this method to create a new spatial anchor.
If you call this method, you must do so prior to the component's Start method. You cannot change the spatial anchor associated with this component after that.
Signature
void InitializeFromExisting(OVRSpace space, Guid uuid) Parameters Returns voidThrows InvalidOperationException
Thrown if Start has already been called on this component.
ArgumentException
Thrown if space is not OVRSpace.Valid.
|
Save
(
onComplete
)
|
(Obsolete) Saves the OVRSpatialAnchor to local persistent storage.
DeprecatedThis method is obsolete. Use SaveAsync() instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
When saved, an OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
This operation fully succeeds or fails, which means, either all anchors are successfully saved, or the operation fails.
Signature
void Save(Action< OVRSpatialAnchor, bool > onComplete=null) Parameters onComplete: Action< OVRSpatialAnchor, bool >
Invoked when the save operation completes. May be null. Parameters are
Returns void |
Save
(
saveOptions
, onComplete
)
|
(Obsolete) Saves the OVRSpatialAnchor with specified SaveOptions.
DeprecatedThis method is obsolete. Use SaveAsync() instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion. When saved, the OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
This operation fully succeeds or fails; that is, either all anchors are successfully saved, or the operation fails.
Signature
void Save(SaveOptions saveOptions, Action< OVRSpatialAnchor, bool > onComplete=null) Parameters saveOptions: SaveOptions
Save options, e.g., whether local or cloud.
onComplete: Action< OVRSpatialAnchor, bool >
Invoked when the save operation completes. May be null. Parameters are
Returns void |
SaveAnchorAsync
()
|
Saves this anchor to persistent storage.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
When saved, an OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
NOTE: If you have a collection of anchors to save, it is more efficient to use SaveAnchorsAsync.
Signature
OVRTask< OVRResult< OVRAnchor.SaveResult > > SaveAnchorAsync() Returns OVRTask< OVRResult< OVRAnchor.SaveResult > >
Returns an awaitable OVRTask representing the asynchronous save operation.
|
SaveAsync
()
|
(Obsolete) Saves the OVRSpatialAnchor with specified SaveOptions.
DeprecatedThis method is obsolete. Use SaveAnchorAsync instead.
This method is asynchronous; use the returned OVRTask to be notified of completion. When saved, the OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
This operation fully succeeds or fails; that is, either all anchors are successfully saved, or the operation fails.
Signature
OVRTask< bool > SaveAsync() |
SaveAsync
(
saveOptions
)
|
(Obsolete) Saves the OVRSpatialAnchor with specified SaveOptions.
DeprecatedThis method is obsolete. Use SaveAnchorAsync instead.
This method is asynchronous; use the returned OVRTask to be notified of completion. When saved, the OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
This operation fully succeeds or fails; that is, either all anchors are successfully saved, or the operation fails.
Signature
OVRTask< bool > SaveAsync(SaveOptions saveOptions) Parameters saveOptions: SaveOptions
Options for how the anchor will be saved.
|
Share
(
user
, onComplete
)
|
(Obsolete) Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(OVRSpaceUser) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
Signature
void Share(OVRSpaceUser user, Action< OperationResult > onComplete=null) Parameters onComplete: Action< OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns void |
Share
(
user1
, user2
, onComplete
)
|
(Obsolete) Shares the anchor with two OVRSpaceUser.
Specified users will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(OVRSpaceUser, OVRSpaceUser) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
Signature
void Share(OVRSpaceUser user1, OVRSpaceUser user2, Action< OperationResult > onComplete=null) Parameters onComplete: Action< OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns void |
Share
(
user1
, user2
, user3
, onComplete
)
|
(Obsolete) Shares the anchor with three OVRSpaceUser.
Specified users will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(OVRSpaceUser, OVRSpaceUser, OVRSpaceUser) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
Signature
void Share(OVRSpaceUser user1, OVRSpaceUser user2, OVRSpaceUser user3, Action< OperationResult > onComplete=null) Parameters onComplete: Action< OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns void |
Share
(
user1
, user2
, user3
, user4
, onComplete
)
|
(Obsolete) Shares the anchor with four OVRSpaceUser.
Specified users will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(OVRSpaceUser, OVRSpaceUser, OVRSpaceUser, OVRSpaceUser) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
Signature
void Share(OVRSpaceUser user1, OVRSpaceUser user2, OVRSpaceUser user3, OVRSpaceUser user4, Action< OperationResult > onComplete=null) Parameters onComplete: Action< OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns void |
Share
(
users
, onComplete
)
|
(Obsolete) Shares the anchor to a collection of OVRSpaceUser.
Specified users will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(IEnumerable<OVRSpaceUser>). To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
Signature
void Share(IEnumerable< OVRSpaceUser > users, Action< OperationResult > onComplete=null) Parameters onComplete: Action< OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns void |
ShareAsync
(
user
)
|
Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion.
Signature
OVRTask< OperationResult > ShareAsync(OVRSpaceUser user) Parameters Returns OVRTask< OperationResult >
Returns an OVRTask<OperationResult> indicating the success of the share operation.
|
ShareAsync
(
user1
, user2
)
|
Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion.
Signature
OVRTask< OperationResult > ShareAsync(OVRSpaceUser user1, OVRSpaceUser user2) Parameters Returns OVRTask< OperationResult >
Returns an OVRTask<OperationResult> indicating the success of the share operation.
|
ShareAsync
(
user1
, user2
, user3
)
|
Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion.
Signature
OVRTask< OperationResult > ShareAsync(OVRSpaceUser user1, OVRSpaceUser user2, OVRSpaceUser user3) Parameters Returns OVRTask< OperationResult >
Returns an OVRTask<OperationResult> indicating the success of the share operation.
|
ShareAsync
(
user1
, user2
, user3
, user4
)
|
Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion.
Signature
OVRTask< OperationResult > ShareAsync(OVRSpaceUser user1, OVRSpaceUser user2, OVRSpaceUser user3, OVRSpaceUser user4) Parameters Returns OVRTask< OperationResult >
Returns an OVRTask<OperationResult> indicating the success of the share operation.
|
ShareAsync
(
users
)
|
Shares the anchor to an OVRSpaceUser.
The specified user will be able to download, track, and share specified anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion.
Signature
OVRTask< OperationResult > ShareAsync(IEnumerable< OVRSpaceUser > users) Parameters Returns OVRTask< OperationResult >
Returns an OVRTask<OperationResult> indicating the success of the share operation.
|
ShareAsync
(
groupUuid
)
|
Shares this anchor with the group associated with the given UUID.
This method is asynchronous; use the returned OVRTask wrapper to be notified of completion. The groupUuid parameter can be any valid Guid, which excludes the default value Guid, AKA Guid.Empty.
Signature
OVRTask< OVRResult< OVRAnchor.ShareResult > > ShareAsync(Guid groupUuid) Parameters groupUuid: Guid
A UUID of a group to share the anchors with. Anchors shared to this groupUuid can be loaded by other clients via LoadUnboundSharedAnchorsAsync(Guid,List<UnboundAnchor>). NOTE: You may arbitrarily generate your own UUIDs (e.g. with System.Guid.NewGuid), or you may use UUIDs provided by colocation APIs such as in OVRColocationSession. Returns OVRTask< OVRResult< OVRAnchor.ShareResult > >
Returns an OVRResult<OVRAnchor.ShareResult> indicating the status of the share operation.
Throws ArgumentException
Thrown if groupUuid is Guid.Empty.
|
WhenCreatedAsync
()
|
Creates an async task that completes when Created becomes true.
Anchor creation is asynchronous, and adding this component to a GameObject will start the creation operation. You can use this async method to await the creation from another async method.
This allows you to write code like this:
async Task<OVRSpatialAnchor> CreateAnchor(GameObject gameObject) {
var anchor = gameObject.AddComponent<OVRSpatialAnchor>();
await anchor.WhenCreatedAsync();
return anchor;
}
Signature
async OVRTask< bool > WhenCreatedAsync() Returns async OVRTask< bool >
Returns a task-like object that can be used to track the completion of the creation. If creation succeeds, the result of the task is true, otherwise false.
|
WhenLocalizedAsync
()
|
Async method that completes when localization completes.
Localization occurs automatically, but the process may take some time. After creating a new OVRSpatialAnchor, you can await this method from within another async method to pause execution until the anchor has been localized.
If the localization operation has already completed, this method returns immediately.
The bool result of the returned OVRTask<bool> indicates whether localization was successful.
To create a new spatial anchor and wait until it is both created and localized, you can use code like this:
async Task<OVRSpatialAnchor> CreateAnchor(GameObject gameObject) {
var anchor = gameObject.AddComponent<OVRSpatialAnchor>();
await anchor.WhenLocalizedAsync();
return anchor; // anchor is localized and ready to use
}
Signature
async OVRTask< bool > WhenLocalizedAsync() Returns async OVRTask< bool >
Returns a task-like object that can be used to track the completion of the asynchronous localization operation.
|
EraseAnchorsAsync
(
anchors
, uuids
)
|
Erase a collection of anchors from persistent storage.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
Signature
static OVRTask< OVRResult< OVRAnchor.EraseResult > > EraseAnchorsAsync(IEnumerable< OVRSpatialAnchor > anchors, IEnumerable< Guid > uuids) Parameters uuids: IEnumerable< Guid >
(Optional) The UUIDs to erase
Returns OVRTask< OVRResult< OVRAnchor.EraseResult > >
Returns an awaitable OVRTask representing the asynchronous erase operation.
Throws ArgumentException
Thrown if anchors and uuids are both null.
|
FromOVRAnchor
(
anchor
, unboundAnchor
)
|
Create an unbound spatial anchor from an OVRAnchor.
Only spatial anchors retrieved as OVRAnchors should use this method. Using this function on system-managed scene anchors will succeed, but certain functions will not work.
Signature
static bool FromOVRAnchor(OVRAnchor anchor, out UnboundAnchor unboundAnchor) Parameters Returns bool
True if anchor is localizable and is not already bound to an OVRSpatialAnchor, otherwise false.
|
LoadUnboundAnchors
(
options
, onComplete
)
|
(Obsolete) Performs a query for anchors with the specified options .
DeprecatedThis method is obsolete. Use LoadUnboundAnchorsAsync. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
Use this method to find anchors that were previously persisted with Save(Action<OVRSpatialAnchor, bool>. The query is asynchronous; when the query completes, onComplete is invoked with an array of UnboundAnchors for which tracking may be requested.
onComplete is invoked with null.
Signature
static bool LoadUnboundAnchors(LoadOptions options, Action< UnboundAnchor[]> onComplete) Parameters options: LoadOptions
Options that affect the query.
onComplete: Action< UnboundAnchor[]>
A delegate invoked when the query completes. The delegate accepts one argument:
Returns bool
Returns true if the operation could be initiated; otherwise false.
Throws ArgumentNullException
Thrown if onComplete is null.
InvalidOperationException
Thrown if LoadOptions.Uuids of options is null.
|
LoadUnboundAnchorsAsync
(
uuids
, unboundAnchors
, onIncrementalResultsAvailable
)
|
Loads up to 50 unbound anchors with specified UUIDs.
An UnboundAnchor is an anchor that exists, but that isn't managed by an OVRSpatialAnchor. Use this method to load a collection of anchors by UUID that haven't already been bound to an OVRSpatialAnchor.
In order to be loaded, the anchor must have previously been persisted, e.g., with SaveAnchorsAsync.
NOTE: This method will only process the first 50 UUIDs provided by uuids .
This method is asynchronous. The returned OVRTask completes when all results are available. However, anchors may be loaded in batches. To be notified as the results of individual batches are loaded, provide an onIncrementalResultsAvailable callback. The callback accepts two parameters:
(List<UnboundAnchor> unboundAnchors, int startingIndex)
Before the task completes, it is undefined behavior to access unboundAnchors outside of onIncrementalResultsAvailable invocations.
Note that if you bind an UnboundAnchor in the onIncrementalResultsAvailable callback, that same anchor will no longer be present in the unboundAnchors provided to future incremental results, or after the task completes. That is, an UnboundAnchor is removed from the list of unboundAnchors once it is bound.
unboundAnchors is the buffer used to store the results. This allows you to reuse the same buffer between subsequent calls. The list is cleared before any anchors are added to it.
Signature
static OVRTask< OVRResult< List< UnboundAnchor >, OVRAnchor.FetchResult > > LoadUnboundAnchorsAsync(IEnumerable< Guid > uuids, List< UnboundAnchor > unboundAnchors, Action< List< UnboundAnchor >, int > onIncrementalResultsAvailable=null) Parameters uuids: IEnumerable< Guid >
The UUIDs of the anchors to load.
unboundAnchors: List< UnboundAnchor >
The buffer to store the resulting unbound anchors into.
onIncrementalResultsAvailable: Action< List< UnboundAnchor >, int >
An optional callback that is invoked whenever a new batch of unbound anchors has been loaded.
Returns OVRTask< OVRResult< List< UnboundAnchor >, OVRAnchor.FetchResult > >
A new OVRTask that completes when the loading operation completes.
Throws ArgumentNullException
Thrown if uuids is null.
ArgumentNullException
Thrown if unboundAnchors is null.
|
LoadUnboundAnchorsAsync
(
options
)
|
(Obsolete) Performs a query for anchors with the specified options .
DeprecatedThis method is obsolete. Use LoadUnboundAnchorsAsync(IEnumerable<Guid>,List<UnboundAnchor>,Action<List<UnboundAnchor>, int> instead.
Use this method to find anchors that were previously persisted with Save(Action<OVRSpatialAnchor, bool>. The query is asynchronous; when the query completes, the returned OVRTask will contain an array of UnboundAnchors for which tracking may be requested.
Signature
static OVRTask< UnboundAnchor[]> LoadUnboundAnchorsAsync(LoadOptions options) Parameters options: LoadOptions
Options that affect the query.
|
LoadUnboundSharedAnchorsAsync
(
uuids
, unboundAnchors
)
|
Load anchors that have been shared with you.
Use this method to load spatial anchors that have been shared with you by another user.
This method requires access to Meta servers to query for shared anchors. This method can fail in a few ways:
To load other types of anchors, use LoadUnboundAnchorsAsync(IEnumerable<Guid>,List<UnboundAnchor>,Action<List<UnboundAnchor>,int>).
Signature
static async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > > LoadUnboundSharedAnchorsAsync(IEnumerable< Guid > uuids, List< UnboundAnchor > unboundAnchors) Parameters uuids: IEnumerable< Guid >
The set of anchor UUIDs to load. These are typically sourced from your serialization and/or networking layers. You should not attempt to load more than OVRSpaceQuery.MaxResultsForAnchors anchors per request. The elements in this set will NOT be individually validated; you should be sure that none of them are Guid.Empty before calling this API. unboundAnchors: List< UnboundAnchor >
A buffer to store the loaded anchors. This container is always cleared unless an exception is thrown.
Returns async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > >
Returns an awaitable task-like object that can be used to track completion of the load operation.
Throws ArgumentNullException
Thrown if either uuids or unboundAnchors is null.
|
LoadUnboundSharedAnchorsAsync
(
groupUuid
, unboundAnchors
)
|
Loads all (unbound) spatial anchors shared with a group by its UUID.
This method is asynchronous. The returned OVRTask wrapper completes when all results are available. In order to be loaded, the anchor must have previously been shared with the group, e.g., with ShareAsync(IEnumerable<OVRSpatialAnchor>, Guid). ShareAsync(IEnumerable<OVRSpatialAnchor>, IEnumerable<Guid>). An UnboundAnchor is an anchor that exists, but that isn't yet managed by an OVRSpatialAnchor instance. To bind these anchors, create new GameObjects with an OVRSpatialAnchor component attached, and pass this component to an unbound anchor's UnboundAnchor.BindTo method. Already-bound anchors will not appear in the resulting unboundAnchors list until subsequent app launches.
Signature
static async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > > LoadUnboundSharedAnchorsAsync(Guid groupUuid, List< UnboundAnchor > unboundAnchors) Parameters groupUuid: Guid
The group UUID to load any associated shared anchors from.
unboundAnchors: List< UnboundAnchor >
A non-null buffer to store the loaded anchors. This container is always cleared unless an exception is thrown.
Returns async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > >
Returns an OVRResult<List<UnboundAnchor>,OperationResult>, which indicates the status of the load operation, as well as returning a now-populated reference to the unboundAnchors buffer list originally provided to this call. This result's Status will be OperationResult.Failure_InvalidParameter if groupUuid is Guid.Empty. Throws ArgumentException
Thrown if groupUuid is Guid.Empty.
ArgumentNullException
Thrown if unboundAnchors is null.
|
LoadUnboundSharedAnchorsAsync
(
groupUuid
, allowedAnchorUuids
, unboundAnchors
)
|
Loads all (unbound) spatial anchors shared with a group by its UUID.
This method is asynchronous. The returned OVRTask wrapper completes when all results are available. In order to be loaded, the anchor must have previously been shared with the group, e.g., with ShareAsync(IEnumerable<OVRSpatialAnchor>, Guid). ShareAsync(IEnumerable<OVRSpatialAnchor>, IEnumerable<Guid>). An UnboundAnchor is an anchor that exists, but that isn't yet managed by an OVRSpatialAnchor instance. To bind these anchors, create new GameObjects with an OVRSpatialAnchor component attached, and pass this component to an unbound anchor's UnboundAnchor.BindTo method. Already-bound anchors will not appear in the resulting unboundAnchors list until subsequent app launches.
Signature
static async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > > LoadUnboundSharedAnchorsAsync(Guid groupUuid, IEnumerable< Guid > allowedAnchorUuids, List< UnboundAnchor > unboundAnchors) Parameters groupUuid: Guid
The group UUID to load any associated shared anchors from.
allowedAnchorUuids: IEnumerable< Guid >
A non-null, non-empty set of known anchor UUIDs to load from the group. They will not be loaded if:
unboundAnchors: List< UnboundAnchor >
A non-null buffer to store the loaded anchors. This container is always cleared unless an exception is thrown.
Returns async OVRTask< OVRResult< List< UnboundAnchor >, OperationResult > >
Returns an OVRResult<List<UnboundAnchor>,OperationResult>, which indicates the status of the load operation, as well as returning a now-populated reference to the unboundAnchors buffer list originally provided to this call. This result's Status will be OperationResult.Failure_InvalidParameter if groupUuid is Guid.Empty, or allowedAnchorUuids is larger than OVRSpaceQuery.MaxResultsForAnchors. Throws ArgumentException
Thrown if groupUuid is Guid.Empty.
ArgumentNullException
Thrown if either allowedAnchorUuids or unboundAnchors is null.
|
Save
(
anchors
, saveOptions
, onComplete
)
|
(Obsolete) Saves a collection of anchors to persistent storage.
DeprecatedThis method is obsolete. Use SaveAsync(IEnumerable<OVRSpatialAnchor>, SaveOptions) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion. When saved, an OVRSpatialAnchor can be loaded by a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
Signature
static void Save(ICollection< OVRSpatialAnchor > anchors, SaveOptions saveOptions, Action< ICollection< OVRSpatialAnchor >, OperationResult > onComplete=null) Parameters saveOptions: SaveOptions
Save options, e.g., whether local or cloud.
onComplete: Action< ICollection< OVRSpatialAnchor >, OperationResult >
Invoked when the save operation completes. May be null. onComplete receives two parameters:
Returns voidThrows ArgumentNullException
Thrown if anchors is null.
|
SaveAnchorsAsync
(
anchors
)
|
Saves a collection of anchors.
This method is asynchronous; use the returned OVRTask to be notified of completion. When saved, the OVRSpatialAnchor can be loaded by a different session. Use LoadUnboundAnchorsAsync(IEnumerable<Guid>,List<UnboundAnchor>,Action<List<UnboundAnchor>,int>) to load some or all OVRSpatialAnchor at a future time.
This operation fully succeeds or fails; that is, either all anchors are successfully saved, or the operation fails.
Signature
static OVRTask< OVRResult< OVRAnchor.SaveResult > > SaveAnchorsAsync(IEnumerable< OVRSpatialAnchor > anchors) Parameters Returns OVRTask< OVRResult< OVRAnchor.SaveResult > >
Returns an awaitable OVRTask representing the asynchronous save operation.
Throws ArgumentNullException
Thrown if anchors is null.
|
SaveAsync
(
anchors
, saveOptions
)
|
(Obsolete) Saves a collection of anchors to persistent storage.
DeprecatedThis method is obsolete. Use SaveAnchorsAsync instead.
This method is asynchronous. Use the returned OVRTask to track the progress of the save operation.
When saved, an OVRSpatialAnchor can be loaded in a different session. Use the Uuid to identify the same OVRSpatialAnchor at a future time.
Signature
static OVRTask< OperationResult > SaveAsync(IEnumerable< OVRSpatialAnchor > anchors, SaveOptions saveOptions) Parameters saveOptions: SaveOptions
Save options, e.g., whether local or cloud.
Throws ArgumentNullException
Thrown if anchors is null.
|
Share
(
anchors
, users
, onComplete
)
|
(Obsolete) Shares a collection of OVRSpatialAnchor to specified users.
Specified users will be able to download, track, and share specified anchors.
DeprecatedThis method is obsolete. Use ShareAsync(IEnumerable<OVRSpatialAnchor>,IEnumerable<OVRSpaceUser>) instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
This method is asynchronous. Use onComplete to be notified of completion.
This operation fully succeeds or fails, which means, either all anchors are successfully shared or the operation fails.
Signature
static void Share(ICollection< OVRSpatialAnchor > anchors, ICollection< OVRSpaceUser > users, Action< ICollection< OVRSpatialAnchor >, OperationResult > onComplete=null) Parameters onComplete: Action< ICollection< OVRSpatialAnchor >, OperationResult >
Invoked when the share operation completes. May be null. Delegate parameter is
Returns voidThrows ArgumentNullException
Thrown if anchors is null.
ArgumentNullException
Thrown if users is null.
|
ShareAsync
(
anchors
, users
)
|
Shares a collection of anchors with a collection of users.
The users will be able to download, localize, and share the specified anchors.
This method is asynchronous. Use the returned OVRTask to monitor completion.
This operation fully succeeds or fails, which means, either all anchors are successfully shared or the operation fails.
Signature
static OVRTask< OperationResult > ShareAsync(IEnumerable< OVRSpatialAnchor > anchors, IEnumerable< OVRSpaceUser > users) Parameters Returns OVRTask< OperationResult >
Returns a task that can be used to track the completion of the sharing operation.
Throws ArgumentNullException
Thrown if anchors is null.
ArgumentNullException
Thrown if users is null.
|
ShareAsync
(
anchors
, groupUuid
)
|
Shares a collection of anchors to a group.
This method is asynchronous; use the returned OVRTask wrapper to be notified of completion. The groupUuid parameter can be any valid Guid, which excludes the default value Guid, AKA Guid.Empty.
Signature
static OVRTask< OVRResult< OVRAnchor.ShareResult > > ShareAsync(IEnumerable< OVRSpatialAnchor > anchors, Guid groupUuid) Parameters anchors: IEnumerable< OVRSpatialAnchor >
The collection of anchors to share. These anchors must exist, be localized, and be saved prior to sharing.
groupUuid: Guid
A UUID of a group to share the anchors with. Anchors shared to this groupUuid can be loaded by other clients via LoadUnboundSharedAnchorsAsync(Guid,List<UnboundAnchor>). NOTE: You may arbitrarily generate your own UUIDs (e.g. with System.Guid.NewGuid), or you may use UUIDs provided by colocation APIs such as in OVRColocationSession. Returns OVRTask< OVRResult< OVRAnchor.ShareResult > >
Returns an OVRResult<OVRAnchor.ShareResult> indicating the status of the share operation.
Throws ArgumentException
Thrown if groupUuid is Guid.Empty
ArgumentNullException
Thrown if anchors is null.
|
ShareAsync
(
anchors
, groupUuids
)
|
Shares a collection of anchors to a collection of groups.
This method is asynchronous; use the returned OVRTask wrapper to be notified of completion. The groupUuids parameter can consist of any valid Guids, which excludes the default value Guid, AKA Guid.Empty.
Signature
static OVRTask< OVRResult< OVRAnchor.ShareResult > > ShareAsync(IEnumerable< OVRSpatialAnchor > anchors, IEnumerable< Guid > groupUuids) Parameters anchors: IEnumerable< OVRSpatialAnchor >
The collection of anchors to share. These anchors must exist, be localized, and be saved prior to sharing.
groupUuids: IEnumerable< Guid >
The collection of group UUIDs to share the anchors with. Anchors shared to these groupUuids can be loaded by other clients via LoadUnboundSharedAnchorsAsync(Guid,List<UnboundAnchor>), called individually per group UUID. NOTE: You may arbitrarily generate your own UUIDs (e.g. with System.Guid.NewGuid), or you may use UUIDs provided by colocation APIs such as in OVRColocationSession. Returns OVRTask< OVRResult< OVRAnchor.ShareResult > >
Returns an OVRResult<OVRAnchor.ShareResult> indicating the status of the share operation.
Throws ArgumentException
Thrown if groupUuids contains at least 1 Guid.Empty.
ArgumentNullException
Thrown if anchors or groupUuids is null.
|
Storage
: OVRSpace.StorageLocation |
(Obsolete) Location from where the OVRSpatialAnchor will be erased.
DeprecatedYou no longer need to provide a storage location when erasing anchors.
In the now obsolete methods, you could specify a storage location (local or cloud) from which to erase the anchor. This is no longer required.
Signature
OVRSpace.StorageLocation Storage |
OVRSpatialAnchor.LoadOptions options = new OVRSpatialAnchor.LoadOptions
{
Timeout = 0,
Uuids = savedAnchorUuids
};MaxSupported
: const int |
The maximum number of uuids that may be present in the Uuids collection.
Signature
const int MaxSupported |
MaxAnchorCount
: int
[Get][Set] |
(Obsolete) The maximum number of anchors to query.
In prior SDK versions, it was mandatory to set this property to receive any results. However, this property is now obsolete. If MaxAnchorCount is zero, i.e., the default initialized value, it will automatically be set to the count of Uuids.
If non-zero, the number of anchors in the result will be limited to MaxAnchorCount, preserving the previous behavior.
Signature
int MaxAnchorCount |
StorageLocation
: OVRSpace.StorageLocation
[Get][Set] |
The storage location from which to query spatial anchors.
Signature
OVRSpace.StorageLocation StorageLocation |
Timeout
: double
[Get][Set] |
The timeout, in seconds, for the query operation.
A value of zero indicates no timeout.
Signature
double Timeout |
Uuids
: IReadOnlyList< Guid >
[Get][Set] |
The set of spatial anchors to query, identified by their UUIDs.
The UUIDs are copied by the OVRSpatialAnchor.LoadUnboundAnchorsAsync method and no longer referenced internally afterwards.
You must supply a list of UUIDs. OVRSpatialAnchor.LoadUnboundAnchorsAsync will throw if this property is null.
Signature
IReadOnlyList<Guid> Uuids |
Storage
: OVRSpace.StorageLocation |
Location where OVRSpatialAnchor will be saved.
DeprecatedYou no longer need to provide a storage location when saving an anchor.
In the now obsolete save methods, you could specify a storage location (local or cloud) from which to save the anchor. This is no longer required.
Signature
OVRSpace.StorageLocation Storage |
Localized
: bool
[Get] |
Whether the anchor has been localized.
Prior to localization, the anchor's Pose cannot be determined.
Signature
bool Localized |
Localizing
: bool
[Get] |
Whether the anchor is in the process of being localized.
Signature
bool Localizing |
Pose
: Pose
[Get] |
(Obsolete) The world space pose of the spatial anchor.
DeprecatedThis method is obsolete. Acquiring the pose can fail; consider TryGetPose instead.
Signature
Pose Pose |
Uuid
: Guid
[Get] |
The universally unique identifier associated with this anchor.
Signature
Guid Uuid |
BindTo
(
spatialAnchor
)
|
Binds an unbound anchor to an OVRSpatialAnchor component.
Use this to bind an unbound anchor to an OVRSpatialAnchor. After BindTo is used to bind an UnboundAnchor to an OVRSpatialAnchor, the UnboundAnchor is no longer valid; that is, it cannot be bound to another OVRSpatialAnchor.
Signature
void BindTo(OVRSpatialAnchor spatialAnchor) Parameters spatialAnchor: OVRSpatialAnchor
The component to which this unbound anchor should be bound. It should have been recently instantiated, ideally on the same frame as this call.
Returns voidThrows InvalidOperationException
Thrown if this UnboundAnchor does not refer to a valid anchor.
ArgumentNullException
Thrown if spatialAnchor is null.
ArgumentException
Thrown if an anchor is already bound to spatialAnchor .
ArgumentException
Thrown if spatialAnchor is pending creation (see OVRSpatialAnchor.PendingCreation).
InvalidOperationException
Thrown if this UnboundAnchor is already bound to an OVRSpatialAnchor.
|
Localize
(
onComplete
, timeout
)
|
(Obsolete) Localizes an anchor.
DeprecatedThis method is obsolete. Use LocalizeAsync instead. To continue using the onComplete callback, use OVRTask<T>.ContinueWith on the returned task.
The delegate supplied to OVRSpatialAnchor.LoadUnboundAnchors receives an array of unbound spatial anchors. You can choose whether to localize each one and be notified when localization completes.
The onComplete delegate receives two arguments:
Upon successful localization, your delegate should instantiate an OVRSpatialAnchor, then bind the UnboundAnchor to the OVRSpatialAnchor by calling UnboundAnchor.BindTo. Once an UnboundAnchor is bound to an OVRSpatialAnchor, it cannot be used again; that is, it cannot be bound to multiple OVRSpatialAnchor components.
Signature
void Localize(Action< UnboundAnchor, bool > onComplete=null, double timeout=0) Parameters onComplete: Action< UnboundAnchor, bool >
A delegate invoked when localization completes (which may fail). The delegate receives two arguments:
timeout: double
The timeout, in seconds, to attempt localization, or zero to indicate no timeout.
Returns voidThrows InvalidOperationException
Thrown if
|
LocalizeAsync
(
timeout
)
|
Localizes an anchor.
The delegate supplied to LoadUnboundAnchorsAsync(IEnumerable<Guid>,List<UnboundAnchor>,Action<List<UnboundAnchor>,int>) receives an array of unbound spatial anchors. You can choose whether to localize each one and be notified when localization completes.
Upon successful localization, your delegate should instantiate an OVRSpatialAnchor, then bind the UnboundAnchor to the OVRSpatialAnchor by calling UnboundAnchor.BindTo. Once an UnboundAnchor is bound to an OVRSpatialAnchor, it cannot be used again; that is, it cannot be bound to multiple OVRSpatialAnchor components.
Signature
OVRTask< bool > LocalizeAsync(double timeout=0) Parameters timeout: double
The timeout, in seconds, to attempt localization, or zero to indicate no timeout.
Throws InvalidOperationException
Thrown if the anchor does not support localization, e.g., because it is invalid.
|
TryGetPose
(
pose
)
|
The world space pose of the spatial anchor.
Use this method to get the pose of the anchor after it has been localized with LocalizeAsync.
If the anchor is not localized, this method throws InvalidOperationException. If the anchor has been localized, but the pose cannot be retrieved (for example, because of a temporary tracking issue), then this method returns false, and you should try again later.
Signature
bool TryGetPose(out Pose pose) Parameters pose: out Pose
If this method returns true, then pose will contain the world space pose of the anchor. If this method returns false, pose is set to identity.
Returns bool
Returns true if the pose could be obtained, otherwise false.
Throws InvalidOperationException
Thrown if the anchor is invalid, e.g., because it has been destroyed.
InvalidOperationException
Thrown if the anchor has not been localized.
|
| Member | Value | Description |
|---|---|---|
Success | OVRPlugin.Result.Success |
The operation succeeded.
|
Failure | OVRPlugin.Result.Failure |
The operation failed with no additional details.
|
Failure_DataIsInvalid | OVRPlugin.Result.Failure_DataIsInvalid |
The operation failed because the associated data is invalid.
|
Failure_InvalidParameter | OVRPlugin.Result.Failure_InvalidParameter |
An invalid parameter was supplied to the operation, implicating early termination.
|
Failure_SpaceCloudStorageDisabled | OVRPlugin.Result.Failure_SpaceCloudStorageDisabled |
The operation failed because saving anchors to cloud storage is not permitted by the user.
|
Failure_SpaceMappingInsufficient | OVRPlugin.Result.Failure_SpaceMappingInsufficient |
The user was able to download the anchors, but the device was unable to localize itself in the spatial data received from the sharing device.
|
Failure_SpaceLocalizationFailed | OVRPlugin.Result.Failure_SpaceLocalizationFailed |
The user was able to download the anchors, but the device was unable to localize them.
|
Failure_SpaceNetworkTimeout | OVRPlugin.Result.Failure_SpaceNetworkTimeout |
Network operation timed out.
|
Failure_SpaceNetworkRequestFailed | OVRPlugin.Result.Failure_SpaceNetworkRequestFailed |
Network operation failed.
|
Failure_GroupNotFound | OVRPlugin.Result.Failure_SpaceGroupNotFound |
The operation failed because the Group UUID could not be found.
|