How to receive input events in an Area2D on top of a Control node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blinry


We are building a drag-and-drop system that’s currently using Area2Ds to define the shape of drop areas. We now want to implement dragging things onto GUI elements.


When we put Area2Ds inside of a Control node (which also needs to respond to clicks, so its MouseFilter can not be set to “ignore”), there doesn’t seem a way to receive input events. The InputEvent tutorial describes that as soon as any Control node reacts to an event, the _input_event method won’t be called anymore on areas/physics objects.


Do you see a way to react to input events in an Area2D, which is on top of a Control node?

Should we change our approach? Define drop areas using control nodes? We love the flexibility to define arbitrary shapes with areas, though.

have you tried using CanvasLayer on Area2D?

asetyowatir | 2020-11-08 07:57

:bust_in_silhouette: Reply From: blinry

We settled on a workaround where a 1x1 px area follows the mouse pointer, and we listen for intersection events with the area we’re interested in.