Null
: readonly OVRAnchor |
Represents a null anchor.
Because OVRAnchor is a value-type, it is not C#-nullable. However, if you default-construct an OVRAnchor (instead of obtaining one from a query or creation method) then it will be equal to Null. You can test for null by comparing against Null:
async void CreateAnchor(Pose pose) {
var anchor = await OVRAnchor.CreateSpatialAnchorAsync(pose);
if (anchor == OVRAnchor.Null) {
Debug.LogError("Anchor creation failed!");
} else {
// anchor is valid
}
}
Signature
readonly OVRAnchor OVRAnchor.Null |
Uuid
: Guid
[Get] |
The unique identifier of this anchor.
UUIDs persist across sessions. If you load a persisted anchor, you can use the UUID to identify it.
Signature
Guid OVRAnchor.Uuid |
Dispose
()
|
Disposes of an anchor.
Calling this method will destroy the anchor so that it won't be managed by internal systems until the next time it is fetched again.
Signature
void OVRAnchor.Dispose() Returns void |
Equals
(
other
)
|
Compares two anchors for equality.
Signature
bool OVRAnchor.Equals(OVRAnchor other) Parameters Returns bool
Returns true if both anchor UUIDs are the same and they are the same runtime instance. That is, they are the same instance of the same anchor.
|
Equals
(
obj
)
|
Compares this anchor with an object for equality.
Signature
override bool OVRAnchor.Equals(object obj) Parameters obj: object
The object to compare with this anchor.
Returns override bool
Returns true if obj is an OVRAnchor and Equals(OVRAnchor) is also true, otherwise false.
|
EraseAsync
()
|
Erases this anchor.
This method removes the anchor from persistent storage. Note this does not destroy the current instance.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
NOTE: When erasing multiple anchors, it is more efficient to erase them in a batch using EraseAsync(IEnumerable<OVRAnchor>,IEnumerable<Guid>).
Signature
OVRTask< OVRResult< EraseResult > > OVRAnchor.EraseAsync() Returns OVRTask< OVRResult< EraseResult > >
An awaitable OVRTask representing the asynchronous request.
|
GetComponent< T >
()
|
Gets the anchor's component of a specific type.
Make sure the anchor supports the specified type of component using SupportsComponent<T>
Signature
T OVRAnchor.GetComponent< T >() Returns T
The requested component.
Throws InvalidOperationException
Thrown if the anchor doesn't support the specified type of component.
|
GetHashCode
()
|
Generates a hash code suitable for use in a Dictionary or HashSet
Signature
override int OVRAnchor.GetHashCode() Returns override int
Returns a hash code suitable for use in a Dictionary or HashSet |
GetSupportedComponents
(
components
)
|
Get all the supported components of an anchor.
Signature
bool OVRAnchor.GetSupportedComponents(List< SpaceComponentType > components) Parameters components: List< SpaceComponentType >
The list to populate with the supported components. The list is cleared first.
Returns bool true if the supported components could be retrieved, otherwise false.
|
SaveAsync
()
|
Save this anchor.
This method persists the anchor so that it may be retrieved later, e.g., by using FetchAnchorsAsync(List<OVRAnchor>,FetchOptions,Action<List<OVRAnchor>,int>).
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
NOTE: When saving multiple anchors, it is more efficient to save them in a batch using SaveAsync(IEnumerable<OVRAnchor>).
Signature
OVRTask< OVRResult< SaveResult > > OVRAnchor.SaveAsync() Returns OVRTask< OVRResult< SaveResult > >
An awaitable OVRTask representing the asynchronous request.
|
ShareAsync
(
users
)
|
Share this anchor with the specified users.
This method shares the anchor with a collection of OVRSpaceUser.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
Signature
OVRTask< OVRResult< ShareResult > > OVRAnchor.ShareAsync(IEnumerable< OVRSpaceUser > users) Parameters Returns OVRTask< OVRResult< ShareResult > >
An awaitable OVRTask representing the asynchronous request.
Throws ArgumentNullException
Thrown if users is null.
ArgumentException
Thrown if users count is less than one.
|
SupportsComponent< T >
()
|
Tests whether or not the anchor supports a specific type of component.
For performance reasons, we use xrGetSpaceComponentStatusFB, which can result in an error in the logs when the component is not available.
This error does not have impact on the control flow. The alternative method,
Signature
bool OVRAnchor.SupportsComponent< T >() Returns bool
Whether or not the specified type of component is supported.
|
ToString
()
| |
TryGetComponent< T >
(
component
)
|
Tries to get the anchor's component of a specific type.
Signature
bool OVRAnchor.TryGetComponent< T >(out T component) Parameters component: out T
The requested component, as an out parameter.
Returns bool
Whether or not the request succeeded. It may fail if the anchor doesn't support this type of component.
|
CreateSpatialAnchorAsync
(
trackingSpacePose
)
|
Creates a new spatial anchor.
Spatial anchor creation is asynchronous. This method initiates a request to create a spatial anchor at trackingSpacePose . The returned OVRTask<OVRAnchor> can be awaited or used to track the completion of the request.
If spatial anchor creation fails, the resulting OVRAnchor will be OVRAnchor.Null.
Signature
static OVRTask< OVRAnchor > OVRAnchor.CreateSpatialAnchorAsync(Pose trackingSpacePose) Parameters trackingSpacePose: Pose
The pose, in tracking space, at which you wish to create the spatial anchor.
|
CreateSpatialAnchorAsync
(
transform
, centerEyeCamera
)
|
Creates a new spatial anchor.
Spatial anchor creation is asynchronous. This method initiates a request to create a spatial anchor at transform . The returned OVRTask<OVRAnchor> can be awaited or used to track the completion of the request.
If spatial anchor creation fails, the resulting OVRAnchor will be OVRAnchor.Null.
Signature
static OVRTask< OVRAnchor > OVRAnchor.CreateSpatialAnchorAsync(Transform transform, Camera centerEyeCamera) Parameters transform: Transform
The transform at which you wish to create the spatial anchor.
Throws ArgumentNullException
Thrown when transform is null.
ArgumentNullException
Thrown when centerEyeCamera is null.
|
EraseAsync
(
anchors
, uuids
)
|
Erase a collection of anchors.
This method removes up to 32 anchors from persistent storage.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
Signature
static OVRTask< OVRResult< EraseResult > > OVRAnchor.EraseAsync(IEnumerable< OVRAnchor > anchors, IEnumerable< Guid > uuids) Parameters anchors: IEnumerable< OVRAnchor >
(Optional) A collection of anchors to remove from persistent storage.
uuids: IEnumerable< Guid >
(Optional) A collection of uuids to remove from persistent storage.
Returns OVRTask< OVRResult< EraseResult > >
Returns an awaitable OVRTask representing the asynchronous request.
Throws ArgumentException
Thrown if both anchors and uuids are null.
ArgumentException
Thrown if the combined number of anchors and uuids is greater than 32.
|
FetchAnchorsAsync
(
anchors
, options
, incrementalResultsCallback
)
|
Fetch anchors matching a query.
This method queries for anchors that match the corresponding options . This method is asynchronous; use the returned OVRTask to check for completion.
Anchors may be returned in batches. If incrementalResultsCallback is not null, then this delegate is invoked whenever results become available prior to the completion of the entire operation. New anchors are appended to anchors . The delegate receives a reference to anchors and the starting index of the anchors that have been added. The parameters are:
Signature
static OVRTask< TaskResult > OVRAnchor.FetchAnchorsAsync(List< OVRAnchor > anchors, FetchOptions options, Action< List< OVRAnchor >, int > incrementalResultsCallback=null) Parameters anchors: List< OVRAnchor >
Container to store the results. The list is cleared before adding any anchors.
options: FetchOptions
Options describing which anchors to fetch.
incrementalResultsCallback: Action< List< OVRAnchor >, int >
(Optional) A callback invoked when incremental results are available.
Throws ArgumentNullException
Thrown if anchors is null.
|
FetchAnchorsAsync
(
uuids
, anchors
, location
, timeout
)
|
(Obsolete) Asynchronous method that fetches anchors with specifics uuids.
DeprecatedThis method is obsolete. Use FetchAnchorsAsync(List<OVRAnchor>,FetchOptions,Action<List<OVRAnchor>, int>) instead.
Dispose of the returned OVRTask<bool> if you don't use the results
Signature
static OVRTask< bool > OVRAnchor.FetchAnchorsAsync(IEnumerable< Guid > uuids, IList< OVRAnchor > anchors, OVRSpace.StorageLocation location=OVRSpace.StorageLocation.Local, double timeout=0.0) Parameters uuids: IEnumerable< Guid >
Enumerable of uuids that anchors fetched must verify
timeout: double
Timeout in seconds for the query.
Returns OVRTask< bool >
Returns an OVRTask<bool> that will eventually let you test if the fetch was successful or not. If the result is true, then the anchors parameter has been populated with the requested anchors.
Throws System.ArgumentNullException
Thrown if uuids is null.
System.ArgumentNullException
Thrown if anchors is null.
|
FetchAnchorsAsync< T >
(
anchors
, location
, maxResults
, timeout
)
|
(Obsolete) Asynchronous method that fetches anchors with a specific component.
DeprecatedThis method is obsolete. Use FetchAnchorsAsync(List<OVRAnchor>,FetchOptions,Action<List<OVRAnchor>, int>) instead.
Dispose of the returned OVRTask<bool> if you don't use the results
Signature
static OVRTask< bool > OVRAnchor.FetchAnchorsAsync< T >(IList< OVRAnchor > anchors, OVRSpace.StorageLocation location=OVRSpace.StorageLocation.Local, int maxResults=OVRSpaceQuery.Options.MaxUuidCount, double timeout=0.0) Parameters maxResults: int
The maximum number of results the query can return
timeout: double
Timeout in seconds for the query.
Returns OVRTask< bool >
Returns an OVRTask<bool> that will eventually let you test if the fetch was successful or not. If the result is true, then the anchors parameter has been populated with the requested anchors.
Throws System.ArgumentNullException
Thrown if anchors is null.
|
operator!=
(
lhs
, rhs
)
|
Compares two anchors for inequality.
This is the logical negation of Equals(OVRAnchor).
Signature
static bool OVRAnchor.operator!=(OVRAnchor lhs, OVRAnchor rhs) Parameters Returns bool
Returns true if lhs is not equal to rhs , otherwise false.
|
operator==
(
lhs
, rhs
)
|
Compares two anchors for equality.
This is the same equality test as Equals(OVRAnchor).
Signature
static bool OVRAnchor.operator==(OVRAnchor lhs, OVRAnchor rhs) Parameters Returns bool
Returns true if lhs is equal to rhs , otherwise false.
|
SaveAsync
(
anchors
)
|
Save a collection of anchors.
This method persists up to 32 anchors so that they may be retrieved later.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
Signature
static OVRTask< OVRResult< SaveResult > > OVRAnchor.SaveAsync(IEnumerable< OVRAnchor > anchors) Parameters Returns OVRTask< OVRResult< SaveResult > >
Returns an awaitable OVRTask representing the asynchronous request.
Throws ArgumentException
Thrown if anchors contains more than 32 anchors.
|
ShareAsync
(
anchors
, users
)
|
Share a collection of anchors with a collection of users.
This method shares a collection of anchors with a collection of users.
This operation is asynchronous. Use the returned OVRTask to track the result of the asynchronous operation.
Signature
static OVRTask< OVRResult< ShareResult > > OVRAnchor.ShareAsync(IEnumerable< OVRAnchor > anchors, IEnumerable< OVRSpaceUser > users) Parameters Returns OVRTask< OVRResult< ShareResult > >
Returns an awaitable OVRTask representing the asynchronous request.
Throws ArgumentNullException
Thrown if anchors or users are null.
ArgumentException
Thrown if users count is less than one.
|
FetchAnchorsAsync, you must provide FetchOptions to the query.
Single are the same as providing an array of length 1. This is useful in the common cases of retrieving a single anchor by UUID, or querying for all anchors of a single component type, without having to allocate a managed array to hold that single element.
async void FetchByUuid(Guid uuid) {
var options1 = new OVRAnchor.FetchOptions {
SingleUuid = uuid
};
var options2 = new OVRAnchor.FetchOptions {
Uuids = new Guid[] { uuid }
};
// Both options1 and options2 will perform the same query and return the same result
var result1 = await OVRAnchor.FetchAnchorsAsync(new List<OVRAnchor>(), options1);
var result2 = await OVRAnchor.FetchAnchorsAsync(new List<OVRAnchor>(), options2);
Debug.Assert(result1.Status == result2.Status);
if (result1.Success)
{
Debug.Assert(result1.Value.SequenceEqual(result2.Value));
}
}ComponentTypes
: IEnumerable< Type > |
Fetch anchors that support a given set of component types.
Each anchor supports one or more anchor types (types that implemented IOVRAnchorComponent<T>).
If not null, ComponentTypes must be a collection of types that implement IOVRAnchorComponent<T>, e.g., OVRBounded2D or OVRRoomLayout.
When multiple components are specified, all anchors that support any of those types are returned, i.e., the component types are OR'd together to determine whether an anchor matches.
If you only have a single component type, you can use SingleComponentType to avoid having to create a temporary container of length one.
Signature
IEnumerable<Type> OVRAnchor.FetchOptions.ComponentTypes |
SingleComponentType
: Type |
Fetch anchors that support a given component type.
Each anchor supports one or more anchor types (types that implemented IOVRAnchorComponent<T>).
If not null, SingleComponentType must be a type that implements IOVRAnchorComponent<T>, e.g., OVRBounded2D or OVRRoomLayout.
If you have multiple component types, use ComponentTypes instead.
Signature
Type OVRAnchor.FetchOptions.SingleComponentType |
SingleUuid
: Guid? |
A UUID of an existing anchor to fetch.
Set this to fetch a single anchor with by UUID. If you want to fetch multiple anchors by UUID, use Uuids.
Signature
Guid? OVRAnchor.FetchOptions.SingleUuid |
Uuids
: IEnumerable< Guid > |
A collection of UUIDS to fetch.
If you want to retrieve only a single UUID, you can SingleUuid to avoid having to create a temporary container of length one.
NOTE: Only the first 50 anchors are processed by OVRAnchor.FetchAnchorsAsync(System.Collections.Generic.List<OVRAnchor>,OVRAnchor.FetchOptions,System.Action<System.Collections.Generic.List<OVRAnchor>,int>)
Signature
IEnumerable<Guid> OVRAnchor.FetchOptions.Uuids |
| Member | Value | Description |
|---|---|---|
Success | Result.Success |
The operation succeeded.
|
Failure | Result.Failure |
The operation failed.
|
FailureInvalidAnchor | Result.Failure_HandleInvalid |
At least one anchor is invalid.
|
FailureDataIsInvalid | Result.Failure_DataIsInvalid |
Invalid data.
|
FailureInsufficientResources | Result.Failure_SpaceInsufficientResources |
Resource limitation prevented this operation from executing.
Recommend retrying, perhaps after a short delay and/or reducing memory consumption.
|
FailureStorageAtCapacity | Result.Failure_SpaceStorageAtCapacity |
Operation could not be completed until resources used are reduced or storage expanded.
|
FailureInsufficientView | Result.Failure_SpaceInsufficientView |
Insufficient view.
The user needs to look around the environment more for anchor tracking to function.
|
FailurePermissionInsufficient | Result.Failure_SpacePermissionInsufficient |
Insufficient permission.
Recommend confirming the status of the required permissions needed for using anchor APIs.
|
FailureRateLimited | Result.Failure_SpaceRateLimited |
Operation canceled due to rate limiting.
Recommend retrying after a short delay.
|
FailureTooDark | Result.Failure_SpaceTooDark |
Too dark.
The environment is too dark to save the anchor.
|
FailureTooBright | Result.Failure_SpaceTooBright |
Too bright.
The environment is too bright to save the anchor.
|
FailureUnsupported | Result.Failure_Unsupported |
Save is not supported.
|
FailurePersistenceNotEnabled | Result.Failure_SpaceComponentNotEnabled |
Persistence not enabled.
One or more anchors do not have the OVRStorable component enabled.
|
| Member | Value | Description |
|---|---|---|
Success | Result.Success |
The operation succeeded.
|
Failure | Result.Failure |
The operation failed.
|
FailureInvalidAnchor | Result.Failure_HandleInvalid |
At least one anchor is invalid.
|
FailureDataIsInvalid | Result.Failure_DataIsInvalid |
Invalid data.
|
FailureInsufficientResources | Result.Failure_SpaceInsufficientResources |
Resource limitation prevented this operation from executing.
Recommend retrying, perhaps after a short delay and/or reducing memory consumption.
|
FailurePermissionInsufficient | Result.Failure_SpacePermissionInsufficient |
Insufficient permission.
Recommend confirming the status of the required permissions needed for using anchor APIs.
|
FailureRateLimited | Result.Failure_SpaceRateLimited |
Operation canceled due to rate limiting.
Recommend retrying after a short delay.
|
FailureUnsupported | Result.Failure_Unsupported |
Erase is not supported.
|
FailurePersistenceNotEnabled | Result.Failure_SpaceComponentNotEnabled |
Persistence not enabled.
One or more anchors do not have the OVRStorable component enabled.
|
| Member | Value | Description |
|---|---|---|
Success | Result.Success |
The operation succeeded.
|
Failure | Result.Failure |
The operation failed.
|
FailureDataIsInvalid | Result.Failure_DataIsInvalid |
Invalid data.
|
FailureInvalidOption | Result.Failure_InvalidParameter |
One of the FetchOptions was invalid.
This can happen, for example, if you query for an invalid component type.
|
FailureInsufficientResources | Result.Failure_SpaceInsufficientResources |
Resource limitation prevented this operation from executing.
Recommend retrying, perhaps after a short delay and/or reducing memory consumption.
|
FailureInsufficientView | Result.Failure_SpaceInsufficientView |
Insufficient view.
The user needs to look around the environment more for anchor tracking to function.
|
FailurePermissionInsufficient | Result.Failure_SpacePermissionInsufficient |
Insufficient permission.
Recommend confirming the status of the required permissions needed for using anchor APIs.
|
FailureRateLimited | Result.Failure_SpaceRateLimited |
Operation canceled due to rate limiting.
Recommend retrying after a short delay.
|
FailureTooDark | Result.Failure_SpaceTooDark |
Too dark.
The environment is too dark to load anchors.
|
FailureTooBright | Result.Failure_SpaceTooBright |
Too bright.
The environment is too bright to load anchors.
|
FailureUnsupported | Result.Failure_Unsupported |
Fetch is not supported.
|
| Member | Value | Description |
|---|---|---|
Success | Result.Success |
The operation succeeded.
|
Failure | Result.Failure |
The operation failed.
|
FailureHandleInvalid | Result.Failure_HandleInvalid |
Invalid handle.
|
FailureDataIsInvalid | Result.Failure_DataIsInvalid |
Invalid data.
|
FailureNetworkTimeout | Result.Failure_SpaceNetworkTimeout |
A network timeout occurred.
Recommend ensuring network speed is sufficient.
|
FailureNetworkRequestFailed | Result.Failure_SpaceNetworkRequestFailed |
Network request failed.
Recommend ensuring network connectivity.
|
FailureMappingInsufficient | Result.Failure_SpaceMappingInsufficient |
The device has not built a sufficient map of the environment to share the anchor(s).
Recommend further exploration the space around the anchors to be shared.
|
FailureLocalizationFailed | Result.Failure_SpaceLocalizationFailed |
The device was not able to localize the anchor(s) being shared.
|
FailureSharableComponentNotEnabled | Result.Failure_SpaceComponentNotEnabled |
Sharable component not enabled on the anchor(s) being shared.
Make sure that the OVRSharable component has been added and enabled on this anchor before attempting to share.
|
FailureCloudStorageDisabled | Result.Failure_SpaceCloudStorageDisabled |
Sharing failed because device has not enabled the Share Point Cloud Data setting.
Recommend informing the end user that this permission must be set via the system settings.
|
FailureUnsupported | Result.Failure_Unsupported |
Anchor Sharing is not supported.
|