Area2D body_entered signal not working

Godot Version

v4.7.1.stable.mono.official [a13da4feb]

Question

Im trying to make an Area2D send a signal to my main Node2D to print something when the player enters. However it just never prints anything. Both have the same collision layer and mask. Both have a CollisionShape2D and the player is using a CharacterBody2D.

extends Node2D


func _on_area_2d_body_entered(body: Node2D) -> void:
	print(body)
	print("Has entered")

I also tried writing code straight to the Area2D but even then it printed nothing

extends Area2D

func _ready():
	body_entered.connect(entered)

func entered(body):
	print("test")

Ive just started 2 days ago so id really appreciate some help :slight_smile:

Can I see a screenshot of the code, and the layers and masks of both the player and area.

Hey, if you are not using the node’s default layer/masks there might be a chance those are not configured correctly. You mentioned both nodes have same layer and mask. Just make sure the Area collision mask has at least one layer that is the same as in the player’s collision layers. In other words, if the CharacterBody2D is on collision layer 1, the Area2D should have the collision mask 1 set as well to detect the player.

You might have seen this already, but in case not, this doc might explain it a little better: Physics introduction — Godot Engine (stable) documentation in English

The only other thing that comes to my mind assuming the collision bodies are indeed set correctly, is that the Area has a “monitoring” field in the Inspector dock. Make sure you didn’t disable that by accident.

Good luck!