Help with passing values in signal

Godot Version

4

Question

Hi there, I’m currently trying to pass the value via a signal (button.get_node(“Button”).pressed.connect(_on_button_down(“Test”))

This is the function _on_button_down
image

However, everytime I try to run the code, it gives me the following error

The code works fine if I remove the values passed into the function (i.e. “Test”). However, if I remove it I’m unable to pass in the value.

Could anyone help me please? Many thanks in advance.

You need to use the bind method to add arguments to a Callable:

button.get_node(“Button”).pressed.connect(_on_button_down.bind("Test"))

1 Like

Thank you, it works!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.