Godot Version
4.6.1
Question
Im tryna connect a toggled signal to a button i created in code but the connect() then needs smth to put for the func _on_button_toggled(toggled_on: bool) and no matter what i try to put in it, it either errors or always returns false when the signal gets emitted no matter if it got toggled on or off.
for i in dir.get_directories():
var self_name = i
var booster_button = Button.new()
var booster_img := Image.load_from_file("res://Assets/Booster_stuff/"+i+"/icon_3uncommen.png")
booster_img.resize(40, 40, Image.INTERPOLATE_LANCZOS)
booster_button.icon = (ImageTexture.create_from_image(booster_img))
booster_button.toggle_mode = (true)
booster_button.add_theme_color_override("icon_pressed_color", Color.GREEN)
booster_button.set("theme_override_colors/icon_pressed_color", Color.GREEN)
booster_button.set("theme_override_colors/icon_hover_pressed_color", Color.GREEN)
booster_button.pressed.connect(_on_boostery_button_toggled.bind(//insert solution here//, self_name))
booster_button.name = (i)
$Container/ScrollContainer/GridContainer.add_child(booster_button)
func _on_boostery_button_toggled(toggled_on: bool, self_name) -> void:
if not $card_selector.get_selected_id() == 0:
print(toggled_on)
Im rly sorry that im back already, ive been trying to figure this out on my own for two hours now and close to tears at this point.