

If it is a valid game state, then check if the queues have events to be processed (using two queues makes it simple to order them properly, but you could use a priority sorted queue as well for more complex situations). Then just have the function check the game state as the example above indicates. This way it is always loaded and the yielded function will always exist to be jumped back into. To fix this, you should have a global autoloader script call the check signals processing function using call_deferred or call it normally and then use the yield example above. While rare, it is a tough bug to realize what is happening.Īn example would be a change from the game scene to a main menu or game over or credits scene. The problem with using call_deferred directly on your signals and any function really that is in the game scene tree only is that it can crash the game should the player trigger a scene change between the call_deferred or yield calls and the return to the function. As a programmer, we tend to test things in a rational straight forward manner, but our players and play testers are not normal by any stretch. The second problem you could run into won't come up under normal testing, but would happen during player testing. Now you could just call_deferred the ones that you want executed later, which I imagine is what you are doing. Afaik it would call them in the order call_deferred was called, meaning in the order the signals were recieved. Just using call_deferred in your signal event can have two problems.įirst, you still can't guarantee the order of the calls. HDRI Haven – CC0-licensed panorama skies.CC0 Textures ⋅ ⋅ Texture Haven – CC0-licensed PBR materials.

Godot Shaders – Shaders specifically made for use in Godot Engine.Awesome Godot (curated list of Godot resources).Twitter Read before posting: Frequently Asked Questions Community Platforms Discord Contributors Chat Support Godot development on Patreon! Reference material.A community for discussion and support in development with the Godot game engine.
