- Home /
 
               Question by 
               phoenixentco · Jun 21, 2012 at 01:04 PM · 
                gui  
              
 
              question with gui
I want that when you press a gui button that says info, it displays text and when you press again that button, you hide it. How do I do it?
               Comment
              
 
               
              Answer by tomekkie2 · Jun 21, 2012 at 02:24 PM
Try this code:
 var displayInfo: boolean = false;
 function OnGUI () {
   if (GUI.Button (Rect (50,50,80,80), "infoButton")) displayInfo = !displayInfo;
   if(displayInfo) GUI.Label (Rect (50,200,100,200), "infoToDisplay");
 }
Answer by Justin Warner · Jun 21, 2012 at 01:05 PM
Use boolean values... If button is pushed, set something to true, set that thing to false, then it shows other thing, then inverse when the other button is pushed.
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers
Question about fliping a character 1 Answer
Pause Menu background problem 0 Answers
Problem with Unity 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                