Stay organized with collections
Save and categorize content based on your preferences.
ARGeospatialAnchor
The ARGeospatialAnchor 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 created at the specified geodetic location and orientation relative to the Earth.
When the game object containing the ARGeospatialAnchor component is destroyed, the underlying native object will be detached and the resource will be released.
Gets the TrackingState associated with this Geospatial Anchor.
Public functions
OnDestroy
voidOnDestroy()
When the game object containing the ARGeospatialAnchor component is destroyed, the underlying native object will be detached and the resource will be released.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-14 UTC."],[[["\u003cp\u003eARGeospatialAnchor is an ARCore Extensions object that anchors game objects to specific real-world locations using geodetic coordinates.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits functionalities from MonoBehaviour and ITrackable, providing properties like pose, tracking state, and native pointer access.\u003c/p\u003e\n"],["\u003cp\u003eARGeospatialAnchor offers properties for accessing its pose, tracking state, and native pointer, along with methods for handling its lifecycle and updates within the Unity environment.\u003c/p\u003e\n"],["\u003cp\u003eTerrain anchor resolution using the terrainAnchorState property is deprecated; developers should use asynchronous methods and promises for this purpose.\u003c/p\u003e\n"]]],["The ARGeospatialAnchor, an ARCore Extensions object, anchors game objects at specific geodetic locations and orientations. It inherits from MonoBehaviour and ITrackable, providing properties like `nativePtr`, `pose`, `trackableId`, and `trackingState` to manage the anchor's information and status. The `terrainAnchorState` is deprecated. Key actions include `OnDestroy`, which detaches the native object and releases resources when the component's game object is destroyed, and `Update`, which is Unity's update method for this object.\n"],null,["# ARGeospatialAnchor Class Reference\n\nARGeospatialAnchor\n==================\n\nThe [ARGeospatialAnchor](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARGeospatialAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARGeospatialAnchor) is an ARCore Extensions object that provides a similar service to AR Foundation's `ARAnchor` as an anchor for game objects in your scene.\n\nIt is created at the specified geodetic location and orientation relative to the Earth.\n\nSummary\n-------\n\n### Inheritance\n\nInherits 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)\n\n| ### Properties ||\n|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [nativePtr](#nativeptr) | [IntPtr](https://docs.microsoft.com/en-us/dotnet/api/System.IntPtr) Gets the native pointer that represents this Geospatial Anchor. |\n| [pose](#pose) | [Pose](https://docs.unity3d.com/ScriptReference/Pose.html) Gets the `Pose` associated with this Geospatial Anchor. |\n| [terrainAnchorState](#terrainanchorstate) | [TerrainAnchorState](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#terrainanchorstate) **[Deprecated.](/ar/reference/unity-arf/deprecated/deprecated)** When resolving a Terrain anchor using an async method, get the result status from the Promise object. Gets the `TerrainAnchorState` associated with this Terrain anchor. |\n| [trackableId](#trackableid) | [TrackableId](https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.TrackableId.html) Gets the `TrackableId` associated with this Geospatial Anchor. |\n| [trackingState](#trackingstate) | [TrackingState](https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.TrackingState.html) Gets the `TrackingState` associated with this Geospatial Anchor. |\n\n| ### Public functions ||\n|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [OnDestroy](#ondestroy)`()` | `void` When the game object containing the [ARGeospatialAnchor](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARGeospatialAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARGeospatialAnchor) component is destroyed, the underlying native object will be detached and the resource will be released. |\n| [Update](#update)`()` | `void` Unity's Update method. |\n\nProperties\n----------\n\n### nativePtr\n\n```c#\nIntPtr nativePtr\n``` \nGets the native pointer that represents this Geospatial Anchor. \n\n### pose\n\n```c#\nPose pose\n``` \nGets the `Pose` associated with this Geospatial Anchor. \n\n### terrainAnchorState\n\n```c#\nTerrainAnchorState terrainAnchorState\n``` \nGets the `TerrainAnchorState` associated with this Terrain anchor.\n\n**[Deprecated.](/ar/reference/unity-arf/deprecated/deprecated)**When resolving a Terrain anchor using an async method, get the result status from the Promise object. \n\n### trackableId\n\n```c#\nTrackableId trackableId\n``` \nGets the `TrackableId` associated with this Geospatial Anchor. \n\n### trackingState\n\n```c#\nTrackingState trackingState\n``` \nGets the `TrackingState` associated with this Geospatial Anchor.\n\nPublic functions\n----------------\n\n### OnDestroy\n\n```c#\nvoid OnDestroy()\n``` \nWhen the game object containing the [ARGeospatialAnchor](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARGeospatialAnchor#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARGeospatialAnchor) component is destroyed, the underlying native object will be detached and the resource will be released. \n\n### Update\n\n```c#\nvoid Update()\n``` \nUnity's Update method."]]