1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
extends Button class_name CheckBoxButton onready var tx := text export(String) var off_icon = "" export(String) var on_icon = "" func _toggled(p: bool): text = (on_icon if p else off_icon) + tx func _ready(): assert(toggle_mode) _toggled(pressed)