- Magic Leap SDK
- MRTK Foundations v2.8 (see Import MRTK section below)
- MRTK Examples v2.8 (see Import MRTK section below)
- A configured Magic Leap 2 Unity project
Configure Your Project
- In Player Settings set the Active Input Handling to Both. Restarting the editor may be required.
- Import the TMP Essential Resources by selecting Window > TextMeshPro > Import TMP Essential Resources.
- Open the Unity Preferences window and set the Script Changes While Playing setting to Stop Playing and Recompile or Recompile and Continue Playing.
- Install Universal RP from the Package Manager and set a UniversalRenderPipelineAsset in the Graphics Settings
- Make sure Custom Main Manifest is selected under Publishing Settings so MagicLeap Manifest Settings can be set.
- Download version 2.8 of MRTK Foundation and MRTK Examples from the MRTK GitHub.
- Import the MRTK Foundation 2.8 package into your Unity project. Apply the recommended settings from the popup window that appears after doing so.
- It will ask for Script Updating Consent, select Yes, for these and other files that might be found later.
- Next, import the MRTK Examples 2.8 package into your project. Note: Some Oculus prefabs may log an error, these can be cleared.
- Note that the MRTK Tools package is now required for future upgrading to a newer version of MRTK according to the releases page linked to in #1.
- From the top menu Select Mixed Reality > Toolkit > Utilities> Upgrade MRTK Standard Shader for Universal Render Pipeline. This will be greyed out unless a URP pipeline asset is set in the Graphics Settings
Edit MRTK Standard Shader
The standard shader in MRTK may give an error in 2022.2 when building and may block Build and Run. Make these edits in the shader to fix this.
- On line 775 change
fixed facing : VFACEto
bool facing : SV_IsFrontFace
- On lines 956 and 959 change
* (facing ? 1.0 : -1.0)
Import MRTK Magic Leap 2
- Download the MRTK Magic Leap 2 Unity Asset using the ML Hub Package Manager.
- Import the asset into your project by going to Assets > Import Package > Custom Package and selecting the MRTK Magic Leap Unity package, located under
USER / MagicLeap / tools / unity / mrtk / VERSION /directory.
MRTK Magic Leap 2 Examples
You can test the MRTK Magic Leap 2 implementation using the Example scenes located under
MRTK-Magic Leap 2/Samples/
Make sure the
MixedRealityToolkit's configuration profile is set to
Configure Hand Tracking Settings
Track a Single Hand
Hand tracking is currently in a preview state. We recommend tracking a single hand. This can be done by setting the following setting on
MagicLeapHandTrackingInputProvider.Instance.CurrentHandSettings = MagicLeapHandTrackingInputProvider.HandSettings.Left;
Disable Hand Tracking
Hand tracking can be disabled by setting the MagicLeapHandTrackingInputProvider's
HandSettings.None or remove the Magic Leap Hand Tracking Provider from the MRTK input providers
MagicLeapHandTrackingInputProvider.Instance.CurrentHandSettings = MagicLeapDeviceManager.HandSettings.None;