Input System On-Screen Button doesn't work with touchscreen 2019.3.2f1
I've been stuck with this for a week now.
I am trying to make my player jump whenever the space button is pressed (if a keyboard is present), and I'm adding a on-screen button for players on mobile. The on-screen button works fine in the editor but when I try the game in a device (and android phone) the on-screen button doesn't work.
Here's how things are set up:
Change the
Active Input Handling
toInput System Package (New)
on the player settings.Create the
Jump
action for thePlayer
action map.Bind
<Keyboard>/space
to myJump
action.Add a
PlayerInput
component to my player object, pass my actions file to it, and set up the events to call for each action.Change the
StandaloneInputModule
to anInputSystemUIInputModule
in my event system object.In my canvas I add an image and add
OnScreenButton
component to it (I do NOT add aButton
component).Set the control path to
<Keyboard>/space
.
When I try the game on the device the rest of the UI buttons work fine except the on-screen button. On the editor though (using mouse input), the on-screen button works fine. This is my first time using the Input System, I had actually found it somewhat nice to work with, however this does seem really strange. It is either a really strange bug (unlikely), or I messed up some setting (the setup process feels really convoluted actually).
Hi, did you ever deter$$anonymous$$e what the issue was? I have been attempting to do the same thing and running into the same problems.
Nope and just as with many things with unity, it's such a basic thing and there seems to be no simple way to do it.