0 votes

So, is there a built-in function to GDScript where I can pause a process in a script for a few seconds, say:

wait(1) #waits for 1 second
set_visible(true) #then continues the rest of the script after the 1 second wait
asked Aug 16, 2016 in Engine by apekke (21 points)
edited Aug 16, 2016 by Akien

2 Answers

+6 votes
Best answer


var t = Timer.new()
yield(t, "timeout")
answered Aug 16, 2016 by twinpixel (163 points)
selected Aug 17, 2016 by apekke

Don't forget to free the timer afterwards, or you'll cause a memory leak.

0 votes
answered Aug 16, 2016 by Akien (1,787 points)

Note that if you use those in the main thread, those will cause the project to freeze until the delay has expired.

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 How to use this Q&A? before posting your first questions.