This question was
closed Apr 12, 2017 at 05:47 PM by
dgalbraith3 for the following reason:
The question is answered, right answer was accepted
C# - A way to set UI gameObject as active and then inactive when pressed a second time
I have a button that when pressed it will show specific gameObjects but I want it to be able to turn off the gameObjects if its pressed again. I tried to figure out how to do it in editor without having to use another button but couldnt figure it out. Thinking I might have to do it through code but I am still learning if anyone can help thatd be great!
Comment
yes thats code:
public void ToggleUI(){
gameobject.SetActive(!gameobject.activeSelf);
}
Follow this Question
Related Questions
How to make a button unclickable when alpha = 0 1 Answer
Some elements of UI have glitched on older Android device 1 Answer
find an especific multitouch wich is on a image in the canvas 0 Answers
Manipulate ui canvas button hitbox 2 Answers
button ui becomes active by click outside the button in exe file!!(unity 5.1) 1 Answer