Search This Blog

2021/02/27

Use timer to auto save game data | Godot Engine

 func _ready():

# Timers don't work unless they are in the tree

var timer = Timer.new()

timer.set_wait_time(1)

timer.connect("timeout", self, "_on_Timer_timeout")

timer.set_autostart(true)

self.add_child(timer)


func _on_Timer_timeout():

# autosave func

save_game()