In Unity editor, during play mode,
when clicking on a button that remove a scene, the lost pointer event leads to an assertion when accessing/creating the async coroutine runner.
Assertion failed on expression: 'go.IsActive()'
UnityEngine.GameObject:Find(String)
Microsoft.MixedReality.Toolkit.Utilities.AsyncCoroutineRunner:get_Instance() (at Assets/MixedRealityToolkit/Utilities/Async/Internal/AsyncCoroutineRunner.cs:50)
Microsoft.MixedReality.Toolkit.Utilities.<>c__DisplayClass13_0:<GetAwaiterReturnVoid>b__0() (at Assets/MixedRealityToolkit/Utilities/Async/AwaiterExtensions.cs:127)
Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions:RunOnUnityScheduler(Action) (at Assets/MixedRealityToolkit/Utilities/Async/AwaiterExtensions.cs:144)
Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions:GetAwaiterReturnVoid(Object) (at Assets/MixedRealityToolkit/Utilities/Async/AwaiterExtensions.cs:127)
Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions:GetAwaiter(WaitUntil) (at Assets/MixedRealityToolkit/Utilities/Async/AwaiterExtensions.cs:71)
Microsoft.MixedReality.Toolkit.<Unregister>d__7:MoveNext() (at Assets/MixedRealityToolkit/Services/BaseEventSystem.cs:58)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<Unregister>d__7&)
Microsoft.MixedReality.Toolkit.BaseEventSystem:Unregister(GameObject)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:Unregister(GameObject) (at Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs:497)
Microsoft.MixedReality.Toolkit.Input.InputSystemGlobalListener:OnDisable() (at Assets/MixedRealityToolkit.Services/InputSystem/InputSystemGlobalListener.cs:62)
UnityEngine.Object:DestroyImmediate(Object)
Microsoft.MixedReality.Toolkit.Input.GGVPointer:OnSourceLost(SourceStateEventData) (at Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/GGVPointer.cs:318)
Microsoft.MixedReality.Toolkit.Input.<>c:<.cctor>b__185_1(IMixedRealitySourceStateHandler, BaseEventData) (at Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs:711)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
Microsoft.MixedReality.Toolkit.BaseEventSystem:HandleEvent(BaseEventData, EventFunction`1) (at Assets/MixedRealityToolkit/Services/BaseEventSystem.cs:32)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:DispatchEventToGlobalListeners(BaseInputEventData, EventFunction`1) (at Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs:419)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:HandleEvent(BaseEventData, EventFunction`1) (at Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs:349)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:RaiseSourceLost(IMixedRealityInputSource, IMixedRealityController) (at Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs:702)
Microsoft.MixedReality.Toolkit.Input.InputSimulationService:RemoveHandDevice(Handedness) (at Assets/MixedRealityToolkit.Services/InputSimulation/Editor/InputSimulationService.cs:304)
Microsoft.MixedReality.Toolkit.Input.InputSimulationService:UpdateHandInputSource(Handedness, SimulatedHandData) (at Assets/MixedRealityToolkit.Services/InputSimulation/Editor/InputSimulationService.cs:224)
Microsoft.MixedReality.Toolkit.Input.InputSimulationService:LateUpdate() (at Assets/MixedRealityToolkit.Services/InputSimulation/Editor/InputSimulationService.cs:141)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:LateUpdateAllServices() (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:961)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:LateUpdate() (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:685)
edit
additional error when stoping App while asynccoroutinerunner has never been created :
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
AsyncCoroutineRunner
Steps to reproduce the behavior:
not really sure on the repros as lots of things are going on
but basically clicking on a button that will unload scenes (including the button itself) and load another scene (we don't unload the scene that contains the MixedRealityToolkit)
This happens in unity editor (it's related to inputsimulation)
no assertion raised...
workaround: if the asynccoroutinerunner already exists (by creating it in the root scene) there is no assertion.
assertion only appears when the asynccoroutinerunner is creating during this 'GGVPointer:OnSourceLost' event.
i would suggest to have it created on MixedRealityToolkit Awake, as it's not good practic anyway to create new gameobject/gamecomponent during runtime.
side question : why the 'DontDestroyOnLoad' is disabled for UNITY_EDITOR for this runner gameobject ?
any update on this ?
I think that in general our object teardown story isn't super fleshed out, so this isn't surprising - we can see if we can schedule some time in our next iteration to address this class of issues (it's not just this bug that's surfacing it)
assertion on go.isActive() is not triggered anymore in v2.0.0 while clicking on a button.
Though, it may still be present at some point due to the way AsyncCoroutineRunner instance is created.
Awesome, thank you for checking! Closing since this specific issue no longer repros in 2.0.