Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dream |
I want to make a button open another one, if possible, also another button to close/hide it.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Dream |
I want to make a button open another one, if possible, also another button to close/hide it.
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
rahsut | 2020-08-17 20:57