Hi,
Well, I don’t know what to do anymore. I can hardly believe it myself.
I can’t manage to output a print
- when the player (collision layer 2)
- runs into an Area2D (collision layer 1, mask layer 2) with Collision Shape .
- The Area2D is in a StaticBody2D node.
I get no output:
extends StaticBody2D
func _on_area_2d_body_entered(body: Node2D) → void:
print(“test”)
- _on_area_2d_body_entered is normally displayed in green in the “Signals” tab.
- The script is on the StaticBody2D node (parent)
This has always worked before. But now it seems to no longer work. The only thing that is different is that I changed the version from 4.5 to 4.6 and I am now back to coding after a few weeks.
What am I doing wrong?
3 things come to mind for me, (1) Most importantly, you said that the player is on collision layer 1 and the area is in collision layer 2.Try making them both on the same collision layer.
(2) You might also need to check if the signal got disconnected somehow and reconnect the it.
(3) Not sure if this is how it is in your actual script, but I noticed that your code snippet doesn’t have the print function indented which could also be a cause of your issue.
Hopefully any one of these 3 will work.
1 Like
It seems that this doesn’t work either. I place the node in my scene, I can see it in the game. But no output print.
func _ready() -> void:
print("test")
Don’t worry, that’s bound to happen. Glad you figured it out 
1 Like