# MRTK-ML2 Package Causes Build Errors For Non-Android Platforms

**URL:** <https://forum.magicleap.cloud/t/mrtk-ml2-package-causes-build-errors-for-non-android-platforms/1203>\
**Category:** MRTK Development\
**Tags:** unity\
**Created:** [November 11, 2022, 7:36pm UTC](https://forum.magicleap.cloud/t/mrtk-ml2-package-causes-build-errors-for-non-android-platforms/1203 "2022-11-11T19:36:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.stinson](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@thomas.stinson](https://forum.magicleap.cloud/u/thomas.stinson)\
**Post date:** [November 11, 2022, 7:36pm UTC](https://forum.magicleap.cloud/t/mrtk-ml2-package-causes-build-errors-for-non-android-platforms/1203/1 "2022-11-11T19:36:53Z")

</div>

We are building an app for both Magic Leap 2 and HoloLens 2 using Unity and MRTK. When switching build platforms to UWP a few compile errors from the MRTK-ML2 package appear and prevent us from building and deploying to the HoloLens.

**Unity Editor version** : 2022.2.0b10  
**ML2 OS version** : 1.0.0  
**MLSDK version** : 1.0.0  
**MRTK-ML2 version** : 1.0.0-v1  
**MRTK version** : 2.8

**Repro steps** :

1. In Unity, switch build platform to _Universal Windows Platform_ or _Windows, Mac, Linux_.
2. Attempt to run an MRTK example scene in the Editor. Note the compile errors prevent the scene from running.

I fixed the compile errors by adding or removing conditional compilation flags and can provide a git patch file with the changes; this fix will only last until we upgrade to a new version of the MRTK-ML2 library.

**Error messages from logs** (syntax-highlighting is supported via Markdown):

```auto
Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapMRTKController.cs(316,40): error CS0246: The type or namespace name 'InputSubsystem' could not be found (are you missing a using directive or an assembly reference?)

Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapHandTrackingInputProvider.cs(26,32): error CS0246: The type or namespace name 'MLHandContainer' could not be found (are you missing a using directive or an assembly reference?)

Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapMRTKController.cs(331,40): error CS0246: The type or namespace name 'InputSubsystem' could not be found (are you missing a using directive or an assembly reference?)

```

---

<div class="post-metadata">

**Author:** ![kdowney](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kdowney/32/481_2.png) [@kdowney](https://forum.magicleap.cloud/u/kdowney)\
**Post date:** [November 11, 2022, 7:38pm UTC](https://forum.magicleap.cloud/t/mrtk-ml2-package-causes-build-errors-for-non-android-platforms/1203/2 "2022-11-11T19:38:06Z")

</div>

Thank you for your post, @thomas.stinson. Let me look into this with our engineers and I'll follow up asap.

---

<div class="post-metadata">

**Author:** ![kdowney](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kdowney/32/481_2.png) [@kdowney](https://forum.magicleap.cloud/u/kdowney)\
**Post date:** [November 11, 2022, 9:44pm UTC](https://forum.magicleap.cloud/t/mrtk-ml2-package-causes-build-errors-for-non-android-platforms/1203/3 "2022-11-11T21:44:52Z")

</div>

Hi @thomas.stinson, It's the if-defs that are causing the issue. We're currently removing the if-defs around our code in the Unity SDK. MRTK is scheduled to follow suit, but that is what is causing this issue. There are 5 scripts where an if-def needs to be removed and it should work fine.

- com.magicleap.unitysdk\Runtime\Common\Utils\MLPluginLog.cs - remove the if-def
- Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapHandTrackingInputProvider.cs - remove the if-def in the middle around the MLHandContainer
- Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapHandJointProvider.cs - remove the if-def at the top around `using UnityEngine.XR.MagicLeap;`
- Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapSpatialMeshObserver.cs - remove the if-def at the top around the `MagicLeapSpatialMeshObserverProfile`
- Assets\MRTK-Magic Leap 2\Providers\MagicLeap\Scripts\MagicLeapMRTKController.cs - remove the if-def at the top around `using UnityEngine.XR.MagicLeap;`

This should resolve the issue for the 1.0.0 version you're on. On our next release, we'll have the if-def's removed. Thanks again for your post.
