How can I make a button open/show another button?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dream

I want to make a button open another one, if possible, also another button to close/hide it.

:bust_in_silhouette: Reply From: rahsut

To do this, you could, in a _ready() function (also, both buttons have to be in the same scene), do:

(put the name of the other button in the quotation marks
get_owner().get_node("").hide()

Then, add a signal to the first button (the “pressed()” one), and in that function write:

get_owner().get_node("]").show()

Do it the other way around if you want to hide the other button

P.S. You may have to do get_owner().get_node().get_node(), etc. if the buttons is a child of another node that is not the main node of the scene.

thank you very much!

Dream | 2020-08-17 14:32

Phew! I wasn’t sure if that was what you meant but I’m glad that helped :slight_smile:

rahsut | 2020-08-17 20:57