so I have a script that detects when a person clicks one of the buttons
extends Control
@export var difficultyGroup: ButtonGroup
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
for b in difficultyGroup.get_buttons():
b.toggled.connect(toggled)
func toggled(condition):
if condition == true:
pass
elif condition == false:
pass
im not sure how to pass the button so I can change the icon
You could maybe try using the bind method as such:
class_name Menu extends Control
@export var difficultyGroup: ButtonGroup
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
for b in difficultyGroup.get_buttons():
b.toggled.connect(toggled)
func toggled(condition: bool, button: Button) -> void:
pass