You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See attached project. Try running swift TestSignals and notice that if SpinningCube._input() is active, and ListenerNode._input() is commented out, that ListenerNode._on_pressed() never gets called. It also seems to be that if you try to use SpinningCube.pressed from ListenerNode._ready(), without also using the #signal() macro in the ListenerNode class, this will fail to find the signal with this error message:
ERROR: In Object of type 'ListenerNode': Attempt to connect nonexistent signal 'pressed' to callable 'ListenerNode::_on_pressed'.
at: connect (core/object/object.cpp:1282)
The text was updated successfully, but these errors were encountered:
pcbeard
changed the title
Calling emit() on a signal defined in another class doesn't seem to deliver the signal
Calling emit() on an object, only seems to deliver the signal to that object not others connected to the same signal
Nov 27, 2023
This is behaving as expected, but its understandable why anyone would see it as a bug :/
Godot's signal mechanism connects an instance emitting the signal to another node. This is unusual for a notification pattern which normally allows another object to globally observe a notification/signal without needing to know about the emitting instance.
See attached project. Try running
swift TestSignals
and notice that if SpinningCube._input() is active, and ListenerNode._input() is commented out, that ListenerNode._on_pressed() never gets called. It also seems to be that if you try to useSpinningCube.pressed
fromListenerNode._ready()
, without also using the #signal() macro in theListenerNode
class, this will fail to find the signal with this error message:HelloSwiftGodotKit.zip
The text was updated successfully, but these errors were encountered: