+1 vote

I'm working on a mobile game. I'm having a hard time telling apart taps from touch screen buttons from regular ones from the remaining screen.

Is there a way to prevent event propagation for touch events for filter them somehow?

I tried setting a custom action name on the TouchScreenButton nodes and tried to filter them with event.is_action to no avail.

in Engine by (81 points)

2 Answers

0 votes

I'd go the easy route, creating two different states, deactivating the game logic while the ui is on... or at least deactivating key objects that could get in the way.

by (227 points)

This won't work because the ui is always visible.

0 votes

You can set input event as "handled" so it doesn't trigger anything else by calling

SceneTree.set_input_as_handled()

but it seems that is not working well on android.. I disable input on other nodes when I detect a touch on UI.

by (523 points)

I opened this issue on github. Would help if people interested wold support me there so we can have this solved.
https://github.com/godotengine/godot/issues/13256

This PR is going to fix the problem:
https://github.com/godotengine/godot/pull/11305
I just did the testing, works as advertised.. But it took me more than two hours to figure out the Android template compiling .. But now it works, if someone want to try the android_template, maybe I will post it for dl somewhere..

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.