0 votes

I have Node2D which needs to process input events unless they are not processed by its children.


Children need to process input only if the mouse is above them, the root doesn't care about pointer position. So I use _input_event for children and _unhandled_inputfor the root. But _input_event is always called after _unhandled_input.

How can I make children process input first?

One of the possible solutions is to make the root Area2D covering the entire viewport, but it looks bad in terms of performance in case of many instances.

Another workaround is to use _unhandled_input on children too and manually check if events position collides with the area. But I don't know how to convert mouse position to local coordinates because scene tree can have any depth and parent objects can be scaled.

Do you have any ideas?

asked Oct 17, 2019 in Engine by askhat (14 points)
edited Oct 17, 2019 by askhat

The first solution also doesn't work. Parent.inputevent is called before child.inputevent. Is it intentional or is it a bug?

Please log in or register to answer this question.

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.