Mixedrealitytoolkit-unity: Multiple click events raised from a single in-Editor click

Created on 13 Jun 2019  路  10Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Describe the bug

Using default MRTK configuration, in at least some situations a single click within the Unity editor (performed by holding left-shift and clicking the mouse on a click-responsive control) causes three click events to be raised within the input system, in my case on the _Left_PokePointer_, the _Left_DefaultControllerPointer_ and the _Left_GrabPointer_.

To reproduce

Set up a clickable surface (e.g. a Unity button) and add a script that implements IMixedRealityPointerHandler. In play mode, hold left-shift, point the controller ray at the button and click the left mouse button.
Break execution in the click handler and trace through to see repeated events.

Expected behavior

A single click on the part of the user should only raise a single Click event from the pointer deemed active.

Your Setup

  • Unity 2018.4.1f1
  • MRTK RC1 Refresh

Target Platform

  • HoloLens 1/2 (n/a, as behaviour is in-Editor)

Additional context

I'm guessing that reproduction may be inconsistent due to the interactable components used (e.g. graphic raycaster vs physics) and their structuring, though once you have it, repro is 100%. In my case the behaviour was highlighted because the clicked control activates new UI including a fallback listener that would immediately fire and close the UI up again, all in the same frame. My first control (a simple IMixedRealityPointerHandler implementer) fired on the DefaultControllerPointer's click. My fallback listener fired on the GrabPointer's click.

May relate to #3652

4 - In Review Bug Input System Release Blocker

All 10 comments

Looked into this bug while testing #3652 - I'm not reproing with a standard IMixedRealityPointerHandler on a Unity Button - can you share the script or project you're referencing in Additional context?

Here's a unitypackage that demonstrates the issue.
Note that I didn't include the MRTK in order to keep the filesize manageable, therefore to put this together:

  1. Start a fresh Unity project
  2. Import MRTK RC1 Refresh
  3. Import the attached package

You'll see a modification to MixedRealityInputSystem.cs will come in on step 3; this is simply a debug message that counts the raised pointer clicks - feel free to exclude it from the import.

MrtkRC1RMultipleClicks.zip

Thank you so much. Super helpful to get some additional context. Regarding the target platform, have you tested this on device? Digging through the callback, I suspect this is a bug in SimulatedArticulatedHand. I'll try to deploy on a HL2 today and take a look at the player.log.

A quick fix would be to check the type of pointer in FallbackClickHandler.

Something like:
if(eventData.Pointer.GetType() != typeof(ShellHandRayPointer)) { return; }

Many thanks for your time and for the offered workaround. The issue isn't time critical for me; actually it arose during a project port I was trying out to gather v2 experience. I'm just keen to track down and fix the root of the problem.
If I get some time tomorrow I'll try the test project on-device too.

Okay. This bug repros on HL2. I found the underlying issue in SpherePointer. This bug has actually been fixed for PokePointer in the latest mrtk_development.

The fix: SpherePointer currently does not filter for distance / NearInteractionGrabbable the way PokePointer does for distance / NearInteractionTouchable. As a result, SpherePointer always successfully evaluates to call BaseControllerPointer.InputDown() on any down action.

Nice work!

Addison is on pat leave so I'll be taking over the bug.

Give me a shout if there's anything I can do to assist!

merged.

Was this page helpful?
0 / 5 - 0 ratings