Page 1 of 1
"Submit" not detected after mouse click?
Posted: Sun Mar 14, 2021 4:49 pm
by forrestuv
Hi,
what could be the reason why "Submit" input from joypad is ignored after I mouse click on Game window? (thus I cant fastforward)
I have no InputDeviceManager component therefore it shouldn't switch to mouse mode?
Re: "Submit" not detected after mouse click?
Posted: Sun Mar 14, 2021 5:36 pm
by Tony Li
Hi,
What you describe is normal Unity UI behavior. If you click on the screen, the Unity UI EventSystem will try to select whatever UI element you clicked on. If no UI element is under the mouse cursor, or if it's not currently interactable, then the EventSystem will deselect everything.
One of the primary purposes of the Input Device Manager component is to address this. If the Input Device Manager has detected that you're using a joystick, or if you've ticked Always Auto Focus, then it will keep a relevant UI element selected (focused), even if you click on the mouse elsewhere. (The "Submit" input only clicks the EventSystem's current selection. If nothing is selected, Submit won't do anything.)
If you don't want to use Input Device Manager, Dylan Wolf posted a
Gamasutra article with various Unity UI tricks. He provides a short script called PreventDeselectionGroup that works similarly.