This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes


I am attempting to code for touchscreen input; there are two different ways that I am processing input.

I created two different scripts to attach to control nodes; one processes the input in one way, and the other script processes the input in a second way. As an example, a mouse click might print "A" to the output in the script one, and a mouse click might print "B" to the output in script two.

I can get the scripts to work. If I place them in the same scene (on different control nodes), they will both process the input: "A" and "B" will both be printed to the output.

What I wish to do is limit the input processing to one of the two scripts depending on where in the viewport the mouse click occurs.

I have tried, for example, creating two control nodes and set the size to give two rectangles - say each covering half the viewport. However, it doesn't matter in which control node rectangle the mouse is pressed, both will process the input. I can't find a way to limit the input processing to a particular script, with the particular script dictated by the location in the viewport in which the event occurs.

There must be someway to limit which script processes the input determined by the location in the viewport in which the event occurs?

in Engine by (20 points)

1 Answer

0 votes

Managed to get it working with:

func _gui_input():

Input events propagate up the tree and can be captured by particular control nodes before others if _gui_input() is used.

by (20 points)
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 Frequently asked questions and 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 [email protected] with your username.