Home > OS >  Unity Hololens2 Build Errors
Unity Hololens2 Build Errors

Time:06-15

I try to build my Hololens 2 application but i get errors which i can not solve. When I try to test the application with the Unity play button, it works as expected. I have also tried the MRTK sample scene, which also works only through the play button, but does not when I try to build it.

Build Errors:

Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@251fc689f36f\Providers\WindowsMixedReality\XRSDK\WindowsMixedRealityDeviceManager.cs(404,128): error CS0104: 'Handedness' is an ambiguous reference between 'Microsoft.MixedReality.Input.Handedness' and 'Microsoft.MixedReality.Toolkit.Utilities.Handedness'
Error building Player because scripts had compiler errors
UnityEditor.BuildPlayerWindow BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <1135c66e5f4c41a7831fa5798849d8b6>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <1135c66e5f4c41a7831fa5798849d8b6>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I tried to update the MRTK with the MixedRealityFeatureTool and did the Mixed Reality Toolkit-Set Up as described in the tutorial. But i still get the errors, which means i can not test it on the Hololens 2.

CodePudding user response:

I had this problem but I was able to fix the error by going to the script in the specified path (Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@251fc689f36f\Providers\WindowsMixedReality\XRSDK\WindowsMixedRealityDeviceManager.cs) in the error, going into the error line (404) and changing Handedness to 'Microsoft.MixedReality.Toolkit.Utilities.Handedness'

CodePudding user response:

The error indicates the class with the same name exists in both namespaces. Do you refer the class indicated in the error message? You may specify the namespace for the reference to resolve this issue.

If not, how do you import Unity packages via MixedRealityFeatureTool? If possible, please also try my test project on MR-Blank-Project to know if this issue can be reproduced and remember to switch to UWP platform. Some errors occur when the first run in this project but can be ignored and it doesn't affect the build and deploy process.

  • Related