Magic Leap 2 Support
com.meshmap.sdk.magicleap2
v0.1.3
10 Aug 2025
The MeshMap Magic Leap 2 Support package contains features and sample assets for creating location-based AR experiences with the Magic Leap 2 headset.
This package uses a modified version of the official Magic Leap Unity SDK to prevent compilation errors with Unity OpenXR Plugin 1.15.0 (used in MeshMap XR).
Getting Started
The easiest way to get started is to clone the MeshMap Samples for Magic Leap 2 repository and open the project using Unity Hub.
The samples are pre-imported and the project settings are already configured.
Features
In addition to the samples below:
Dimming — Adjust the Magic Leap Global Dimming setting with a UI slider.
Haptics — Simple helper class for preset and custom haptic feedback.
Occlusion — Apply occlusion shaders/materials to objects and UI elements.
Rigs — A reliable XR rig to use in Magic Leap projects.
Samples
To import a sample into an existing Unity project, go to Windows > Package Manager > MeshMap Magic Leap 2 Support > Samples
.
Marker Tracking — Demonstrates how to set up a simple scene with marker tracking and a calibration UI to localize content for location-based AR experiences.
Space Localization — Demonstrates how to localize using Magic Leap 2 Spaces.
Spatial Anchors — Demonstrates how to position AR content across sessions using Magic Leap 2 Spatial Anchors Subsystem.
Physical Occlusion — Demonstrates how to occlude AR content using the physical environment, nearby objects, hands, and controllers using the experimental Magic Leap 2 Physical Occlusion Feature.
User Calibration — Demonstrates how to check the user's headset fit and eye calibration status using the experimental Magic Leap 2 User Calibration Feature.
Eye Tracking — Demonstrates how to get the user's eye tracker data using the experimental Magic Leap 2 Eye Tracking Feature. Recommended to pair with the User Calibration sample.
Voice Commands — Demonstrates how to set up custom voice commands using Magic Leap Voice Intents.
Usage
The com.meshmap.sdk.magicleap2 package can be added to an existing project via Unity Package Manager (UPM) from Git.
After import, the files will be available in the Packages section of the Project window in Unity Editor.
For further support, we highly recommend the official Magic Leap Developer Documentation and Forum.
Requirements
Unity 2022.3.11 LTS or later
Android Build Support
Universal Render Pipeline (URP)
Package Dependencies
VContainer v1.16.8
Unity TextMeshPro v3.0.7
Unity Input System v1.11.2
Unity XR Interaction Toolkit v2.6.3
Unity OpenXR v1.13.0
Settings and Permissions
Make sure you enable all required permissions for the OpenXR Plugin and Magic Leap 2 features that your app uses.
Before building (in Unity):
In
Project Settings > Player Android > Other Settings
, make sure the Vulkan Graphics API, DXTC texture compression format, minimum API level Android 10.0 (API level 29), IL2CPP scripting backend, new Input System, x86-64 target architecture, and internal write permission are set correctly.Check
Project Settings > MagicLeap > Permissions > API Level 29
.In
Project Settings > XR Plug-in Management
, enable the OpenXR Plugin and Magic Leap 2 feature groups.In
Project Settings > XR Plug-in Management > OpenXR > Enabled Interaction Profiles & Feature Groups
, check that the required interaction profiles, feature groups, and subsystems are enabled.Magic Leap 2 Controller Interaction Profile, Eye Gaze Interaction Profile, and Hand Interaction Profile (if using hand tracking).
In
Project Settings > XR Plug-in Management > Project Validation
, review that all checks pass successfully.In
Project Settings > MagicLeap > Permissions
, include all Android permissions that you anticipate your app needing.
After building (on device):
Manually grant permissions (e.g., camera, voice input) in
Settings > Apps & Notifications > App info > your-app > Permissions
.For the Voice Commands sample, enable Voice Commands in the device at
Settings > Magic Leap Inputs > Voice
.
Build and Installation
To install an .apk to your Magic Leap 2, enable Developer Mode. Then, connect it to your computer via USB-C and use Magic Leap Hub 3 > Device Bridge.
*If your computer has a USB-A port, you may need to use a USB-A-to-C cable.
Last updated