Unity project setup

This guide details the recommended editor versions, graphics settings, URP settings, and Android project settings when developing a Unity application for Android XR.

Prerequisites

To develop with Unity you will need to Download and install Unity Hub.

Install version 6000.0.23f1 or higher of the Unity Editor and Android Build Support, which includes:

  • OpenJDK
  • Android SDK
  • Android NDK Tools

Select a rendering engine

We recommend using the Vulkan Graphics API to render Android XR apps. To select Vulkan as your Graphics API, follow these steps:

  1. In Unity, go to Edit > Project Settings > Player.
  2. Select the Android tab and navigate to Other Settings > Rendering.
  3. If Auto Graphics API is enabled, disable this setting to reveal the Graphics APIs section.
  4. In the Graphics APIs section, select the Add (+) button and select Vulkan from the dropdown.

    Example showing how to change the graphics api settings in the UI

  5. Re-order the Graphics APIs using the handles (=) so that Vulkan is listed first.

  6. Optionally, select any other Graphics APIs and click the Remove (-) button to remove them.

Universal Render Pipeline

Android XR is compatible with the Universal Render Pipeline (URP). If you plan to use passthrough, you should update the default URP settings for best passthrough performance on Android XR.

The following table has a list of Unity's recommended URP settings, which are explained in greater detail in the following sections.

Setting

Location

Recommended value

HDR

Universal Render Pipeline Asset

Disabled

Post-processing

Universal Renderer Data

Disabled

Universal Render Pipeline Asset settings

Follow these steps to optimize your Universal Render Pipeline Asset for Android XR:

  1. Locate your project's Universal Render Pipeline Asset. One way to do this is to type t:UniversalRenderPipelineAsset into the Project window's search bar.

  2. Under the Quality header, disable HDR.

    Universal Render Pipeline Asset shown with recommended settings

Universal Renderer Data settings

Follow these steps to optimize your Universal Renderer Data for Android XR:

  1. Locate your project's Universal Renderer Data Asset. One way to do this is to type t:UniversalRendererData into the Project window's search bar.

  2. In the Inspector, under the Post-processing header, uncheck Enabled.

    Universal Renderer Data shown with recommended settings

Minimal Android API level

Set your project to a minimal API level of 24, which is required by the OpenXR Loader. Otherwise, your builds may fail.

Complete these steps to set the minimal Android API level.

  1. Go to Edit > Project Settings > Player.
  2. Select the Android tab and open Other Settings.
  3. In the Identification section, for Minimal API level, select 24 or higher.

Application entry point

Configure the following settings for application entry point:

  1. Go to Edit > Project Settings > Player.
  2. Select the Android tab and open Other Settings.
  3. In the Application Entry Point section, make sure the GameActivity is checked and Activity is unchecked.

Pop-up windows

Most Android XR apps require resizable windows, as they are required to render pop-ups such as system permission requests.

Follow these steps to ensure pop-up windows are rendered properly.

  1. Go to Edit > Project Settings > Player.
  2. Select the Android tab and enable Resizeable Activity.

See also