0 votes

I just made the first game in the Godot: Sam's Teach Yourself book, and to all appearances everything works great, but Godot still reports an error:

ERROR: emit_signal: Error calling method from signal 'timeout': 'Node2D(stage.gd)::_on_spawnTimer_timout': Method not found.

In this error timeout is spelled incorrectly, but I do not believe I have done this myself. The Timer named spawnTimer is connected with a correct spelling, and the function within the Node2D which it connects to is also spelled correctly. The code initiated by the spawnTimer timeout also operates as intended, so I don't really know what is causing the error. The only incorrect spelling I can find is coming from the debugger.

func _on_spawnTimer_timeout():
    var asteroidInstance = asteroid.instance()
    asteroidInstance.position = Vector2(SCREEN_WIDTH + 8, rand_range(0, SCREEN_HEIGHT))
    asteroidInstance.connect("score", self, "_on_player_score")
    asteroidInstance.moveSpeed += score

    $spawnTimer.wait_time *= .99
in Engine by (39 points)

This is why I hate things being so string based. Out of curiosity try doing a global search of all your project's files for "timout". And maybe provide the code that does the connect.

How is a global search in Godot performed?

1 Answer

+1 vote
Best answer

If you have connected it via editor, maybe you edited the function, disconnect and reconnect or edit the tscn file with a text editor, signals are defined at the end of the file.

If connected by code, be sure to have the callback correctly named.

by (7,922 points)
selected by

It turns out I had the Timer connected twice. I had it connected through the editor as well as in the code. I was only able to see it once I disconnected the editor signal and commented out the function. It was then that I saw I still got the error, and found the problematic line of code.

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 Frequently asked questions and 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 [email protected] with your username.