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

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

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?)
1 Like

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

1 Like

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.

1 Like