Topic was automatically imported from the old Question2Answer platform.
Asked By
Perococco
I was wondering what is the ordering of the execution between signals. For instance, if when signal A is emitted will all methods connected to it be called before another signal is handled.
For instance, if signal A is emitted and one of the method connected to it emits a signal B, will all methods connected to signal A be called before any methods connected to signal B ?
very likely so, signals are handled almost immediately. Signal A should be received in the same frame for all listeners.
If a signal function emits a signal, that signal is processed before another signal on the same level.
Here is how I tested it (a 2d project with a button where the function test() is called from the button.pressed() signal):
I did some tests based on your example and these confirm (at least experimentally) that a signal is processed as soon as it is emitted (in your example, the methods connected to signal C will be called before any remaining methods connected to signal A not called).
This makes sense from an implementation point of view since signals are Godot’s version of the observer pattern.