Android Touch Events occasionally sticking (no OnPointerUp event)

I updated my mobile game to use the new Input System. Since then, I have had problems with touch events on Android (two devices tested). I have two Canvas UI images for forward and reverse buttons. They originally used Unity Event Trigger components, PointerUp and PointerDown when the buttons were pressed or released by the player. They worked fine. With the new Input System, the buttons ‘stick’ and remain active at random. In tests, it looks like the OnPointerUp event is either failing to fire or not being picked up by the script.

I converted the code to use IPointerUp, IPointerDown, removing the Event Trigger component from the screen buttons, but this did not help. In one final fix attempt, I switched to using InputActions for all player controls (Keyboard and GamePad). Each Canvas UI button uses the Unity-provided ‘On-Screen Button’ component with the Control Paths set to the relevant Keyboard controls. The new configuration works fine on Android - but the touch input is still randomly sticking at 1. At this point, 100% of the control input is being handled by the Input System. I just pull the value from the Input Actions with:

throttlePower = _pedals.ReadValue();

I don’t see how I can fix this. I am outputting the raw control input value (above) while testing and can see the Input Action value randomly sticking at 1 (no fingers touching screen). The control can only be reset to 0 by touching it again (presumably firing the OnPointerUp event correctly?)

I have tried every possible solution I can think of, short of reverting back to the old Input System. I’m not an advanced coder, so maybe someone with more experience can help? I’m not sure what else to try. Thanks!

Actually I have experienced the exact same issue. Unfortunately I could not find any fix, so the problem persists…

Good to know it’s not just me! :slight_smile: It happens on fast Android devices too, so I don’t think it’s a bottlenecking issue. It didn’t happen with the old Input System, which used the same OnPointerDown/OnPointerUp event method of activating the controls. Hopefully, we’ll get a fix!

1 Like

I use Both Input System. On the editor, everything works fine even if freezing occurs; but when built on Android, I found that if I stopped touching while the game was freezing, Input.GetMouseButtonUp(0) and OnPointerUp did not receive events. But I think that the input event should not be skipped even if the game freezes, but should be triggered correctly in the next Update.

1 Like