# UAndroidXRSpatialAnchorsSubsystem

`#include <AndroidXRSpatialAnchorsSubsystem.h>`

The Spatial Anchors subsystem.

<br />

## Summary

### Inheritance

Inherits from: [`UAndroidXRSpatialEntitiesSubsystem`](https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialEntitiesSubsystem)

| ### Public attributes ||
|---|---|
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#onanchoradded {}` | `FAnchorPersistOperationDelegate` The callback for when the runtime detects anchors in the environment (when loading persisted anchors for example) |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#onanchorremoved {}` | `FAnchorPersistOperationDelegate` The callback for when the runtime removes tracked anchors from the environment (when loading persisted anchors for example) |

| ### Public functions ||
|---|---|
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#createspatialanchor(const FTransform & AnchorTransform, https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorEntity#class_u_android_x_r_spatial_anchor_entity *& CreatedAnchor)` | `bool` Creates a spatial anchor at the specified transform. |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#destroyspatialanchor(https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorEntity#class_u_android_x_r_spatial_anchor_entity *AnchorToDestroy)` | `bool` Destroys a spatial anchor. |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#loadpersistedanchors()` | `bool` Loads persistent anchors. |

| ### Protected functions ||
|---|---|
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#bindentityevents() override` | `virtual void` |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#getcapabilitymodule() override` | `virtual https://developer.android.com/develop/xr/unreal/reference/class/FAndroidXRSpatialCapabilityModule#class_f_android_x_r_spatial_capability_module *` |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#getrequiredpermissions(TArray< FString > & Permissions) override` | `virtual void` |
| `https://developer.android.com/develop/xr/unreal/reference/class/UAndroidXRSpatialAnchorsSubsystem#unbindentityevents() override` | `virtual void` |

## Public attributes

### OnAnchorAdded

```
FAnchorPersistOperationDelegate OnAnchorAdded {}
```
The callback for when the runtime detects anchors in the environment (when loading persisted anchors for example)

### OnAnchorRemoved

```
FAnchorPersistOperationDelegate OnAnchorRemoved {}
```
The callback for when the runtime removes tracked anchors from the environment (when loading persisted anchors for example)

## Public functions

### CreateSpatialAnchor

```
bool CreateSpatialAnchor(
  const FTransform & AnchorTransform,
  UAndroidXRSpatialAnchorEntity *& CreatedAnchor
)
```
Creates a spatial anchor at the specified transform.

<br />

Details Parameters `The` transform at which to create the anchor `The` created anchor **Returns** Whether the underlying API call was successful

### DestroySpatialAnchor

```
bool DestroySpatialAnchor(
  UAndroidXRSpatialAnchorEntity *AnchorToDestroy
)
```
Destroys a spatial anchor.

<br />

Details Parameters `The` anchor to destroy **Returns** Whether the underlying API call was successful

### LoadPersistedAnchors

```
bool LoadPersistedAnchors()
```
Loads persistent anchors.

The callbacks of OnAnchorAdded will be fired for the loaded anchors

## Protected functions

### BindEntityEvents

```
virtual void BindEntityEvents() override
```

### GetCapabilityModule

```
virtual FAndroidXRSpatialCapabilityModule * GetCapabilityModule() override
```

### GetRequiredPermissions

```
virtual void GetRequiredPermissions(
  TArray< FString > & Permissions
) override
```

### UnbindEntityEvents

```
virtual void UnbindEntityEvents() override
```