–1 vote

I set up some custom code to connect nodes via groups rather than signals. The following sample is what I put into the root node of my main scene:

func _ready():
    var player = get_node("Jo")
    var interactables = get_tree().get_nodes_in_group("Interactables")
    for i in range(interactables.size()):
        var currNode = get_node(interactables[i].get_path())
        var areaNode = currNode.get_node("Area")
        var args = Array([currNode])
        areaNode.connect("body_entered", player, "_on_Area_body_entered", args)
        areaNode.connect("body_exited", player, "_on_Area_body_exited", args)

When the Player collides with a target node's Area it functions as intended. However, I end up with the following errors in the debugger. How do I stop these from occurring?


in Engine by (15 points)
edited by

does player (a node named as "Jo") have _on_Area_body_entered function?

1 Answer

+1 vote

You are getting this error because you connected body_exited to your player node with the _on_Area_body_exited function name. However, you didn't define such function in your player node (Godot didnt find it). Maybe you forgot, or maybe you mistyped it.

If you are sure your scene works, then just don't connect body_exited.

by (27,962 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.