Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InteractionSource IDs aren't stable across app focus changes, resulting in cursors that never disappear #8016

Closed
matthejo opened this issue Jun 3, 2020 · 6 comments

Comments

@matthejo
Copy link
Contributor

matthejo commented Jun 3, 2020

Describe the bug

When a HoloLens app loses focus and is not set to run in background, upon resuming the app, MRTK cursors can be left dangling from previous sessions. These cursors never go away until you kill and restart the app cleanly.

To reproduce

  1. In the MRTK HandInteractionExamples scene, change the Player Preferences "Run In Background" to unchecked.
  2. Launch the HandInteractionExamples scene on a HoloLens 2.
  3. Click on the "Launch Edge Browser" button, then close Edge.
  4. Repeat this a few times (for me, usually less than 5).

Expected behavior

Each time the HoloLens app is reactivated, the correct set of hand rays appears.

Screenshots

You can see in this screenshot that there's a third disconnected hand ray pointed at the slate. This hand ray never goes away.

image

Your setup (please complete the following information)

  • Unity Version 2018.4.20
  • MRTK Version v2.2, v2.4

Target platform (please complete the following information)

  • HoloLens 2

Additional context

I've traced the InteractionSource IDs as they result in creating and destroying cursors. You can see from this trace that there are not matching IDs after the app is suspended and restored, where a RemoveController for 2000000402 occurs with no matching AddController, and an AddController for 2000000401 occurs with no matching RemoveController.

Event Callstack
AddController 2000000399 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceDetected
AddController 2000000400 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceDetected
RemoveController 2000000399 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceLost
AddController 2000000401 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceDetected
[6/3/2020 3:06:17 PM]OnApplicationGetFocusAsync  
RemoveController 2000000400 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceLost
AddController 2000000400 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceDetected
RemoveController 2000000402 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceLost
AddController 2000000402 Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input.WindowsMixedRealityDeviceManager.InteractionManager_InteractionSourceDetected
@matthejo matthejo added the Bug label Jun 3, 2020
@keveleigh
Copy link
Contributor

keveleigh commented Jun 8, 2020

This sounds like a Windows (or Unity) bug to me. MRTK responds to the IDs provided by the Unity APIs, so if they're firing in unexpected orders or with unexpected IDs, it might be an issue with the Windows or Unity API.

@david-c-kline
Copy link

Perhaps MRTK should explicitly remove all controllers on resume to ensure that everything is cleaned up.

@keveleigh
Copy link
Contributor

keveleigh commented Jun 10, 2020

Perhaps MRTK should explicitly remove all controllers on resume to ensure that everything is cleaned up.

This feels like it might end up hiding any potential underlying issues. There's an assertion that the Windows API should fire source lost events when the app is paused and new detected events when the app is resumed. We shouldn't need to do anything special here.

There's additional work being done here on the Unity side around the matrix of PresentPassive vs PresentActive vs Absent and how Unity should handle it. It's possible we're running into a case here where the app isn't being suspended in the way we expect.

@RogPodge
Copy link
Contributor

RogPodge commented Jul 7, 2020

Believed to eventually get fixed on Unity side as its a bug on their end

@polar-kev
Copy link
Contributor

A fix for this is expected from Unity on May 7th and will require an up rev in Unity versions. We will need a repro test from Remote Assist at that point.

@keveleigh
Copy link
Contributor

Going to close this down as likely fixed by Unity. Please reopen if this isn't the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants