+ 2
Ui button in unity when clicked opens pannel of buttons... When clicked again closes that button pannel.
Any coders here who could help me with a really simple thing? . . I want to click on a ui button and when i click on this ui button i want a panel of buttons to appear (in upward direction) and when i re-click on that red button i want the entire panel and the rest of the three buttons to go back to the previous state... For this i have made 2 animations in unity 1 which expands the panel and the other one which makes the panel to go down (back to it's previous state)... I would really appreciate if someone could help me with the code.
3 Answers
+ 3
You need a script that looks like that:
bool appeared = false;
public void onClick (){
if (appeared) {
//start disappear anim
} else {
//start appear anim
}
appeared = !appeared
}
and then trigger the onClick func over the button
+ 1
You might look for things like pane.isopen and visibility properties
+ 1
You could try something with gameobject.activeSelf and if it's false you display it and vise versa