iOS をターゲットとする Unity(AR Foundation)アプリで Geospatial API を有効にする
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Geospatial API を使用できるようにアプリの設定を構成します。
前提条件
続行する前に、基本的な AR コンセプトと ARCore セッションを構成する方法を理解してください。
Geospatial API の詳細については、Geospatial API の概要をご覧ください。
ARCore を使った開発を初めて行う場合は、スタートガイドで、ソフトウェアとハードウェアの要件、前提条件、使用しているプラットフォームに固有の情報を確認してください。
ARCore Geospatial API を使用するには、プロジェクトが AR Foundation と AR Foundation 用の ARCore Extensions をサポートしている必要があります。
ARCore API を有効にする
アプリで Visual Positioning System(VPS)を使用する前に、新しい Google Cloud プロジェクトまたは既存の Google Cloud プロジェクトで ARCore API を有効にする必要があります。このサービスは、地理空間アンカーのホスト、保存、解決を行います。
キーレス認証が推奨されますが、API キー認証もサポートされています。
必要なライブラリをアプリに追加する
ARCore API を呼び出すようにアプリを承認したら、ライブラリを追加してアプリで地理空間機能を有効にする必要があります。
- [Edit] > [Project Settings] > [XR Plug-In Management] > [ARCore Extensions] に移動します。[iOS サポートを有効にする] が選択されていることを確認します。
- [オプション機能] で [Geospatial] を選択します。

セッション構成でジオ空間機能を有効にする
アプリでジオ空間機能を有効にしたら、アプリの AR セッション構成でジオ空間機能を有効にして、ARCore API と通信できるようにします。
- プロジェクトの Assets フォルダに ARCoreExtensionsConfig スクリプト可能オブジェクトが含まれていることを確認します。作成するには、[アセット] ペインで右クリックし、[作成] > [XR] > [ARCore Extensions Config] を選択します。
Assets フォルダで ARCoreExtensionsConfig スクリプト可能オブジェクトを選択し、[Geospatial Mode] を [Enabled] に設定します。

ARCoreExtensionsConfig 構成を使用するように ARCore Extensions ゲーム オブジェクトを構成します。[Hierarchy] ペインで、ARCore Extensions の初期設定時に作成した ARCore Extensions ゲーム オブジェクトを見つけ、[ARCore Extensions Config] フィールドを Assets フォルダの ARCoreExtensionsConfig スクリプト可能オブジェクトに接続します。

