AWAIT! Use the New Keyword in GDScript - Godot 4

preview_player
Показать описание

Preorder Below Launch Price for a Limited Time Only

--------------------------------
CC-BY 4.0 LICENSE
--------------------------------
Рекомендации по теме
Комментарии
Автор

Thanks for speeding up the Godot 4 tutorial uploads! Looking forward to the new learning material in january!

Bamelin
Автор

Love the bite-sized format of the recent videos! Long tutorials and in-depth explanations all have their place in the learning process, but the short and, subject focused tips, can often be super helpful

sebastianwlodarczyk
Автор

After learning C# as independent language, await in Godot is really simple to me! Learn not the programming languages, but concepts that make them so useful!

КостяКиндалюк
Автор

I really appreciate you consistently making these little tips and tricks and tutorials for features, it helps a lot in a community where there isn't a ton of video documentation, I appreciate and you're dope have a great day!

Failfer
Автор

this is wholesome quality of life, Ive always had to connect the "finish" signals, of anything, but the "wait" is very handy

diguififficial
Автор

You can also await for tweens "await tween.finished" very useful too. alternatively you can use tween callback: " if the code you want to run is on a different function.

dzibanart
Автор

i literally just happened to see this video as i was working on a project in godot. im still new to godot and coding in general so this is really cool. it helped me clean up some functions and write more decoupled code. thank you very much!

lindeschoon
Автор

Glad seeing more languages adopt the async/await model from C#/F#

Quique-szuj
Автор

The problem I've often encountered with this is that, let's say the battle ends in the turn based combat while there's still some pieces of code still waiting for some signal, when the next battle starts those pieces of code will run twice when the signal is finally emitted. I'm not sure how to cancel those functions that is still waiting.

Another example is in a non-turn based combat, let's say you have an await when your character casts a spell, then the enemy boss kills you so the cast never finishes. When you cast a spell in another battle, the leftover will also run (assuming the player is not queue freed)

Edit: not saying it's an issue with await, it's more of I don't know how to design things better involving await

petiks
Автор

I wish they would invent proper polymorphism, sometimes it gets really painful trying to implement anything re-usable in gdscript.

GreySectoid
Автор

Weird... Normally await is called on ASYNC functions. Apparently GDScript doesn't need this sort of thing? Which is fine, but you may run into problems down the line when calling a function that needs to be awaited. I would name every async function with a '_async' suffix, so that you can see by the name of the function that it should be awaited.

joga_bonito_aro
Автор

I was looking for an explanation about await for the last 2 days. This video cleared my doubt. Thanks.

kaustavp
Автор

I think understanding the yield or await function is very crucial. It's funny how I use it nearly all the time yet I never thought I would be using it in the beginning when learning godot.

williamauditore
Автор

first 8 seconds, that reminds me of dodging race conditions. You don't want two threads to "conflict" and result in incorrect variable because they read the same value from the variable, do independent calculations on it, and overwrite each other.

ghb
Автор

Ooh, I remember watching the video this morning! Great tutorial, as expected from GDQuest! Although why was it reuploaded?

modley_the_m_guy
Автор

thanks for the great videos! so is this like the more stable version of yield()? also did this come out in 4.2

schmo
Автор

Great video, does Await puts on hold the entire thread or just the code that follows in that particular function?

ignaciodangelo
Автор

wrong usage.
a hidden feature of signals is that if they have 1 argument, you can use it as a return value.
so you have
finished_anim = await whatever.animation_finished.

then you confirm the finished animation's name to change the text

idk how they work with multiple arguments for return value but with one argument it works just like a return value.

darthnegativehunter
Автор

Great video! Love that you are back on track with them and waiting for your courses!

Have question regarding naming convention. In this video I see that for scripts and for nodes files (.tres) you are using snake_case, as it was suggested in the documentation of the Engine. However in the "Learn to Code From Zero With Godot 3" course you had for Node files and scripts Pascal case.
I think that the new version we do see in video is better one and we should follow snake_case for files, because of possible issues with casing on different operation systems, right?.

MRxRadex
Автор

would have hoped to hear at least one little warning about not overusing await for everything.
after all, in the majority of cases, connect() is the cleaner and more robust choice.
most of all, await should not be used in _process() or _physics_process().

holleey