Why? Short version...

Ok. Button clicked, start map you select, Getting several errors on my statements here:

var SelectedLevel = "Level1" //When clicking a button it changes to "Level2" and what not

function OnGUI(){
if(GUI.Button(Rect(245,225,155,20),"Start Map")){
   if(SelectedLevel = "Level1"){
      Application.LoadLevel(1);
   }
   if(SelectedLevel = "Level2"){
      Application.LoadLevel(2);
   }
// and so on
}
}

Errors:
Assets/Scripts/MainMenu.js(89,35): BCE0044: expecting ), found ‘=’.
Assets/Scripts/MainMenu.js(89,37): BCE0043: Unexpected token: Level1.
Assets/Scripts/MainMenu.js(90,45): BCE0044: expecting :, found ‘;’.

Don’t understand what comming from, need help please
Thanks you very much
Out -

“=” is an assignment operator, “==” is the comparison operator you want to use there.

 if(SelectedLevel == "Level1"){ 
      Application.LoadLevel(1); 
   } 
   if(SelectedLevel == "Level2"){ 
      Application.LoadLevel(2); 
   }

:slight_smile:

Alright great… I did not know that, Thanks