Setting up your development environment
Install the Android SDK version 7.0 (API Level 24) or higher.
You will need to get the ARCore SDK for Unity. You can either:
Download the SDK Preview for Unity and extract it.
Clone the repository with the following command:
git clone https://github.com/google-ar/arcore-unity-sdk.git
You will need a supported Android device.
Prepare your device
You must use a supported, physical device. ARCore does not support virtual devices such as the Android Emulator. To prepare your device:
- Enable developer options
- Enable USB debugging
- Install the ARCore Service on the device:
Create a new project
In Unity, select File > New Project.
Name your project HelloAR, leave 3D mode selected, and click Create Project.
Import the SDK
arcore-unity-sdk-preview.unitypackage by clicking the menu Assets > Import package > Custom Package and import everything in the Unity package.
In the Unity's Project window, you can see the both the Unity SDK files and the HelloAR sample app.
Configure the build settings
Open the Build Settings window by clicking File > Build settings.
Then, change the following settings:
- Change the target platform to Android and click Switch Platform.
- Click Player Settings to open the Android Player Settings. Then change the following settings:
- Other Settings > Multithreaded Rendering: Off
- Other Settings > Package Name: a unique app ID that looks like a Java package name, such as
- Other Settings > Minimum API Level: Android 7.0 or higher
- Other Settings > Target API Level: Android 7.0 or 7.1
- XR Settings > ARCore Supported: On
- The Scenes in Build lists the scenes from your project that will be included in your build. Add the scene from the HelloAR sample app to the build as follows:
- Locate the scene in the Project window under Assets > GoogleARCore > HelloARExample > Scenes.
- Click the scene and drop it on Scenes in Build.
Build and run the sample app
Make sure your device is connected to your machine and then click Build and Run. Unity builds your project into an Android APK, installs it on the device, and launches it.
As you move your device, the app automatically detects flat surfaces and draws a diamond grid. Tap the grid to place an Android robot on the surface.
Read the code in the sample app and ARCore for Unity API reference.