All interactables with Is Global checked are triggered OnClick
Describe the bug
Any buttons with Interactable.cs attached, Is Global checked and contain an OnClick event are all triggered at the same time when another button is manually selected on air tap/press. Speech commands work fine and only trigger one event.
To reproduce
Steps to reproduce the behavior:
- Go to MixedRealityToolkit.Examples > UX > Interactables > InteractablesExamples
- Add a SetActive false event to the AnimationButton object
- Check the Is Global box under DefaultInteractableStates section on the AnimationButton object
- Click Play button to run in the editor
- When running click the Button or ToggleButton object. The Animation Button object should then disappear.
Expected behavior
Only the event on the button being manually selected/tapped/pressed should be triggered
Screenshots
Your Setup (please complete the following information)
- Unity 2019.1.11f1
- MRTK v2.0.0 RC2.1
Target Platform (please complete the following information)
- HoloLen
Additional context
I was under the impression the the Is Global setting would only apply to speech commands.
@reddo123, can you provide more information about your use case? IsGlobal is meant to allow the Interactable to listen to all input within the scene, whether the object has focus, physical interaction or not. Something like a modal or click anywhere to proceed scenario or press any button. Deselect IsGlobal to have the Interactable only respond to focused or physical interactions.
The "IsGlobal" terminology may be misleading here, understanding the use case will allow us to describe it better.
Thanks for the clarification. The use case is to have voice commands as global, so the button doesn't have to be focused on to trigger the event. I understand unchecking RequiresFocus is meant for this but this doesn't seem to work, which may instead be where the issue lies.
That is a good point, the Requires Focus should cover that scenario. Unfortunately MRTK 2.0.0 RC2.1 had a bug with how speech commands work with Interactable and exactly what you mention here. This Issue #4598 was closed a week after RC2.1 but should be fixed #4695 in the next release.
@reddo123 now that GA 2.0.0 is released, can you try this scenario again? Thanks!
Tested with 2.0.0 and looks to be fixed. Thanks.