#Update label text before and after long function call

3 messages · Page 1 of 1 (latest)

copper saddle
#

I have a function I need to run, and I'd like to show the user that the game isn't just frozen. Currently, I'm editing a label's text before and after the function call, but it looks like the text isn't updated until after the frame anyway so the user never sees the first message.

Is there any way to force update the label visually in the middle of code execution? Or delay running the long function until after the label has updated? I've tried using call_deferred(), but the label still doesn't update before the game freezes, so the user still only sees the second message.

copper saddle
#

So I managed to get it working by adding await get_tree().create_timer(0.01).timeout right after editing the label for the first time, but I'm not really happy with that solution so would still appreciate a better solution.

dusty wagon
#

You can make a function that only changes the label and then uses a deferred call to run the big function in the next frame.