- Home /
Make button disappear, but show label.
I am trying to click on a button, make the button disappear, then show a label in a different location. I can get the label to show up but I can't make the button disappear without making the label disappear as well. I'm using c# and new to scripting so any help is greatly appreciated!
private bool andrewGreen_Drafted = true;
private bool player_Drafted = false;
void OnGUI(){
if(andrewGreen_Drafted){
if(GUI.Button(new Rect(50,50,100,30),Andrew_Green)){
player_Drafted = true;
}
if(player_Drafted){
ShowLabel();
}
}
}
void ShowLabel(){
GUI.Label(new Rect(Screen.width/2,Screen.height/2,100,30),Andrew_Green);
}
Comment
Answer by BitMax · Nov 21, 2013 at 01:09 AM
You could try adding an if statement before you show the button and then when you want to hide it just make that bool false.
Your answer
![](https://koobas.hobune.stream/wayback/20220613122337im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multi Touch Disable on Virtual Joy-pad (FPS) 0 Answers
Key for GUI.Button 2 Answers
Gui label and gui button 1 Answer
How to repeat the same list of buttons? 1 Answer
C# Random Number on GUIButton click without updating every frame 0 Answers