microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Editor crashes if code changes are made when game is playing #9195

Closed eusebiu closed 3 years ago

eusebiu commented 3 years ago

Describe the bug

I noticed that Unity Editor 2020.2 crashes after I make some code changes while the game is playing - it shows the loading dialog with some text (e.g. Application.Tick,... Application.Reload) and then at the end it crashes.

Workaround is to disable the recompilation during play: https://forum.unity.com/threads/editor-crashes-if-code-changes-are-made-when-game-is-playing.1047176/#post-6781571

To reproduce

Steps to reproduce the behavior:

  1. Start an app
  2. Make a change in the code
  3. Wait for recompile
  4. Crash happens

[MODES] ModeService[default].UpdateModeMenus NullReferenceException: Object reference not set to an instance of an object at Microsoft.MixedReality.Toolkit.Input.BaseCursor.ResetInputSourceState () [0x0002f] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\SDK\Features\UX\Scripts\Cursors\BaseCursor.cs:552 at Microsoft.MixedReality.Toolkit.Input.BaseCursor.set_Pointer (Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer value) [0x0004d] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\SDK\Features\UX\Scripts\Cursors\BaseCursor.cs:185 at Microsoft.MixedReality.Toolkit.Input.GazeProvider.SetGazeCursor (UnityEngine.GameObject cursor) [0x00062] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\Services\InputSystem\GazeProvider.cs:581 at Microsoft.MixedReality.Toolkit.Input.GazeProvider.InitializeGazePointer () [0x000a9] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\Services\InputSystem\GazeProvider.cs:521 at Microsoft.MixedReality.Toolkit.Input.GazeProvider.get_GazePointer () [0x00000] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\Services\InputSystem\GazeProvider.cs:113 at Microsoft.MixedReality.Toolkit.Input.GazeProvider.get_GazeCursor () [0x00000] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\Services\InputSystem\GazeProvider.cs:120 at Microsoft.MixedReality.Toolkit.Input.GazeProvider.OnDestroy () [0x00001] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\Services\InputSystem\GazeProvider.cs:447

(Filename: Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@2.5.3/SDK/Features/UX/Scripts/Cursors/BaseCursor.cs Line: 552)

NullReferenceException: Object reference not set to an instance of an object at Microsoft.MixedReality.Toolkit.Input.BaseCursor.RegisterManagers () [0x00007] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\SDK\Features\UX\Scripts\Cursors\BaseCursor.cs:404 at Microsoft.MixedReality.Toolkit.Input.BaseCursor.Start () [0x00001] in C:\MolVR\MolVR\MolVR\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@2.5.3\SDK\Features\UX\Scripts\Cursors\BaseCursor.cs:359

(Filename: Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@2.5.3/SDK/Features/UX/Scripts/Cursors/BaseCursor.cs Line: 404)

Stacktrace:

at <0xffffffff> at (wrapper managed-to-native) Oculus.Avatar.CAPI.ovrAvatarPose_GetLeftControllerComponent_Native (intptr) [0x00009] in :0 at Oculus.Avatar.CAPI.ovrAvatarPose_GetLeftControllerComponent (intptr,ovrAvatarControllerComponent&) [0x00001] in C:\MolVR\MolVR\MolVR\Assets\Oculus\Avatar\Scripts\OvrAvatarSDKCAPI.cs:1040 at OvrAvatarTouchController.Update () [0x00024] in C:\MolVR\MolVR\MolVR\Assets\Oculus\Avatar\Scripts\OvrAvatarTouchController.cs:18 at (wrapper runtime-invoke) object.runtime_invoke_voidthis (object,intptr,intptr,intptr) [0x00020] in <9577ac7a62ef43179789031239ba8798>:0

Expected behavior

Editor should not crash.

Your setup (please complete the following information)

Target platform (please complete the following information)

eusebiu commented 3 years ago

Unity bug - closing - fixed in latest Unity releases.