Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug MRTK Scene Setup for Hololens, cant build for UWP 'NullReferenceException in SimulationEditorUtilit'

Discussion in 'AR' started by rbx775, Apr 11, 2023.

  1. rbx775

    rbx775

    Joined:
    Aug 16, 2010
    Posts:
    102
    Hi there,
    just finished setting up my Hololens2 project with the Microsoft MRTK for Hololens2.
    I did a test build prior which successfully deployed to my hololens2.
    But after I installed the MRTK v2.8.3.0, Im getting errors when trying to build the solution in Visual Studio 2022:
    (or hitting play in unity)

    Code (CSharp):
    1. System.TypeInitializationException: The type initializer for 'UnityEditor.XR.Simulation.XREnvironmentViewUtilities' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object
    2.   at UnityEditor.XR.Simulation.SimulationEditorUtilities.CheckIsSimulationSubsystemEnabled () [0x00043] in .\Library\PackageCache\com.unity.xr.arfoundation@5.0.3\Editor\Simulation\SimulationEditorUtilities.cs:29
    3.   at UnityEditor.XR.Simulation.XREnvironmentViewUtilities..cctor () [0x00077] in .\Library\PackageCache\com.unity.xr.arfoundation@5.0.3\Editor\Simulation\XREnvironmentViewUtilities.cs:43
    4.    --- End of inner exception stack trace ---
    5.   at UnityEditor.XR.Simulation.XREnvironmentViewManager.DisableEnvironmentView (UnityEditor.SceneView sceneView) [0x00001] in .\Library\PackageCache\com.unity.xr.arfoundation@5.0.3\Editor\Simulation\XREnvironmentViewManager.cs:207
    6.   at UnityEditor.XR.Simulation.XREnvironmentToolbarOverlay.OnWillBeDestroyed () [0x00028] in .\Library\PackageCache\com.unity.xr.arfoundation@5.0.3\Editor\Simulation\XREnvironmentToolbarOverlay.cs:91
    7.   at UnityEditor.Overlays.OverlayCanvas.OnContainerWindowDisabled () [0x00018] in <00d63564201b48698d51680c10078897>:0
    8.   at UnityEditor.EditorWindow.OnDisableINTERNAL () [0x00001] in <00d63564201b48698d51680c10078897>:0
    (similiar message when hitting play in Unity)

    The project seems to run partly in unity play mode after ignoring the unity errors, can move around but no hand gestures or gaze controller.

    I configured my scene with the MRTK.
    Im on Win10 Pro, Unity 2022.2.5f1, MRTK 2.8.3.0

    I should probably note that I switched to the .NET Framework in the player settings,
    the .Net 2.1 version would throw script errors, because of system.numerics not being included in the framework version. Mentioning this because the MRTK guide used the 2.x version.

    Could somebody help me out with this? Thanks in advance!
     
  2. rbx775

    rbx775

    Joined:
    Aug 16, 2010
    Posts:
    102
    Ok, I think I was just a bit zealous with the Unity 2022 version, Unity 2020 seems to work just fine.