Can't detect mouse over Area2D

Godot v4.3

I’m trying to detect when the mouse enters or leaves an Area2D. However, the signal functions aren’t even being called. Here’s my nodes and codes.

extends Node2D

func _ready():
pass

Called every frame. ‘delta’ is the elapsed time since the previous frame.

func _process(delta: float) → void:
pass

func _on_area_2d_mouse_entered() → void:
print(“Mouse Entered”) # Debugging
$Sprite2D.scale = Vector2(1.05,1.05)

func _on_area_2d_mouse_exited() → void:
print(“Mouse Exited”) # Debugging
$Sprite2D.scale = Vector2(1.0,1.0)

  • There doesn’t seem to be anything else that could be consuming input.
  • Visible and Pickable set to On, collision layer and mask set to 1.
  • I’ve double-checked that the signals are linked to the correct script.

I’ve even done this before and had it work, but I can’t see any difference in code between that project and this one, so I assume it must be some setting that is causing the problem.

Is any control scene shadowing “Node2D_Test” ?

Now that you mention it, both this and another scene with the same problem both have Control nodes as parents. Is that a problem?

If you got full rect on your control node, you need to set the right mouse settings to not overshadow everything under. There is a filter property on every control node

1 Like

Thank you - I found the filter and the problem is fixed!

Given the forensic nature of your response, I’m guessing that this is a common gotcha. Is there a list of Godot do’s and don’t’s that I might consult? If I am going to get caught out over settings, I’d rather they weren’t too obvious!

Considering all the possibilties in such an engine, every little bit has its own do’s and dont’s. The more you try out, the more you learn