Touchscreen mode

Godot Version

4.2.1

Question

Hi everyone, I need assistance with regards to buttons, I want them to work on a Touchscreen and desktops, In this case here is the code below: func _on_exit_gui_input(event):
if (event is InputEventScreenTouch && InputEventMouseButton):

&& means: “and”. You probably want ||, which means “or”.

Also you need to include event twice. I don’t know, what && InputEventMouseButton would actually do:

if (event is InputEventScreenTouch || event is InputEventMouseButton):

when i do that (“||”), when i hover around the button it automatically gets pressed.

In that case the problem is likely located in a different part of your code. Can you please share, how you continue to process the event?

When i use the BaseButton pressed signal, everything works properly.