InputEventScreenTouch and InputEventScreenDrag

Godot Version

Godot 4.2

Question

I have this simple code here:

func _input(event):
	if event is InputEventScreenTouch:
		print("Touched")
		
		if not dragging and event.pressed:
			dragging = true
			draw(get_global_mouse_position())
		if dragging and not event.pressed:
			dragging = false

	if event is InputEventScreenDrag and dragging and event.pressure != 0:
		draw(get_global_mouse_position())

When I run it on mobile, it just doesn’t work. It should at least print out “Touched”, but it doesn’t. I know for a fact that it works though, since i have “Emulate touch from mouse” enabled and it works when I run it on PC. What might be causing this?

i think you should uncheck the other one when on mobile:
image

Actually I did, forgot to mention that, so that’s not the issue here

you have a dedicated console for the mobile?
because afaik, remote debug wont print anything in pc godot editor happening in the mobile run

It actually does print, I tested by just printing something in the _ready() function of the same node and it did print.

i see, probably mine bugged then, there’s no print from remote debug run
last thing it prints was the installing to said device

anyway, try print(event)
see if it even pick up any input

I was mistaken, it wasn’t magically fixed. No, it still doesn’t detect InputEventScreenTouch or InputEventScreenDrag

then what it detects? the print(event) should print the Input type name and other several parameters along with it

It just doesn’t print anything. It only detects InputEventPanGesture and InputEventMagnifyGesture when I use two fingers, but nothing when I use one finger or a pen.

just want to make sure what kind of rendering you export for android?

If you’re talking about the rendering/renderer/rendering_method setting, I’m using mobile. If not, I don’t know where to check.

1 Like

image
will change back to this send any screeninput?

Nope, still nothing.

maybe try check it from unhandled input

func _unhandled_input(event):
	print(event)

I found out the problem, it was actually very simple. There were some Control nodes with their mouse_filter on Stop and they were stopping the input. Mentioning _unhandled_input made me think of that. Thank you for helping me!