Skip to main content
Version: 14 May 2024

Install the Tools

This section provides information on how to install and configure the Unity Editor required to develop for Magic Leap 2.

caution

Magic Leap encourages you to use the new Unity Magic Leap OpenXR Workflow instead. If you choose the Magic Leap XR workflow, you must download an older version of the Magic Leap Unity SDK, version 1.12.0.

Prerequisites

Install Magic Leap SDK & Tools

We'll use the ML Hub to install and manage the Magic Leap Unity Package, the Unity SDK Examples Project, and other tools.

Open the ML Hub Package Manager

To access the Package Manager in the ML Hub:

  1. Open the ML Hub.
  2. Select Package Manager from the home screen.

Downloading the Unity SDK Package

If you want to use the Magic Leap XR workflow, you need an older version of the Magic Leap Unity SDK (version 1.12.0). To install the correct version, do the following:

  1. In the ML Hub, open the Package Manager.
  2. Navigate to the All tab.
ML Hub All Tab Selected
  1. Scroll to the Unity Package section.
  2. Click the package name to display the package information.
  3. Next to the label Available, click the drop-down to see the available SDK choices.
  4. Choose Version 1.12.0.
  5. Click the download arrow icon.
  6. Then select Apply Changes.
Download Unity Package 1.12.0

You are now ready to use the Magic Leap XR workflow.

Install Unity Editor

This section describes the process of installing the Magic Leap 2 compatible Unity Editor. Developers are able to develop Magic Leap 2 applications with any Unity Editor version 2022.3 LTS or higher.

  1. Open the Unity Hub application
  2. Select the Installs
  3. Then click the Install Editor button.
  4. With the Install Unity Editor window open.
  5. Select a Unity Editor version 2022.3 LTS or higher.
  6. In the modules screen select Android Build Support, then Android SDK & NDK Tools, and OpenJDK.
  7. Select the Continue button.
Unity Hub - Install Window

Magic Leap Hub Interaction

The following instructions only need to be performed if you are experiencing issues connecting and deploying to your device. Device communication can be incorrectly terminated when conflicting versions of ADB are being used. To correct this, you can set the Magic Leap Hub's ADB installation path to the one used by the Unity Editor.

  1. Open the Magic Leap Hub.
  2. Open the Magic Leap Hub's Developer Settings ( Home > Settings > Magic Leap Hub > Developer)
  3. Select Use custom adb and set the path to the Android Tools used by Unity.

If you are unsure which SDK path is used by your Unity installation, you can view the Android SDK path used by the Unity Editor inside Unity's Preferences Window.

  1. In Unity, select Edit > Preferences (macOS: Unity > Preferences).
  2. In the left navigation column, select External Tools. The Android section of the External Tools panel contains entries for JDK, SDK, NDK, Gradle.
  3. Copy the SDK path, then set the custom adb path inside the Magic Leap Hub to this location. Note, the adb service will be located in the SDK's platform-tools directory
C:\Program Files\Unity\Hub\Editor\[EditorVersion]\Editor\Data\PlaybackEngines\AndroidPlayer\SDK
  1. Finally, disable the Kill ADB server on exit, unless you need this behavior. By default, the preference is active, which can cause disruptions when using the Magic Leap Simulator.