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
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?