Skip to content

Projektsettings in Unity

Dominik edited this page Oct 6, 2024 · 1 revision

VR/MR/XR Development with Unity:

Preparation:

First, ensure in the Unity Hub that the installed Unity version supports Android, as the Horizon OS used in the Meta Quest 3 is based on Android.

You can recognize this in the Unity Hub:

AndroidSupported

Furthermore, a Quest with an activated, set up developer account should be available (note that the debug mode and developer mode must be active on the headset and in the app! It is best to connect the headset via cable!).

Creating the Project:

There are several options:

  • Use a pre-made VR template VR Template

  • Use a pre-made MR template MR Template

  • Use a 3D template and set everything manually (which is explained in more detail below) 3D Template

It is best to directly load a project with URP (Universal Render Pipeline) installed (a must for OpenXR with Meta!).

To create the project, press Create Project. You can also select the folder where you want to save the project files (right side in the project creation window).

Activating XR in the 3D Template

For MR development, we need several packages, which can be obtained from the Plugin Manager (all with dependencies):

  • AR Foundation [com.unity.xr.arfoundation]
  • OpenXR Plugin [com.unity.xr.openxr]
  • Unity OpenXR Meta [com.unity.xr.meta-openxr]
  • XR Core Utilities [com.unity.xr.core-utils]
  • XR Interaction Toolkit [com.unity.xr.interaction.toolkit]
  • XR Legacy Input Helpers (for older versions) [com.unity.xr.legacyinputhelpers]
  • XR Plugin Management [com.unity.xr.management]

To convert the "normal" 3D template to MR development, follow these steps:

  1. Navigate to the project settings (top left -> Edit -> Project Settings -> XR Plugin Management [at the very bottom of the list]) UnityProjectSettings You need to install XR Plugin Management if it hasn't been done already.

  2. In the XR Plugin, you need to activate several options. Note that for development on the Quest 3, there are multiple options. You can choose either Oculus as the plugin provider or OpenXR. If you only want to develop for the Oculus Quest 3, it is recommended to choose Oculus. However, if you want cross-platform compatibility, meaning the ability to run the app on headsets from other manufacturers, OpenXR is the better choice. We choose OpenXR here. For a detailed view of which plugin provider is suitable for whom, refer to: Unity - Manual: VR development in Unity under the subheading "VR provider plug-ins."

  3. After downloading and activating the OpenXR Plugin, you will encounter a warning during the initial setup: OpenXRWarning Here, you need to click on the warning triangle and simply press "Fix"/"Fix All" where "Fix" is offered.

  4. In the OpenXR Plugin, several settings need to be configured as shown in the screenshots: OpenXR-AllFeatures OpenXR-MetaQuest grafik In the project validation, everything should be handled with "Fix All" and fixed manually if necessary.

  5. In File->Build Settings, the headset should now appear after refreshing:
    BuildSettings
    It is also important to be in the Android section since a modified Android version runs on the Quest.

  6. With the selected headset, click on "Build and Run" to compile the application and send it to the headset for execution.

With that, the project settings should be in order. What is needed in the scene for smooth VR/AR operation is described in another wiki.