Godot Version
4.3rc3
Question
ButtonPressed normally takes no arguments. i modified it to take 1 using Callable.bind()
and it works. Now i want it to take 2 and that doesn’t work.
Goal: Given a list of options (as buttons), i want to know which button was clicked so that i can remove it from the list.
for i in get_tree().get_nodes_in_group("build_tower_buttons"):
var tower_name = i.get_meta("tower_name")
i.pressed.connect(Callable(on_build_tower_button_pressed).bind([tower_name, i]))
func on_build_tower_button_pressed(tower_name : String, button: TextureButton):
This code worked when i only passed the first argument. The second has broken it.
emit_signalp: Error calling from signal 'pressed' to callable: 'Node2D(level_manager.gd)::on_build_tower_button_pressed': Method expected 2 arguments, but called with 1.
What am i missing?