# ARCloudAnchor

The `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCloudAnchor` is an ARCore Extensions object that provides a similar service to AR Foundation's `ARAnchor` as an anchor for game objects in your scene.

It is backed by an ARCore Cloud Anchor to synchronize pose data across multiple devices.

## Summary

### Inheritance

Inherits from: [`UnityEngine::MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html), [`UnityEngine::XR::ARSubsystems::ITrackable`](https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.ITrackable.html)

| ### Properties ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#cloudanchorid` | `string` **[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** When hosting an anchor using an async method, get the Cloud Anchor ID from the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/HostCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1HostCloudAnchorResult` object. This will always return the empty string or null, except for anchors created by deprecated methods. Gets the Cloud Anchor Id associated with this Cloud Anchor. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#cloudanchorstate` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#cloudanchorstate` **[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** When hosting or resolving an anchor using an async method, get the result status from the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/HostCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1HostCloudAnchorResult` or `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ResolveCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ResolveCloudAnchorResult` object. This will always return `CloudAnchorState.None`, except for anchors created by deprecated methods. Gets the `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#cloudanchorstate` associated with this Cloud Anchor. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#nativeptr` | `https://docs.microsoft.com/en-us/dotnet/api/System.IntPtr` Gets the native pointer that represents this Cloud Anchor. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#pose` | `https://docs.unity3d.com/ScriptReference/Pose.html` Gets the `Pose` associated with this Cloud Anchor. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#trackableid` | `https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.TrackableId.html` Gets the `TrackableId` associated with this Cloud Anchor. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#trackingstate` | `https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.TrackingState.html` Gets the `TrackingState` associated with this Cloud Anchor. |

| ### Public functions ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#ondestroy()` | `void` When the game object containing the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCloudAnchor` component is destroyed, the underlying native Cloud Anchor object will be detached and the resource will be released. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#update()` | `void` Unity Update method. |

## Properties

### cloudAnchorId

```c#
string cloudAnchorId
```
Gets the Cloud Anchor Id associated with this Cloud Anchor.

For newly created points the Id will be an empty string until the Cloud Anchor is in the `CloudAnchorState.Success` state. This Id is provided on the device hosting the Cloud Anchor, and is used to resolve a corresponding Cloud Anchor on other devices. See `ARAnchorManagerExtensions.ResolveCloudAnchorId(
UnityEngine.XR.ARFoundation.ARAnchorManager, string)` for more information.

**[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** When hosting an anchor using an async method, get the Cloud Anchor ID from the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/HostCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1HostCloudAnchorResult` object. This will always return the empty string or null, except for anchors created by deprecated methods.

### cloudAnchorState

```c#
CloudAnchorState cloudAnchorState
```
Gets the `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#cloudanchorstate` associated with this Cloud Anchor.

**[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** When hosting or resolving an anchor using an async method, get the result status from the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/HostCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1HostCloudAnchorResult` or `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ResolveCloudAnchorResult#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ResolveCloudAnchorResult` object. This will always return `CloudAnchorState.None`, except for anchors created by deprecated methods.

### nativePtr

```c#
IntPtr nativePtr
```
Gets the native pointer that represents this Cloud Anchor.

### pose

```c#
Pose pose
```
Gets the `Pose` associated with this Cloud Anchor.

### trackableId

```c#
TrackableId trackableId
```
Gets the `TrackableId` associated with this Cloud Anchor.

### trackingState

```c#
TrackingState trackingState
```
Gets the `TrackingState` associated with this Cloud Anchor.

## Public functions

### OnDestroy

```c#
void OnDestroy()
```
When the game object containing the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCloudAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARCloudAnchor` component is destroyed, the underlying native Cloud Anchor object will be detached and the resource will be released.

### Update

```c#
void Update()
```
Unity Update method.