Godot:Timer
lastmod 2021-01-28created 2020-09-208 edits
godot - a countdown Timer.
AutoStart Example
Unless you start it separately in code, you must set the Autostart property to On in the Inspector for it to work properly.
You need to connect the timeout event under Signal.
using Godot;
using System;
public class Piano : Node2D
{
// ...
private void _on_Timer_timeout()
{
GD.Print("Timer !!");
}
}
Creating a timer dynamically
timer = Timer.new()
timer.set_one_shot(false)
timer.set_timer_process_mode(TIMER_PROCESS_FIXED)
timer.set_wait_time(0.6)
timer.connect("timeout", self, "_timer_callback")
timer.start()
add_child(timer) # <-------- 중요!
See also
- godot
- Godot:Signal - How to connect signals
Favorite site
- Sync the gameplay with audio and music — Godot Engine (stable) documentation (Korean) - Syncing gameplay with audio and music