Topic was automatically imported from the old Question2Answer platform.
Asked By
popcar2
Title pretty much sums it up. I’ve tried the following code in my Panel:
func _on_gui_input(event: InputEvent):
if event is InputEventScreenTouch and event.is_pressed():
# Run code...
Apparently this doesn’t work. Using InputEventMouseButton to detect clicks also doesn’t work on mobile. Is there any way to detect touch input with the gui_input event?
does it detect your input when you click the panel with the mouse? if not, there might be a control node blocking the input event.
If you go to project settings, and then to input_devices/pointing, you’ll see that there’s an option to emulate mouse clicks from touch, make sure the option is turned on.
try doing this from a different browser and see if it’s any different
I’ve checked these things, but it turned out I might’ve been double clicking with the touch because I was detecting any mouse input.
if event is InputEventMouseButton and event.is_pressed()
Changing it to only check the left click worked:
if event is InputEventMouseButton and event.is_pressed() and event.button_index == 1: