Topic was automatically imported from the old Question2Answer platform.
Asked By
Tatuzudo
Old Version
Published before Godot 3 was released.
Hello to all,
Is there a problem in connecting undefined signals?
For example: get_node('my_node').connect( 'signal', self, 'function')
Now supose that the node my_node have no ‘signal’ defined.
I tested it and it is working fine for now (the game doesn’t crash), but is there a chance it could cause some weird problems in the future? It just seems wrong
This just sets up listening for that signal. If the signal isn’t defined on mynode it won’t be emitted, but nothing bad will happen, you’ll just never call function.
Though nothing bad happening could be a bad thing, since it will be hard to catch the error unless you already suspect the signal handling to be broken.
raymoo | 2017-10-19 19:07
Thanks for the answer! I asked because I will probably have to reuse the node and not all parents will emit the signal