Timer wont work

Godot Version

Godot 4.2

Question

I’m new to godot engine. I’m taking the lesson “My first 2D Game”
I wrote the entire code - from beginning to end, and I did not have any problems with any part of it, but specifically with TIMERS - everything went downhill

I followed everything written in the tutorial:
Called a signal via {timeout()}, connected it to the “Mane” Node
I wrote the code, and everything works fine for me except the timers. NONE of the timers are working. Maybe I don’t understand something, or missed something???
I wrote myself an easy code example to check if the Timer actually works and if it doesn’t. And the code does not cause any error - the TIMER does not turn on silently

Did you connect the OnTimerTimeout() function to the timeout signal of the Timer? You can select the Timer node, click on the Node dock on the right and in the Signals tab you double click on the timeout signal and choose your function to connect to.
Also, if you are using C# you have to specify the type of the Timer node when you get it
GetNode<Timer>("Timer").Start();

You can also connect the signal in code
GetNode<Timer>("Timer").Connect(Timer.SignalName.Timeout, Callable.From(OnTimerTimeout));

Yeah I do those all.
Site just clear some strings from my topics, idk why
Anyway here is screen with all what u need to know about my project:

You connected a wrong function. You connected a function called _on_start_timer_timeout but your function name is OnStartTimerTimeout

1 Like

Im wroted C#
Read a basic C# syntax in godot

Timeout fires when the timer reaches 0, not when it starts. Check if it prints once the timer reaches 0.

I did this about 20 times, and I just did it again, the result is the same - the timer does not start

Many possible reasons why your code isn’t working as expected. Here are a few:

  • Make sure the timer’s paused property is false.
  • Make sure its wait_time is what you expect it to be.
  • Make sure your main scene is set to Main and not Player, and that you are testing by just running the main scene.
  • Make sure your game isn’t paused.
  • Make sure the Main node process_mode isn’t set to PROCESS_MODE_WHEN_PAUSED.

This is the problem. You need to connect to OnStartTimerTimeout. It won’t auto convert the name of the function you’re connecting to from snake case to PascalCase.

1 Like



I have NO any problem u wroted

Right now im reading tutorial by official site and see no any convert’s by Pascale to snake

Anyway - how Im can do that. If it possible

Disconnect the signal, and reconnect it, typing the PascalCase name of your C# method instead of the snake_case name meant for GDScript.

1 Like

OMG. This is WORK! I don’t know who u r man, but u HERO what i deserve
LOVE U

P.S.
Official tutorial need deeper C# explanations syntax in a GodotEngine

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