This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hello! I'm following the tutorial at docs.godotengine.org/en/stable/gettingstarted/stepby_step/signals.html
and it spits an error at me when i try to func _ready(): ....var timer = get_node('Timer') ....timer.timeout.connect(toggle_visibility), where toggle_visibility is a declared function.
The error remains even if I copy-paste the code into the editor.
How do I do this?

Godot version LTS
in Engine by (20 points)
edited by

1 Answer

+1 vote
Best answer

You posted 4.0 code and linked to the G4 documentation, but are using an LTS? You likely want the version of the documentation that matches:

https://docs.godotengine.org/en/3.5/getting_started/step_by_step/signals.html#connecting-a-signal-via-code

func _ready():
    var timer = get_node("Timer")
    timer.connect("timeout", self, "_on_Timer_timeout")

You can change the documentation version down the bottom left of the screen where it says 'Read the Docs'

by (1,406 points)
selected by
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.