# SpatialShareableAnchorFeature

Enables AR Foundation shareable anchor support via OpenXR Spatial Entities extensions.

## Summary

### Inheritance

Inherits from: `AndroidXRSpatialEntityFeature`, [`Google.XR.Extensions.IXRSpatialSdk`](https://developer.android.com/develop/xr/unity/reference/interface/Google/XR/Extensions/IXRSpatialSdk)

| ### Public attributes ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#extensionstrings = Constants.ANDROID_geospatial + " " + Constants.ANDROID_geospatial_anchor + " " + Constants.EXT_future + " " + Constants.EXT_spatial_entity + " " + Constants.EXT_spatial_anchor + " " + Constants.EXT_spatial_persistence + " " + Constants.EXT_spatial_persistence_operations` | `const string` The OpenXR Extension string. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#featureid = "com.google.xr.extensions.spatialentities.shareable_anchor"` | `const string` The feature ID string. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#uiname = "Spatial Entities (Extensions): Shareable Anchors"` | `const string` The UI name shows on the XR Plug-in Management panel, helps users to understand validation errors and expected fixes. |

| ### Public static attributes ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#requiredpermission = AndroidXRPermission.SceneUnderstandingCoarse` | `readonly https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#androidxrpermission` Runtime permission required to enable shareable anchors. |

| ### Properties ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#enablegeospatialhost` | `bool` Editor helper to enable or disable the geospatial host from scripts. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#isanchorextensionenabled` | `static bool` Gets if the basic anchor support is enabled. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#isgeospatialhostsupported` | `static bool` Gets if the required extension for [XRShareableAnchorHosts.Geospatial](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrshareableanchorhosts_geospatial) is enabled and supported. |

| ### Public functions ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/SpatialEntities/SpatialShareableAnchorFeature#gettargetversion()` | `https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrspatialsdkversions` Gets the target version of the given feature if applicable. |

## Public attributes

### ExtensionStrings

```c#
const string ExtensionStrings =
            Constants.ANDROID_geospatial + " " +
            Constants.ANDROID_geospatial_anchor + " " +
            Constants.EXT_future + " " +
            Constants.EXT_spatial_entity + " " +
            Constants.EXT_spatial_anchor + " " +
            Constants.EXT_spatial_persistence + " " +
            Constants.EXT_spatial_persistence_operations
```
The OpenXR Extension string.

Used to check if these extensions are available or enabled.

### FeatureId

```c#
const string FeatureId =
            "com.google.xr.extensions.spatialentities.shareable_anchor"
```
The feature ID string.

### UiName

```c#
const string UiName = "Spatial Entities (Extensions): Shareable Anchors"
```
The UI name shows on the XR Plug-in Management panel, helps users to understand validation errors and expected fixes.

## Public static attributes

### RequiredPermission

```c#
readonly AndroidXRPermission RequiredPermission =
            AndroidXRPermission.SceneUnderstandingCoarse
```
Runtime permission required to enable shareable anchors.

## Properties

### EnableGeospatialHost

```c#
bool EnableGeospatialHost
```
Editor helper to enable or disable the geospatial host from scripts.

### IsAnchorExtensionEnabled

```c#
static bool IsAnchorExtensionEnabled
```
Gets if the basic anchor support is enabled.

When OpenXR runtime is waiting, it returns `null`. Otherwise, it indicates whether spatial anchor and relevant extensions are available at runtime.

### IsGeospatialHostSupported

```c#
static bool IsGeospatialHostSupported
```
Gets if the required extension for [XRShareableAnchorHosts.Geospatial](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrshareableanchorhosts_geospatial) is enabled and supported.

## Public functions

### GetTargetVersion

```c#
XRSpatialSdkVersions GetTargetVersion()
```
Gets the target version of the given feature if applicable.


| Details ||
|---|---|
| **Returns** | The target version to meet feature requirements. |