I have the following. Level and player are dynamically loaded.
CharacterBody2D
This is the player. It has collision shapes and the player can walk and physics work. The player also gets BodyEntered events from the floor.
Area2D
The coin. Including a CollisionShape. The shape is visible in Debug mode. All seems to work. Monitoring and Monitorable are enabled. I selected all collision layers and all masks.
I register for the AreEntered event in the Scene Node:
public override void _Ready()
{
area = GetNode<Area2D>("Area2D");
area.AreaEntered += (node) => OnCoinBodyEntered(node);
}
...
public void OnCoinBodyEntered(Node2D body)
{
GD.Print($"OnCoinBodyEntered {body.Name}");
QueueFree();
}
OnCoinBodyEntered is never called. When I replace the Area2D with a StaticBody2D, then the Player can walk on this as expected.
Any Idea what the problem could be? Any info is welcome.