There was quite a large leap between how coroutines are handled in Godot 3.5 and Godot 4.2+. Instead of Yield, which was used in Godot 3.5, the new Await keyword is being used in Godot 4.2+.
This video aims to cover what coroutines are, how to use them in Godot 4.2+ with Await, how to use them in Godot 3.5 with yield, the differences between await and yield, how to migrate from Godot 3.5 to Godot 4.2+ and finally some bad practices you should avoid while working with coroutines.
The concepts in this video also apply to Godot 4.3
There have been a lot of useful details about coroutines I found while researching this video. Additionally, I have also used some free assets for which I can't be thankful enough. Here are the links for everything:
Official Godot 4.2 documentation for the Await keyword: https://docs.godotengine.org/en/stabl... (sometimes this link doesn't work properly. An easy fix is to scroll down or search for 'coroutines' to find the docs about await)
Official Godot 3.5 documentation for the Yield function: https://docs.godotengine.org/en/3.5/t...
Extra useful GDScript blog post about coroutines: https://gdscript.com/solutions/corout...
Discussion regarding the change from Yield to Await and the lack of support for a way to resume a coroutine, similarly to how it was possible with Yield: https://github.com/godotengine/godot-...
Godot 4.2 coroutines repository which helps replicate the previous Yield behavior: https://github.com/BimDav/Godot4-Coro...
Link for a simple coroutine wrapper: https://forum.godotengine.org/t/i-don...
Helpful coroutines tutorial from @GodotTutorials : • Coroutines | Godot GDScript Tutorial | Ep 26
Dino character: https://arks.itch.io/dino-characters
Cars used from city pack: https://nyknck.itch.io/citypackpixelart
Thumbnail uses assets from Lethal Company: https://store.steampowered.com/app/19...
I'm again, extra thankful for all the free information and assets. This video wouldn't have been possible without your help!
--------------------
Github repository for this project. Contains links from the description and the two migration example code documents:
https://github.com/cashew-olddew/godo...
Support me on Ko-Fi: https://ko-fi.com/cashewolddew
--------------------
Chapters:
0:00 What will you learn?
0:22 What is a coroutine?
1:12 Using the await keyword in Godot 4.2
8:55 Using the yield function in Godot 3.5
17:50 Migrating from Godot 3.5 to Godot 4.2
19:00 Bad practices when using coroutines
Footnote: Sorry for the ASMR in this video. I was a bit too close to the microphone 😞
#gamedev #godot #tutorial