This page describes how to enable ARCore functionality in your Unity projects. To do this, you need to:
Import the ARCore SDK for Unity
Download the ARCore SDK for Unity and import it into your project by clicking the menu Assets > Import package > Custom Package.
In Unity's Project window, you should see the both the SDK files and the HelloAR sample app in
Configure your app to be AR Required or AR Optional
There are two ways to enable ARCore in your app: AR Required and AR Optional. If you need help deciding which one to choose, see Publish AR Apps in the Play Store.
AR Required means that your app is not usable without AR. The Play Store ensures that AR Required apps are only made available to devices that support ARCore. When users install an AR Required app, the Play Store does automatically installs ARCore before installing the app.
To make an app AR Required, make sure the Edit > Project Settings > ARCore > ARCore Required menu item is checked as shown below. It is checked by default.
Your app will automatically perform runtime checks to make sure that the device supports ARCore and has it installed. If ARCore is not installed (possibly because it was removed by the user) or the version is too old, your app will prompt the user to install or update. If the install or update fails, possibly due to network failure, then
Session.Status will return an error, and your app should handle the error and quit.
AR Optional means that your app includes one or more AR features that are activated if the device supports ARCore. However, the app can be installed and run on devices that don't support ARCore. When users install an AR Optional app, the Play Store does not automatically install ARCore.
To make an app AR Optional, uncheck the Edit > Project Settings > ARCore > ARCore Required menu item.
In your app, you'll need to call
Session.CheckApkAvailability() to check whether ARCore is supported on the device, and if supported, whether ARCore is installed. Your app should handle the following three cases:
- If ARCore is not supported, your app should hide AR related functionality.
- If ARCore is supported, but either not installed or too old, you can prompt the user to install or update by calling
- If ARCore is supported and installed, you can create a
Sessionand start ARCore.
Read the code in the sample app and ARCore for Unity API reference.