- Home /
 
i cant hide my button why ?
im really new in scripting and here's my problem i want my specific button to be hidden which is my attack button when my enemy dies but i get errors here's the script
 bool HIDE = false;
                         void OnGUI() {
 
                          if (EH.curHealth <= 0){
                                 if(GUI.Button, "Attack")
                         {
                                                 HIDE = true;
                         }
                             }
                         
                         if(questions.Count > 0) {
                         DrawInfo();
                         }
                             }
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Corentin · Feb 18, 2014 at 06:33 PM
Why should your code hide the button ? you don't test if (hide == true) anywhere. Since you are learning, would you like me to suggest some code, or would you like to try to find it by yourself ?
Answer by gridside · Feb 18, 2014 at 04:53 PM
What about this?
 void OnGUI() {
     if (EH.curHealth > 0){
         if(GUI.Button, "Attack")
         {
             //Your attack function
         }
     }
 }
 
              Your answer
 
             Follow this Question
Related Questions
Closing/hiding an open Gui Button when clicking on it 1 Answer
hide button 1 Answer
how to toggle on/off a gameobject with a GUI button ? 3 Answers
GuiTexture (Touch button) unfollow camera! 1 Answer
Move GUI elements. 0 Answers