- Edited
Hi all. Just trying to turn an icon on or off and getting a strange error.
@onready var icon = $Panel/Icon
func _ready():
icon.visible = false
func set_attack():
icon.visible = true
Here's the relevant code. So the "icon.visible" is the problem. It works fine in the ready() func, but if I use the set_attack() func and the icon is already visible, it throws an error.
"Invalid set index 'visible' (on base: 'CompressedTexture2D') with value of type 'bool'."
Is this just happening because if the visible is on and you set it to on again it throws the error, or is there something else that is going on?
That doesn't seem to be the problem, because if I check if the icon is visible it throws the same error for that line instead. What is going on?
(Yes, the icon does exist, it's not null, I checked)