Project 3: Barrel Bouncer AR Edition

Part 1: Configuring Your Project for AR

In this section, you’ll be configuring your Unity project for mobile AR development. This will involve modifying project settings as well as installing the XR development tools that you will use to build your app. Note that we will be testing your submission on Android phones, so you are only required to configure the project for ARCore development. However, if you plan on testing the app on your own iOS device, you should set the appropriate iOS and ARKit settings as well. Instructions for both have been included below.

NOTE: For this project, you will be building on top of a copy of your completed project 1c, NOT your project 2. If you do not have a copy of this, you may download your submission on ELMS and then open it up in Unity. If you do it this way, it you should select the correct Target Platform within the Unity Hub before opening it in order to save you time.

General Project Settings

Build Settings

Open up your Build Settings, and make sure to switch the target platform to either iOS or Android, depending on what platform you will be testing on. Additionally, you can uncheck all of the scenes in the build for the time being.

Player Settings

Open up your Player Settings and set them to the values listed below.

Common

While most Player Settings in Unity are platform-specific, there are a few settings that are shared between multiple platforms. Changing one of these settings when you’re on one platform’s tab will automatically set the same setting for the other platform’s as well.

Android-Specific

Since you are required to submit an .apk file to us, you should make sure to adjust the following settings while the Android tab is selected in your Player Settings.

iOS-Specific

If you would like to test your project on an iOS device, you should also make sure to adjust the following settings while the iOS tab is selected in your Player Settings.

XR Plugin Management

As you should now be familiar with from project 2, the XR Plugin Management tools are used to install and load the plugins for the XR platforms you would like your application to support. Follow the steps below to add them

  1. Open up the Project Settings window by navigating to Edit -> Project Settings from the menu bar at the top.
  2. Click on the XR Plugin Management tab on the left sidebar and then click on the Install XR Plugin Management button that appears near the center of the window.
  3. Make sure that you have the Android tab selected, and then select the checkbox for ARCore.
  4. (Optional) If you would also like to build your application to an iOS device, click on the iOS tab, and then then select the checkbox for ARKit.

Installing Packages via the Package Manager

Unity works on a large number of features and tools for a wide, diverse set of use cases. However, not everyone needs all of these tools for every single project. Additionally, the Unity Editor itself is already a fairly large and intensive program to run on computers. As a result, many of these optional features of Unity are moved out of the “core” Unity Editor and are instead accessible as add-on packages for individual projects. These add-on packages are accessible via the Unity Package Manager. To learn more, check out this blog post about the package manager, this blog post about packages’ life cycles, and the documentation for the package manager.

As discussed in the previous section, you will be using Unity’s AR Foundation and the XR Interaction Toolkit to complete this project. Since these are optional features provided by Unity, you can install them using the package manager. To open up the Package Manager window, navigate to Window -> Package Manager from the menu bar at the top. Once this is open, you will see a list of available packages in alphabetical order, including some that you already have installed. In fact, when you selected the options to support ARCore and ARKit from the XR Plugin Management tool, it installed the ARCore XR Plugin and the ARKit XR Plugin for you behind the scenes. Additionally, if you scroll all the way down to the bottom, you will see that even the XR Plugin Management tool itself is a package that you installed.

Upgrading the Plugins

For this project, we will be making use of preview versions of the AR development frameworks, so we will also upgrade the XR plugins to the latest preview versions to be compatible with them. By default, preview packages do not show up in the package manager. In order to get around this, click on the Advanced button near at the top of the Package Manager window and select the option for Show Preview Packages. Then, go ahead and upgrade the ARCore XR Plugin (and the ARKit XR Plugin if you’re building for iOS) to the latest preview version (4.0.0 - preview.1 as of this writing).

The Development Frameworks

You can now move on to installing the development tools. Install the latest preview version of the AR Foundation framework (4.0.0 - preview.1 as of this writing) and the XR Interaction Toolkit (0.9.4 as of this writing).

Face Tracking

If you are going to be testing on an iOS device, you should also install the latest preview version of the ARKit Face Tracking package (4.0.0 - preview.1 as of this writing). You may be wondering why there’s two separate ARKit packages or why we aren’t importing a “Face Tracking” package for ARCore, especially since we’ll be using face tracking in this project to capture reactions to your score. Unity explains the reasoning behind this as follows:

Google does not have this restriction on the Play Store, hence why there is just a single ARCore XR Plugin for that contains all of the supported ARCore features, including face tracking.

Another difference between the two AR platforms is that Apple only supports face tracking functionalities on devices with a TrueDepth camera (i.e. devices that have Face ID). This ensures that AR experiences using your face are of a much better quality and have much better accuracy, but on the flip side it requires you to have a newer phone to test this out. Google, on the other hand, allows face tracking on pretty much all ARCore-supported Android devices, as long as it has a front-facing camera. This may mean that the experience may not be as precise, but it gives the capability to a much larger portfolio of devices.

Importing Custom Package for This Project

We have created a custom package that contains some useful shaders, materials, and scripts that you will use later in this project. You can find this package on the GitHub page for this project. Once you download this file, import its assets into your project by navigating to Assets -> Import Package -> Custom Package from your menu bar and then selecting the Project3StarterAssets.unitypackage file.

Closing Notes

Congrats! You have now configured your project and are ready to begin AR development in Unity!

Previous Section | Go Home | Next Section