I've been struggling for a while with setting up a loading screen for when the game is running a somewhat heavy algorithm. I know that this algorithm can take upwards of 10 seconds, and I decided to put a loading screen there.
It's something like this:
var loading = preload("path to loading scene")
loading_scene = loading.instance
As it is now, the loading will happen without the loading screen ever appearing. If I uncomment the yield line, the loading screen appears. I think what is happening here is the scene is only updated once the script completes, unless there is some sort of break (yield) mid way.
This workaround, though not ideal, should have worked, if not for the fact that it will also interrupt any animation. My loading screen consists of a rotating icon, if I uncomment the animation line, the animation will play for the time it takes for yield to finish. When it hits the algorithm, the animation freezes. The game progresses as normal once the algorithm completes, but I have no idea how I can just have the loading animation play while an algorithm is occurring in the background.