Material Box

Material Box

WEB Design & Material Images

Godot - Implement delay processing with await

Godot

Code example for implementing delay processing with await and create_timer() in GDScript.


It is possible to implement delay processing using await and create_timer().

This code has the following features:
- Specify delay time in seconds as argument of create_timer()
- Delay all subsequent processes

await get_tree().create_timer(3.0).timeout
print("await")

When used in iterative processing, increasing the delay time may yield the expected result.

for i in enemies:
	await get_tree().create_timer(i * 3).timeout
	print(i)

Godot

TitleGodot - Implement delay processing with await

CategoryGodot

Created

Update

AuthorYousuke.U