Migrating to OpenXR
In order for an existing Magic Leap 2 Unity application to continue working under OpenXR, here are the minimum steps required:
- In the Unity Package Manager (in Unity’s top menu: Window > Package Manager), install the
com.unity.xr.openxr
package, version 1.9.1 or greater.
If you’re not able to find version 1.9.1
of the package in the Package Manager you can add it manually by selecting + icon and choosing Add Package by name…, then enter com.unity.xr.openxr
for the name, and 1.9.1
or greater for the version, Finally click Add to install the package.
In Project Settings > XR Plugin Management, disable the Magic Leap provider and enable the OpenXR provider.
In the OpenXR provider tab, enable the Magic Leap 2 Support feature.
If you rely on the ML2 controller, enable the Magic Leap 2 Controller Interaction Profile.
As a result of Magic Leap’s reduced latency for the controller data stream implemented in the 1.5.0 OS release, we recommend that developers relying on controller tracking information (e.g. pose) when interacting with scene objects - such as UI or other virtual content - add some amount of drag inertia to the scene objects. This way, the objects "follow" the controller pose over time as opposed to moving 1:1 to where the controller is pointing, as the high controller sensitivity could result in an undesirable amount of movement.
Update any references to InputActions as necessary.
If your application relied on Magic Leap rendering functionality such as frame parameters, Segmented Dimmer, or Global Dimmer, please refer to the Magic Leap Rendering Extensions section of the documentation to update any code referencing graphics-specific APIs.
In Project Settings > XR Plug-in Management > XR Project Validation, , verify there are no Magic Leap related verification errors. If any errors exist, follow the instructions provided by the validation error to correct the situation.
Important notes:
- Developers can continue to use Non-OpenXR Magic Leap APIs while transitioning to OpenXR. The previous MLSDK APIs will continue function with the exception of logic related to input and Unity's subsystems . For more information see the OpenXR Overview Documentation.
- To prepare for the eventual removal of these compatibility features, it's recommended to start converting other API calls to use corresponding Magic Leap OpenXR Features as they become available.
- If replacing the old Magic Leap XR Rig prefab with the OpenXR XR Origin prefab, follow the guidance in this article regarding changing the tracking mode and Y offset.