I have a button, which emits a pressed signal. I would like to handle it in another node (button's sibling), while passing the reference to the button being clicked.
1. Connecting the signal via the engine's UI, but didn't see the option for an extra
self argument there.
2. Connecting the signal like this:
var Character = preload("res://KinematicBody2D.tscn")
# Called when the node enters the scene tree for the first time.
connect("pressed", Character, "on_button_toggled", [self])
following this example, but I got this error:
Error calling method from signal 'pressed': 'PackedScene::on_button_toggled': Method not found.
Even though I defined
on_button_toggled in the KinematicBody2D.
I also saw this question, but there the handler is the same object, which I suspect to be a problem here.
A related question: is there a way to do this without branching the node as a separate scene? I don't have another reason to do this for this KinematicBody2D.