デバイスデータの使用を許可するようユーザーに求める
ARCore Geospatial API を使用するアプリは、デバイスのデータの使用を承認して許可するようユーザーにプロンプトを表示する必要があります。詳しくは、ユーザーのプライバシー要件をご覧ください。
デバイスの互換性を確認する
ARCore をサポートするすべてのデバイスが Geospatial API をサポートしているわけではありません。お客様のデバイスの互換性を確認するには、AREarthManager.IsGeospatialModeSupported()
を呼び出します。FeatureSupported.Unsupported
が返された場合は、セッションの構成を試行しないでください。
実行時にユーザーに位置情報の利用許可をリクエストする
ランタイム権限リクエストをトリガーするスクリプトで Unity のロケーション サービスを有効にするには、次の操作を行います。
Project Settings > iOS > Other Settings > Location Usage Description に、権限をリクエストしているアプリの名前を入力します。
次のように、Unity の位置情報サービスを有効にして、ランタイム権限リクエストをトリガーします。
public void OnEnable()
{
Input.location.Start();
}
public void OnDisable()
{
Input.location.Stop();
}
詳しくは、Unity の LocationService
のドキュメントをご覧ください。
デバイスの現在地でジオスペースの提供状況を確認する
Geospatial API は VPS と GPS を組み合わせてジオ空間ポーズを決定するため、デバイスが位置情報を特定できる限り、この API を使用できます。屋内や人口密集地など、GPS の精度が低い地域では、API は VPS のカバレッジに基づいて高精度の姿勢を生成します。一般的な条件下では、VPS の位置精度は約 5 メートル、回転精度は 5 度と見込まれます。AREarthManager.CheckVpsAvailability()
を使用して、特定の場所が VPS の対象かどうかを判断します。
Geospatial API は、VPS がカバーしていない地域でも使用できます。屋外で上部に遮蔽物がほとんどない環境では、GPS だけでも高い精度でポーズを生成できる場合があります。
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-14 UTC。
[null,null,["最終更新日 2025-07-14 UTC。"],[[["\u003cp\u003eConfigure your app to use the Geospatial API by enabling the ARCore API and adding required libraries.\u003c/p\u003e\n"],["\u003cp\u003eEnable Geospatial capabilities in your AR session configuration using the ARCoreExtensionsConfig scriptable object.\u003c/p\u003e\n"],["\u003cp\u003eEnsure user privacy by prompting users to allow usage of device data and requesting location permissions at runtime.\u003c/p\u003e\n"],["\u003cp\u003eConfirm device and location compatibility by checking for Geospatial API support and VPS availability.\u003c/p\u003e\n"]]],[],null,["# Enable the Geospatial API for your Unity (AR Foundation) app targeting iOS\n\nConfigure your app's settings so that it can use the [Geospatial API](/ar/develop/geospatial).\n\nPrerequisites\n-------------\n\nMake sure that you understand [fundamental AR concepts](/ar/develop/fundamentals)\nand how to [configure an ARCore session](/ar/develop/unity-arf/session-config) before proceeding.\n\nSee the\n[Introduction to the Geospatial API](/ar/develop/geospatial) for more\ninformation about the Geospatial API.\n\nIf you're new to developing with ARCore, see [Getting started](/ar/develop/getting-started)\nfor information about software and hardware requirements, prerequisities and\nother information specific to the platforms you are using.\n\nTo use the ARCore Geospatial API, your project must support\n[AR Foundation](/ar/develop/unity-arf/getting-started-ar-foundation#requirements)\nand the [ARCore Extensions for AR Foundation](/ar/develop/unity-arf/getting-started-extensions).\n\nEnable the ARCore API\n---------------------\n\nBefore using the Visual Positioning System (VPS) in your app, you must first\nenable the [**ARCore API**](/ar/develop/authorization?platform=unity-arf-ios)\nin a new or existing Google Cloud project. This service is responsible for\nhosting, storing, and resolving Geospatial anchors.\n\nKeyless authorization is preferred, but API Key authorization is also supported.\n\nAdd required libraries to your app\n----------------------------------\n\nAfter authorizing your app to call the ARCore API, you must add libraries to\nenable Geospatial features in your app.\n\n1. Navigate to **Edit** \\\u003e **Project Settings** \\\u003e **XR Plug-In Management** \\\u003e **ARCore Extensions** . Make sure that **iOS Support Enabled** is selected.\n2. Under **Optional Features** , select **Geospatial**.\n\nEnable Geospatial capabilities in the session configuration\n-----------------------------------------------------------\n\nOnce Geospatial functionality has been enabled in your app, enable Geospatial capabilities in your app's [AR session configuration](/ar/develop/unity-arf/session-config) so that it can communicate with the ARCore API:\n\n1. Ensure that the project **Assets** folder contains an **ARCoreExtensionsConfig** scriptable object. To create one, right-click in the **Assets** pane and select **Create** \\\u003e **XR** \\\u003e **ARCore Extensions Config**.\n2. Select the **ARCoreExtensionsConfig** scriptable object in your **Assets** folder and set the **Geospatial Mode** to **Enabled**.\n\n3. Configure the **ARCore Extensions** game object to use the **ARCoreExtensionsConfig** configuration. In the **Hierarchy** pane, locate the **ARCore Extensions** game object you created when you initially set up ARCore Extensions, and connect the **ARCore Extensions Config** field to the **ARCoreExtensionsConfig** scriptable object in your **Assets** folder.\n\nPrompt user to allow usage of device data\n-----------------------------------------\n\nApps that use the ARCore Geospatial API must present the user with a prompt to\nacknowledge and allow the use of data from their device. See\n[User privacy requirements](/ar/develop/privacy-requirements) for more\ninformation.\n\nCheck device compatibility\n--------------------------\n\nNot all devices that support ARCore also support the Geospatial API. To check\nthe user's device for compatibility, call\n[`AREarthManager.IsGeospatialModeSupported()`](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#isgeospatialmodesupported).\nIf this returns `FeatureSupported.Unsupported` do not attempt to configure the\nsession.\n\nAsk user for location permissions at runtime\n--------------------------------------------\n\nTo enable Unity's location services in a script that triggers the runtime\npermission requests, do the following:\n\n1. In **Project Settings \\\u003e iOS \\\u003e Other Settings \\\u003e Location Usage Description**,\n enter the name of the app that is requesting permissions.\n\n2. Enable Unity's location services to trigger the runtime\n permission request, as follows:\n\n public void OnEnable()\n {\n Input.location.Start();\n }\n\n public void OnDisable()\n {\n Input.location.Stop();\n }\n\n See Unity's\n [`LocationService`](https://docs.unity3d.com/ScriptReference/LocationService.html)\n documentation for more information.\n\nCheck Geospatial availability at the device's current location\n--------------------------------------------------------------\n\nBecause the Geospatial API uses a combination of [VPS](/ar/develop/geospatial#global_localization_with_vps) and GPS to determine a Geospatial pose, the API can be used as long as the device is able to determine its location. In areas with low GPS accuracy, such as indoor spaces and dense urban environments, the API will rely on VPS coverage to generate high accuracy poses. Under typical conditions, VPS can be expected to provide positional accuracy of approximately 5 meters, and rotational accuracy of 5 degrees. Use [`AREarthManager.CheckVpsAvailability()`](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailability) to determine if a given location has VPS coverage.\n\nThe Geospatial API can also be used in areas that do not have VPS coverage. In outdoor environments with few or no overhead obstructions, GPS may be sufficient to generate a pose with high accuracy.\n\nWhat's next\n-----------\n\n- [Obtain the device camera's Geospatial pose](/ar/develop/unity-arf/geospatial/obtain-device-pose) to determine the exact location of the user's device in the real world.\n- [Check VPS availability](/ar/develop/unity-arf/geospatial/check-vps-availability) at a device's given location."]]