Godot Debugger creating an error by mispelling?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jack J

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

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.

duke_meister | 2018-07-10 01:07

How is a global search in Godot performed?

Jack J | 2018-07-10 03:30

:bust_in_silhouette: Reply From: eons

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.

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.

Jack J | 2018-07-10 03:29