$timer.set_wait_time(not_working)

Godot Version

4.2.1

Question

So I started this project with a learn as you go style, so please pardon my crappy code.
Anyway this project was started around march and based on the documentation for $timer.set_wait_time() it was working as intended. But now in august as you can see in the output console setting the wait time in code doesn’t work anymore, and it is using the inspector wait time instead.
Thank for any help.

When a Timer is started, it begins counting down from the wait_time it has at that time. Because your Timer is set to autostart in the editor, it begins counting down from 5.

To set the wait time from the _ready notification, first turn autostart off. Then, you can call $timer_queue_free.start(10)

Alternatively, you can always stop and start the timer after changing the wait_time

Thanks for the quick reply.
I was stuck on this for a decent bit, good to know now that the editor has a higher priority.

I’m glad to help! For future reference, the exact order is documented here, in case this kind of thing happens again: GDScript reference — Godot Engine (stable) documentation in English

But basically, it boils down to:

  1. Regular assignments in the file, then _init()
  2. The editor overwrites it (if it’s a resource or node)
  3. @onready followed by _ready()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.