Can't detect area 2D collision

Godot Version

v4.1.1

Question

I can’t detect area collision 2D from two CharacterBody2D’s, this is the code which is in the first CharacterBody:

func _on_area_2d_area_entered(area: Area2D) → void:
get_tree().quit()

(the get_tree().quit() is a placeholder to know if it works)
I am trying to make it so that only one CollisionShape2D is a child to an Area2D while other CollisionShape2D’s are not.

And is it a problem that in the second CharacterBody2D without the script attached to it isn’t a child node to a Area2D but instead is just a CollisionShape2D?

I have both the Area2D in the first character and the CollisionShape2D in the second character in groups.

I also have the CharacterBody2D’s in separate collision layers while the area 2D is in both collision layers, this is because I didn’t want them to collide but instead just phase through each other, while still detecting is that Area2D has collided with the other CollisionShape2D.

I just fell into the same problem yesterday. Had me stuck for a few hours.

And is it a problem that in the second CharacterBody2D without the script attached to it isn’t a child node to a Area2D but instead is just a CollisionShape2D?

this is your problem. In this use case, the signal you’re looking for is not area_entered.

instead, use body_entered.

My theory that i haven’t tested yet is Area_entered is for overlaps in Areas only, but in this case it’s a CollisionBODY entering an Area, not an Area entering an Area.

thank you so much, that has been stumping me for so long.