+2 votes

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?


in Engine by (293 points)

Maybe that's a bug? Do you have a minimal reproduction project?

I'm pretty sure it happens with any area2d collision shape when set as a child of a canvas layer tbh.

I am having this same issue. I am trying to check if mouse is over HUD with Area2D but is not working so far.

2 Answers

+2 votes

Check that the parent is not stopping the mouse.

by (143 points)

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).

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.

+3 votes

An expanded Control node can block the mouse to lower nodes.

Check if there is a Control node inside the CanvasLayer and change the property mouse_filter to Ignore.

by (261 points)
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.