Godot Version
Godot v4.3, GDScript
Here’s the scenario: Eventually my game would need to perform rather time-consuming tasks (like creating a large level) which might take a minute. The challenge here is not the amount of time needed, but to keep the game window responsive while said tasks are being performed. Since non-responsiveness in an app is generally considered a big no-no.
Now, I’ve set up a simple test scene (see pic below) with just one button that calls a function which runs a pointless loop. There’s another button which merely outputs something in the console. As implied, the game is not supposed to freeze while the loop runs. Ideally the “print button” would even immediately execute its task, again, while the aforementioned loop is running.
Just writing “await” in front of the loop function call clearly didn’t do the trick. Also, yes I’ve read the docs regarding await and also threads (which don’t seem to be suitable for this example). Yes, I’ve also watched a lot of tutorials on those matters. But obviously I’m still missing something important. Would anybody be so kind to help me overcome my brain fart?
EDIT: I have no problem to asynchronously load any resource. That works fine for me. But this example doesn’t load anything. Every node is already in the scene tree. It just needs to run some code in the background. That seems like a mundane task, but I just can’t figure it out.
Thanks in advance!
P.S. I wanted to upload another picture with the node setup (just in case). But I can’t do that as a “new user.” On that note, even though I haven’t posted much, I’ve been a registered user for about a year now. So, not enirely “new.” Just saying…