good day,
I have some code attached to a button that when pressed makes a panel set to not visible by default show on screen:
func _pressed():
get_tree().get_root().get_node("Node/Button/Panel").show()
I want to add to this so that if the panel is showing and the button is pressed again it will hide it with .hide() but am unsure as to how i would write this. I tried messing around with an IF statement and bools but it felt wrong and nothing has worked so far. Also if there is a better/more obvious way of performing this that would be great too.