# HoloLens 2 Unity Project to Magic Leap Fails to Build

**URL:** <https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513>\
**Category:** MRTK Development\
**Tags:** unity\
**Created:** [October 23, 2024, 3:16pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513 "2024-10-23T15:16:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvelazco](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dvelazco](https://forum.magicleap.cloud/u/dvelazco)\
**Post date:** [October 23, 2024, 3:16pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/1 "2024-10-23T15:16:32Z")

</div>

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:

```auto
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:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/8/8e89b91ced00352d9313ec514a39a58475eab9b1.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/9/9fd7f7a58f9159e44f9a526fb6765becc3be9993.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/e/ec73051401670cd6068d82ed4c1d1de596b3af1f.png)

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.

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [October 23, 2024, 3:21pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/2 "2024-10-23T15:21:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dvelazco](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dvelazco](https://forum.magicleap.cloud/u/dvelazco)\
**Post date:** [October 24, 2024, 7:32pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/3 "2024-10-24T19:32:47Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [October 24, 2024, 7:44pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/4 "2024-10-24T19:44:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dvelazco](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dvelazco](https://forum.magicleap.cloud/u/dvelazco)\
**Post date:** [October 24, 2024, 7:54pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/5 "2024-10-24T19:54:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [October 24, 2024, 7:57pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/6 "2024-10-24T19:57:04Z")

</div>

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](https://docs.unity3d.com/2019.4/Documentation/Manual/class-PlayerSettings.html) settings and navigate to the **Scripting Define Symbols** text box.

See more information here:

> **[Unity - Manual: #define directives](https://docs.unity3d.com/2019.4/Documentation/Manual/PlatformDependentCompilation.html)**

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

---

<div class="post-metadata">

**Author:** ![dvelazco](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dvelazco](https://forum.magicleap.cloud/u/dvelazco)\
**Post date:** [October 24, 2024, 8:05pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/7 "2024-10-24T20:05:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [October 24, 2024, 8:10pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/8 "2024-10-24T20:10:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dvelazco](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dvelazco](https://forum.magicleap.cloud/u/dvelazco)\
**Post date:** [October 24, 2024, 9:57pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/9 "2024-10-24T21:57:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/1X/bd9b737a4d45ea243aa7eb177d60a773b806899a.svg) [@system](https://forum.magicleap.cloud/u/system)\
**Post date:** [November 8, 2024, 9:58pm UTC](https://forum.magicleap.cloud/t/hololens-2-unity-project-to-magic-leap-fails-to-build/4513/10 "2024-11-08T21:58:33Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
