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 and install the following packages from the Magic Leap Hub:
- Magic Leap SDK v1.2.0 (or later)
- Magic Leap Unity SDK v1.6.0 (or later)
- Unity Editor v2022.2.17f1 (or later)
- Magic Leap MRTK 3 1.0.0-pre.5 (or later)
Template Project
This guide references the MRTK 3 Template Project. However, you can apply these instructions to any project that is configured for MRTK 3. If you want to follow along using the Template Project, refer to the steps below for downloading it from GitHub.
Download the Template Project
The MRTK 3 template project includes MRTK3 packages and sample scenes. You can download the project from MRTK's Github repository.
If you are familiar with Git and prefer to use the command line, clone the repo following command:
git clone https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity.git
Configure MRTK3 for Magic Leap 2
Follow the step-by-step instructions below to update the MRTK Dev Template project to Unity v2022.2.x and configure the project settings for Magic Leap 2 development.
Update Unity Version
- Using the Unity Hub, open the
MRTKDevTemplate
project using Unity version 2022.2.x - On the Opening Project in Non-Matching Editor Installation popup, select Continue.
- On the Script Updating Consent popup, select Yes, for these and other files that might be found later.
- On the Enter Safe Mode? popup, select Ignore.
Remove conflicting packages
- Open the package manager (Window > Package Manager) and remove the following packages:
- Google ARCore XR Plugin
- Mixed Reality OpenXR Plugin
- OpenXR Plugin
- Clear any Error that appear in the Unity Console as a result of the removal of the packages.
- If errors are still present, close the project and delete the project's Library folder, and re-open Unity to reimport the existing packages.
Configure Project Settings for Magic Leap
- Download and Install the Magic Leap Setup Tool from the Unity Asset store.
- Open the Project Setup window (Window > Magic Leap > Project Setup).
- Complete all of the setup steps in the Project Setup Window.
Import MRTK3 Magic Leap
After importing the MRTK3 packages, import the MRTK3 Magic Leap package into the project.
- Download the MRTK3 Magic Leap package using the Magic Leap Hub's Package Manager.
- Open the Package Manager (Window > Package Manager), select the + icon, then select Add package from tarball....
- Import the
com.magicleap.mrtk3-[VERSION].tgz
(version 1.0.0-pre.5 or higher) package fromMagicLeap/tools/unity/mrtk3/
.
Configure MRTK profile
To support Magic Leap 2 input set the MRTK3 profile to MRTKProfile - MagicLeap. This profile adds Magic Leap 2 support to the MRTK XR Subsystems.
- Navigate to Edit > Project Settings.
- Select MRTK3 then select the Android tab.
- set the Profile to MRTKProfile - MagicLeap.
- If the profile does not appear in the asset window, click the small "eye" icon located at the top-right corner of the menu to reveal hidden items in the list of assets.
- You can find the profile under
Packages/com.magicleap.mrtk3/Configuration/Default Profiles/MRTKProfile-MagicLeap.asset
.
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:
- Go to the Magic Leap Permissions Settings (Edit > Project Settings > Magic Leap > Permissions)
- Enable com.magicleap.permissions.HAND_TRACKING
- Enable com.magicleap.permissions.EYE_TRACKING
For more information, refer to the Magic Leap 2 permissions guide.
Configure the MRTK XR Rig Prefab
- Runtime Configuration
- MRTK XR Rig Prefab
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.
- Navigate to the Magic Leap Settings Window by going to Edit > Project Settings then MRTK3 > Magic Leap Settings.
- Enable the Runtime Config Enabled setting.
Using the MRTK XR Rig - MagicLeap prefab
This section includes instructions on creating a new scene using the MRTK XR Rig - MagicLeap prefab. This prefab is pre-configured required to support Magic Leap Input such as hands, controller and gaze. Alternatively, you can use the runtime configuration feature which will allow you to use the standard MRTK3 rig.
- Create a new Unity scene.
- Remove the MRTK XR Rig Game Object it one exists as it will be replaced with the one supported by Magic Leap,
- Add the MRTK XR Rig - MagicLeap prefab.
- The prefab can be found in your Project folder in the
Packages/com.magicleap.mrtk3/Runtime/MagicLeap/Prefabs/MRTK_Variants/
directory.
- The prefab can be found in your Project folder in the