Topic was automatically imported from the old Question2Answer platform.
Asked By
stubbsy345
I have some area2D’s as a child of a canvas layer. For some reason, when the child of a canvas layer the mouse entered signals no longer work. Does anybody know why this is?
Thanks!
Maybe that’s a bug? Do you have a minimal reproduction project?
Zylann | 2018-04-05 01:08
I’m pretty sure it happens with any area2d collision shape when set as a child of a canvas layer tbh.
stubbsy345 | 2018-04-05 16:58
I am having this same issue. I am trying to check if mouse is over HUD with Area2D but is not working so far.
It isn’t. The scene works fine when working by itself. But won’t work when as the child of a canvas layer. (I instance the scene onto a canvas layer from within the main game).
stubbsy345 | 2018-04-05 16:57
Can any of the other objects get mouse events. Also, I might not have been explicit enough in my answer. I meant to check that the parent object doesn’t have its mouse_filter property set to MOUSE_FILTER_STOP.
It might be worth making a simple example and linking it here.
In case anyone else is having the problem. I am using in this sequence: Controls, Panels, SubViewportContainer, SubViewport, CanvasLayer, Node2D, Area2D, CollisionShape2D. All of those with the filter have been set with mouse filter to Pass including “self.mouse_filter = Control.MOUSE_FILTER_PASS” in the _ready of SubViewport. I found the solution to the mouse problem was to turn on the Physics->Object Picking of the SubViewport.