Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dostoi |
while (animationPlayer.IsPlaying())
{
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
}
It basically reset a very small timer many times, so the script is blocked until the animation has finished playing. It works fine, although I’ve noticed that this part of the script loops each time the animationPlayer “isPlaying()” anything else. It shouldn’t add a big load of stuff in memory until the async method is done, but it’s not very elegant.
Does anyone know a better way to pause an async method until an animation has finished playing?
Thank you for your time.
Have you tried using the animation_finished()
signal?
Ertain | 2022-06-05 14:17
Thank you for your answer. I did. Unfortunately, in some configuration, signals can’t be intercepted (or it would require to build things differently). Have a great day.
Dostoi | 2022-06-07 15:48