Godot Version
4.3
Question
I have a theme and I want to change a stylebox of a button.
My code:
@onready var textbox_theme = preload("res://textbox_theme.tres") as Theme
func _ready() -> void:
var normal_stylebox = textbox_theme.get_stylebox('Button', 'Normal')
normal_stylebox.bg_color = Color.DEEP_PINK
I am not getting an error message but the button is not changing color. Do I need to do something else?
I found it! get_stylebox is expecting the name of the variation first and then node type
The code should be:
@onready var textbox_theme = preload("res://textbox_theme.tres") as Theme
func _ready() -> void:
var normal_stylebox = textbox_theme.get_stylebox('normal', 'Button')
normal_stylebox.bg_color = Color.DEEP_PINK
1 Like
system
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.