MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Dropdown bug for right hand

Open bhtruong93 opened this issue 5 years ago • 11 comments

Describe the bug

On HL2, we're unable to use the right-hand pinch gesture to scroll on a dropdown's options list. The left hand works as intended.

To reproduce

Repo: https://github.com/bhtruong93/dropdown-bug Build: https://github.com/bhtruong93/dropdown-bug/releases/tag/v1

Steps to reproduce the behavior:

  1. Build and launch the app on a Hololens 2
  2. With the left hand, confirm that the dropdown behaves as expected. Open and scroll the dropdown's options list
  3. With the right hand, do the same thing and notice that the dropdown opens, but when trying to scroll, the dropdown closes

Expected behavior

The right hand is able to scroll on the dropdown's options list like the left hand.

Screenshots

https://user-images.githubusercontent.com/13461241/140886420-bc9e4300-1ad0-46cb-afb9-84ed1364bebb.mp4

Your setup (please complete the following information)

  • Unity Version 2020.3.19f1

  • MRTK Version 2.7.2

Target platform (please complete the following information)

  • HoloLens 2

Additional context

In Unity, I'm unable to reproduce the bug using the keyboard to emulate input. However, I am able to reproduce it when using Holographic Remoting

Something odd I'm noticing is that if I click anywhere on another window beside the Game window (Like Inspector or Console), it starts behaving correctly. But if I click back to the Game window, the bug reappears

bhtruong93 avatar Nov 09 '21 08:11 bhtruong93

@davidkline-ms , Our partner is hitting this odd issue. Is this something we've seen before? Do you know what might be failing here?

AMollis avatar Nov 09 '21 18:11 AMollis

Hey @elbuhofantasma can you please do a repro of this on HL2?

polar-kev avatar Nov 11 '21 00:11 polar-kev

Ran into similar issues with the MRTK NonNativeKeyboard. Like @bhtruong93's issue, it only happens with the right hand and seems input-related.

After clicking the backspace button, it remains highlighted. When interacting with another button, the backspace button fires again. After investigation, seems to been an issue with the MixedRealityInputModule.cs class, which is not clearing eventSystem.currentSelectedGameObject field, leaving it open for repeated interactions (image attached).

After some investigation, I've found that the first backspace interaction happens going through MixedRealityInputModule line 161 (ProcessMouseEvent), and runs as intended. Other keyboard inputs go through the same line and behave as expected. The undesired input actually goes through MixedRealityInputModule line 180 and calls the Process method in the base class. When this happens, eventSystem.currentSelectedGameObject still holds reference to the backspace button.

A possible cause is that the reference is not being cleared or is being hard-set when the reported issue happens. As such, when the base class Process method is called (which would not be problematic regularly) issues are produced as the field is not empty as it was expected. However, this is an inferred theory from what evidence is available through debugging fields and stack traces, may as well be the tip of the root cause.

Hope these findings help in solving the issue.

IssueEvidence

DanDomingues avatar Nov 16 '21 21:11 DanDomingues

@MaxWang-MS can you take a look at this?

polar-kev avatar Nov 17 '21 18:11 polar-kev

Hi @bhtruong93, thanks for reporting the issue. I have successfully reproduced the issue and am now looking for a fix.

MaxWang-MS avatar Nov 20 '21 02:11 MaxWang-MS

On some investigation with @MaxWang-MS, this is looking to be because the OpenXR plugin is reporting HoloLens right hand select across both button 0 (the offending button the InputModule is reading as "submit"), while Window XR Plugin reported it button 15. Looking at https://docs.unity3d.com/Manual/xr_input.html, those correspond to primaryButton and triggerButton respectively. I'll follow up with Unity!

keveleigh avatar Dec 02 '21 00:12 keveleigh

Bug has a fix, but is being provided on an as-needed basis instead of integrating into v2.x because it is patching a Unity oddity around event mappings.

m-the-hoff avatar Dec 15 '21 18:12 m-the-hoff

@m-the-hoff Where can the fix be found? Will it be in MRTK 2.7.3

AMollis avatar Dec 15 '21 19:12 AMollis

Where can the fix be found? Will it be in MRTK 2.7.3

It will not be in MRTK 2.7.3. I'll provide it here after it's been validated.

keveleigh avatar Dec 29 '21 20:12 keveleigh

@bhtruong93 I've uploaded a workaround to https://gist.github.com/keveleigh/f15a71ad823c72c249b315ee8e23227f. You should be able to import this and select it as an Interaction Profile in the OpenXR settings in Unity. I'd also recommend using the following as the meta, to keep the GUID consistent.

fileFormatVersion: 2
guid: a83ebf68a11557841a8f8ecf943bc6b4
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 

keveleigh avatar Feb 15 '22 16:02 keveleigh

I've tried the microsofthandinteractionlegacy.cs but doesn't work on a dropdown scroll bar for me (Hololens 2). If I disable microsoft hand interaction then I can't select anything. Probably I'm not implementing it correctly. Left hand works fine. openXR

BFS22 avatar Apr 06 '23 16:04 BFS22