Skip to main content
Version: 12 Dec 2024

Configure Existing MRTK 3 Project

This guide demonstrates how to add Magic Leap 2 support to an existing MRTK 3 Project. Visit the Magic Leap MRTK 3 Overview page to learn about the features currently supported on Magic Leap 2.

Prerequisites

Before starting, download or install the following packages and tools:

  1. From the Magic Leap Hub download:
    • Magic Leap SDK v1.2.0 (or later)
    • Magic Leap Unity SDK v1.6.0 (or later)
    • Magic Leap MRTK 3 1.0.0-pre.5 (or later)
  2. Download and install a Unity Editor v2022.2.x

Import MRTK3 Magic Leap

After importing the MRTK3 packages, import the MRTK3 Magic Leap package into the project.

  1. Download the MRTK3 Magic Leap package using the Magic Leap Hub's Package Manager.
  2. Open the Package Manager (Window > Package Manager), select the icon, then select Add package from tarball....
  3. Import the com.magicleap.mrtk3-[VERSION].tgz (version 1.0.0-pre.5 or higher) package from MagicLeap/tools/unity/mrtk3/.
Unity Package Manager with the "Add package from tarball..." option selected

Configure MRTK profile

OpenXR Provider Setup

If the project contains the com.unity.xr.openxr package (version 1.9.1 or later), you can use the OpenXR XR plugin. Follow the below steps to setup the MRTK3 project to run properly with this XR Provider.

  1. The following packages and their minimum versions are required to use OpenXR on Magic Leap 2 with MRTK3:

    • com.magicleap.unitysdk version 2.0.0 (or later)
    • com.unity.xr.openxr version 1.9.1 (or later)
    • com.unity.xr.hands version 1.4.0-pre.1 (or later)
  2. Bring up project settings (Edit > Project Settings).

  3. Within project settings, go to the XR Plug-in Management category on the left.

    1. Select the Android settings tab.
    2. Select the OpenXR provider in the list. Make sure this is the only selected XR Provider for Android.
      • Select the Magic Leap Feature Group.
    3. Select the XR Plug-in Management > OpenXR category on the left for more options.
      • Set the Depth Submission Mode to None.
      • Make sure the following interaction profiles are added:
        • Magic Leap 2 Controller Interaction Profile
        • Eye Gaze Interaction Profile
        • Hand Interaction Profile
      • In the feature list, make sure the Magic Leap 2 ... features you want are selected, plus Unity's Hand Tracking Subsystem feature.
      • Recommendation: Change the OpenXR Blend Mode from Alpha Blend to Additive so the Segmented Dimmer is disabled default.
        • Select the Magic Leap 2 Rendering Extension settings icon. Set Blend Mode to Additive.
  4. Within project settings, go to the MRTK3 category on the left.

    • Set the Profile to MRTKProfile-MagicLeap, found at Packages/com.magicleap.mrtk3/Runtime/XRProviders/MagicLeap/Configuration/Default Profiles/.
danger

If Microsoft's OpenXR package is also in the project, make sure the Hand Tracking feature is disabled inside the OpenXR Feature Groups. This feature is deprecated and will cause the application not to load properly.

Permissions

Hand Tracking and Eye Tracking requires developers to add additional permissions to your project's Manifest. To add the additional permissions follow the steps below:

  1. Go to the Magic Leap Permissions Settings (Edit > Project Settings > Magic Leap > Permissions)
  2. Enable com.magicleap.permissions.HAND_TRACKING
  3. Enable com.magicleap.permissions.EYE_TRACKING

For more information, refer to the Magic Leap 2 permissions guide.

info

The Magic Leap MRTK 3 package offers Runtime Permission Configuration in project settings to auto request and/or start certain permission easily without needing to add prefabs or code to your scenes to do so. Permission can be setup to be auto requested/started in (Edit > Project Settings > MRTK3 > Magic Leap Settings > Runtime Permissions Configuration).

Magic Leap Rig

The following section includes information about creating a Magic Leap ready scene using MRTK3.

Enable Runtime Configuration

To support the standard rig, the MRTK Magic Leap package includes a feature that automatically configures the MRTK XR Rig prefab. This section includes information on how to enable the Runtime configuration feature. To learn more about the Magic Leap specific settings, visit the MRTK 3 Magic Leap Settings guide.

  1. Navigate to the Magic Leap Settings Window by going to Edit > Project Settings then MRTK3 > Magic Leap Settings.
  2. Enable the Runtime Config Enabled setting.
MRTK3 Magic Leap Settings with the Runtime Config option selected
MAC USERS - BUILD FAILURE

There is a known bug which causes builds of the MRTK3 dev template project to fail only when selecting Build and Run on a Mac. To mitigate this, select Build to build the apk and manually install it to the device.