File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
tutorials/scripting/gdextension Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -596,10 +596,21 @@ This is the required syntax:
596596
597597.. code-block :: cpp
598598
599- some_other_node->connect("the_signal", this, "my_method");
599+ some_other_node->connect("the_signal", Callable(this, "my_method"));
600+
601+ To connect our signal ``the_signal `` from some other node with our method
602+ ``my_method ``, we need to provide the ``connect `` method with the name of the signal
603+ and a ``Callable ``. The ``Callable `` holds information about an object on which a method
604+ can be called. In our case, it associates our current object instance ``this `` with the
605+ method ``my_method `` of the object. Then the ``connect `` method will add this to the
606+ observers of ``the_signal ``. Whenever ``the_signal `` is now emitted, Godot knows which
607+ method of which object it needs to call.
600608
601609Note that you can only call ``my_method `` if you've previously registered it in
602- your ``_bind_methods `` method.
610+ your ``_bind_methods `` method. Otherwise Godot will not know about the existence
611+ of ``my_method ``.
612+
613+ To learn more about ``Callable ``, check out the class reference here: :ref: `Callable <class_Callable >`.
603614
604615Having your object sending out signals is more common. For our wobbling
605616Godot icon, we'll do something silly just to show how it works. We're going to
You can’t perform that action at this time.
0 commit comments