HoloLens 2 Unity Project to Magic Leap Fails to Build

Trying to port an existing HoloLens 2 Unity application to the Magic Leap 2 by following the online guide but getting some errors when building. Before following the guide, I verified that the app deploys successfully to the HoloLens 2 with the Unity and MRTK versions listed below.

Unity Editor version: 2022.3.50f1
ML2 OS version: 1.10.0
MLSDK version: 2.5.0
MRTK version: 2.8.3

Error when building the APK:

Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@f2323a9b7aec\Providers\OpenXR\Scripts\OpenXRControllerModelProvider.cs(8,30): error CS0234: The type or namespace name 'OpenXR' does not exist in the namespace 'Microsoft.MixedReality' (are you missing an assembly reference?)
Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@f2323a9b7aec\Providers\OpenXR\Scripts\OpenXRControllerModelProvider.cs(29,26): error CS0246: The type or namespace name 'ControllerModel' could not be found (are you missing a using directive or an assembly reference?)

My Setup:



The Magic Leap Tool Setup is also all in green. I've also added a URP Asset (with Universal Renderer), assigned it, and upgraded the MRTK shader to it, as shown in the guide instructions.

Any ideas what is missing that is causing the OpenXRControllerModelProvider.cs errors?

Thanks in advance.

Unfortunately the com.microsoft.mixedreality.toolkit.foundation.OpenXRControllerModelProvider is not maintained by Magic Leap so our knowledge is limited about the topic. You might want to reach out on the MRTK github to see if they can assist.


You may also want to quit your project and then delete the Library folder inside of the project. Then re-open the project and set the build platform to Android to see if that clears it up. You might also want to check if removing the #MSFT_OPENXR definition from your project settings also helps.

Thanks for the reply, kbabilinkski. I will go and ask there and see if they have any tips.

Do you know by any chance what is the OpenXRControllerModelProvider used for? The project I am trying to port is a small one with a simple scene to see what the porting process is like (we're thinking of migrating other projects to ML2).

Honestly I am not sure. Did you try removing the definition I mentioned above ?

To be honest, I couldn't find where it is being defined. The only place I saw references to it is in the Library directory, but that is auto generated. I guess I could find where it is defined there and remove it. Is that what you mean?

It is also possible to add to the built-in selection of #define directives by supplying your own. Open the Other Settings panel of the Player settings and navigate to the Scripting Define Symbols text box.

See more information here:

MRTK might provide instructions on how to revert your project from Microsoft open XR

I don't see MSFT_OPENXR there. Let me retract some steps before I changed to OpenXR and see if I can figure out where the issue is.

This has to work, right? There are successful HL2 MRTK 2.8.3 ports in ML2, right?

Correct, you might have to remove the com.unity.[package name] that enables microsoft open xr if one exists.

Found the issue!

When I upgraded to MRTK 2.8.3, I didn't realize there was another package under the Platform Support category called Mixed Reality OpenXR Plugin. Updating that to the latest version fixed those errors.

Thanks for the help and bounce of ideas!

1 Like