Getting started with ARCore Extensions for AR Foundation

Stay organized with collections Save and categorize content based on your preferences.

The optional ARCore Extensions for AR Foundation package adds functionality to Unity’s AR Foundation package, enabling you to use features such as Cloud Anchors, camera configuration filters, and Recording and Playback in your app.

Requirements

To develop with ARCore Extensions for AR Foundation, you will need the following:

Android

Hardware

  • An ARCore supported Android device
  • A USB cable for connecting your device to your development machine

Software

iOS

Hardware

Software

Install the ARCore Extensions package

Follow these steps to install ARCore Extensions for AR Foundation.

Bundled dependencies

  1. Make sure that you have AR Foundation installed and configured in your development environment.
  2. Open or create a new Unity project.
  3. Select the desired target build platform:
    1. From the File menu, select Build Settings.
    2. Select Android or iOS, depending on the desired target platform.
    3. Click Switch Platform.
  4. Import the latest ARCore Extensions package:

    1. Navigate to Window > Package Manager.
    2. Click the button and choose the Add package from git URL... option from the drop-down menu.

    1. Paste the following URL into the text field:
    https://github.com/google-ar/arcore-unity-extensions.git
    
    1. Click Add.

Without EDM4U

By default, ARCore Extensions is bundled with additional dependencies. When using other libraries (for example, Firebase Analytics) that depend on a different version of External Dependency Manager for Unity, undefined behavior may occur, causing dependents to stop working correctly.

Install ARCore Extensions without bundled dependencies to prevent library versioning conflicts:

  1. Download the ARCore Extensions without EDM4U release and com.google.external-dependency-manager,
  2. Follow instructions on importing UPM packages with .tgz files, installing packages in the following order:
    1. com.google.external-dependency-manager,
    2. ARCore Extensions (without EDM4U).

When installing ARCore Extensions, Unity will also automatically install a suitable version of the required dependencies:

  • AR Foundation
  • ARCore XR Plugin (used when targeting Android)
  • ARKit XR Plugin (used when targeting iOS)

These dependencies might not be visible in the Package Manager > Package: In project view. However, the packages can be seen in the Project window under Packages

Set up ARCore Extensions

  1. In the Hierarchy pane, right-click and add the following game objects (if not already added):

    • XR > AR Session
    • XR > AR Session Origin
    • XR > ARCore Extensions
  2. In the Hierarchy pane, select the ARCore Extensions package.

  3. In the Inspector pane, for each of the following fields, click the target button, and connect each field with its corresponding game object, as follows:

    • Session: Use your scene's AR Session.
    • Session Origin: Use your scene's AR Session Origin.
    • Camera Manager: Use your scene's AR Camera.
  4. Optionally, create and connect the following assets for Cloud Anchors and camera config filters.

    1. In the Project > Assets pane, right-click, select Create > XR > ARCore Extensions Config.

    2. In the Project > Assets pane, right-click, select Create > XR > Camera Config Filter.

    3. In the Hierarchy pane, select the ARCore Extensions package.

    4. In the Inspector pane's ARCore Extensions Config field, click the target button, and connect to the ARCoreExtensionsConfig asset.

    5. In the Inspector pane's Camera Config Filter field, click the target button, and connect to the ARCoreExtensionsCameraConfigFilter asset.

      To learn more, see the Unity (AR Foundation) Cloud Anchors developer's guide for Android or iOS, and the guide to Configuring the camera.

With all of the above ARCore Extensions fields connected appropriately, your ARCore Extensions Inspector pane looks like this:

See Unity's guide to editing properties for more information about setting up properties.

Sample projects

Bundled with ARCore Extensions for AR Foundation are sample projects that you may use to get started with building your own projects.

  1. From the Window menu, open the Package Manager and select the ARCore Extensions package.

  2. Under Samples, click Import for the sample project, described below.

The following sample projects are imported from the GitHub repository:

  • Geospatial (Android only) - Create AR experiences on a global scale, and remotely attach content to any area covered by Google Street View. See the Geospatial API introduction for more information.

  • PersistentCloudAnchors (Android and iOS) - Create persistent AR experiences in the real world with interactive layers of digital information anchored to actual locations, and design experiences that can be shared over time by multiple people across many different devices. See the Cloud Anchors introduction for more information.

What's next

With ARCore Extensions for AR Foundation, you can now use Cloud Anchors and camera configurations in your apps.