Following this tutorial:
After setting up Area2D and CollisionShape2D to detect a player coming near a sprite, the tutorial writes this signal as follows:
func _on_player_detection_body_entered(body)
if body.name == "Player":
print("Player")
I'm writing the scripts in C#, so my version of the function looks like this:
private void _on_player_detection_body_entered(Node2D body)
{
// Replace with function body.
Console.WriteLine("hi");
Console.WriteLine(body.Name);
}
However the function doesn't trigger when the player approaches the sprite. Furthermore, I'm getting the warning: "Missing connected method 'on_player_detection_body_entered' for signal 'body_entered' from node 'Frog/PlayerDetection' to node 'Frog'."
I've tried changing the function name to "OnPlayerDetectionBodyEntered(Node2D body)", but that only results in the debugger throwing errors about not finding '_on_player_detection_body_entered'.
What am I doing wrong?