#Strange behavior related to awaited SceneTreeTimer in array of callables
1 messages · Page 1 of 1 (latest)
If only test_func_2 is added to the list of callables, it resolves as expected: "test done" and "all awaits done" print. But with the timer in test_func_1, it doesn't resolve.
I feel like that while loop is going to lock up your game. You need to rely on signals, not a while loop
test_func_2 doesn't have anything that needs awaited, which is why it works fine. The fact that test_func_1 actually uses something that needs awaited means your while loop locks up the entire game and prevents anything else from ever happening
Instead of using a while loop, you could do that completion check in _process. This would allow the game to keep running and you would just check for completion each frame
After talking about it with some buddies that's sort of what I ended up with- the only change was to replace line 21 with await get_tree().process_frame
I was mistaken in how await functions; I was under the assumption that it allowed for coroutines
await does allow for coroutines, but it doesn't create threads. An endless while loop on the main thread will lock up the entire game