- Home /
 
               Question by 
               Crashsite99 · Mar 02, 2013 at 03:16 AM · 
                guimenu  
              
 
              Necromancer GUI doesn't work?
Hi, i made a Javascript file for a main menu for my game, then, i tried adding the Necromancer GUI, but when it's running, it doesn't appear nothing! What's going on? Here's the code:
 var mySkin : GUISkin[];
 private var cont : int = 0;
 var OptionUI = false;
 enum Mode {Easy = 1,Medium = 2,Hard = 3}
 static var curMode = Mode.Easy;
 var Music : boolean = true;
 var LabelString = "";
 function Update ()
 {
     if(Music == true)
     {
         audio.mute = false;
     }
     if(Music == false)
     {
         audio.mute = true;
     }
     
     switch(curMode)
     {
         case Mode.Easy:
             PlayerPrefs.SetString("ModeSaved","Easy");
         break;
         case Mode.Medium:
             PlayerPrefs.SetString("ModeSaved","Medium");
         break;
         case Mode.Hard:
             PlayerPrefs.SetString("ModeSaved","Hard");
         break;
     }
     
 }
 function OnGui()
 {
     GUI.skin = mySkin[cont%mySkin.Length];
     GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 170,200,340),"Main Menu");
     
     if(OptionUI == false)
     {
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 120,100,30),"Singleplayer"))
         {
             Application.LoadLevel(1);
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 90,100,30),"Options"))
         {
             OptionUI = true;
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 60,100,30),"Exit the Game"))
         {
             Application.Quit();
         }
     
     if(OptionUI == true)
     {
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 120,100,30),"Easy"))
         {
             curMode = Mode.Easy;
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 90,100,30),"Medium"))
         {
             curMode = Mode.Medium;
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 - 60,100,30),"Hard"))
         {
             curMode = Mode.Hard;
         }
     }
     
     Music = GUI.Toggle(Rect(Screen.width /2 - 50,Screen.height /2 - 30,100,30),Music,"Music?");
         
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 ,100,30),"Fastest"))
         {
             QualitySettings.currentLevel = QualityLevel.Fastest;
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 + 30,100,30),"Good"))
         {
             QualitySettings.currentLevel = QualityLevel.Good;
         }
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 + 60,100,30),"Fantastic"))
         {
             QualitySettings.currentLevel = QualityLevel.Fantastic;
         }
         
         GUI.Box(Rect(Screen.width /2 - 95,Screen.height /2 + 90,190,30),"Current Mode: " + LabelString);
         
         if(GUI.Button(Rect(Screen.width /2 - 50,Screen.height /2 + 120,100,30),"Exit"))
         {
             OptionUI = false;
         }
     }
 }
               Comment
              
 
               
              Answer by hatshapedhat · Mar 02, 2013 at 04:05 AM
I may be wrong, but I think the method needs to be named OnGUI() (it's case sensitive) not OnGui().
yeah, it didn't work either... i wonder what is causing this error?
i already fixed it! don't know what i did, but it's fixed! =P
Your answer
 
 
             Follow this Question
Related Questions
onGui - Switching between textures on selection grid. 0 Answers
A node in a childnode? 1 Answer
How to make a GUI appear and disappear with the same button? 1 Answer
GUI circulur menu system 1 Answer
Changing GUI.Box opacity 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                