- Home /
Multiple GUI.Labels to appear and disappear
How to I make multiple GUI.Labels appear and disappear to have another GUI.Label take it's place without using coroutines?
Answer by Kona · Feb 28, 2012 at 07:22 PM
I suppose you could use boolean values or if you have many different states make an enum, then in the method from where you're creating those labels you do something like
if( myBool ) GUI.Label(new Rect( 5, 5, 50, 50 ), "Label 1 : True!" );
else GUI.Label(new Rect( 50, 50, 50, 50 ), "Label 2 : False!" );
or if you just want the text to change and not make entirely new labels you could just define a string and make the label display that string, and depending on the state you change the string.
bool myBool = true; string myString = "The String"
GUI.Label( new Rect( 5, 5, 50, 50 ), myString );
if( myBool ) myString = "True"; else myString = "False";
And as said if you have several states that should affect the label(s) you could set up a switch case:)
Your answer
![](https://koobas.hobune.stream/wayback/20220613064551im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Manually Programming width of new GUI 1 Answer
Centering a GUI label with varying text length 1 Answer
How to make GUI Button a fixed size? 1 Answer
Making GUI.Label appear for a win screen 0 Answers