@llasram said:
@Wafflily -- I haven't done any real Godot UI programming yet, but what prevents you from using SceneTree#set_input_as_handled() and normal input event propagation to deliver your events only where they should go? My understanding is that events move up the node tree from leaves to root being passed to _input()
until something marks the event has handled; if nothing handles the event then it repeats through the tree calling _unhandled_input()
. Is there some subtly to marking events as handled I've not yet encountered?
_input
will process the input regardless of whether its been marked as processed or not, so marking the event will not stop future _input
functions from receiving the input. _input
will always receive the input event and as far as I know, there is no way to stop a single event. You can turn off the function from processing input on a per-node basis though, using set_process_input(false)
, if I recall correctly.
_unhandled_input
does more like what you are describing, as input is processed top-to-bottom until either the input event is handled, or all of the nodes have had their _unhandled_input
function called.
I'm not sure on the order, but I believe _input
is called after unhandled_input
. Regardless, an event processed in _unhandled_input
will still be called in _input
, even if marked as processed.
The problem with _unhandled_input
in the OP, if I am understanding the issue correctly, is that the UI setup used catches the input event before it can reach either of the Area2D nodes.