Main Menue: Is this code a mess or okay? + Question

I’m working on a Main Menue and i don’t know if this is code-technically a mess or halfway okay. My code so far:

#pragma strict

var customGuiStyle : GUIStyle;
var textureToDisplay : Texture2D;
private var OptionsMenuEnabled = false;
private var toggleBloom : boolean = false;
private var toggleDoF : boolean = false;

function Start(){
OptionsMenuEnabled = false;
}

function OnGUI () {

GUI.Label (Rect (45, 25, textureToDisplay.width, textureToDisplay.height), textureToDisplay);

if (GUI.Button (Rect (125, 195, 130, 40), "Start", customGuiStyle)) {
  Application.LoadLevel (2);
}


if (GUI.Button (Rect (125, 245, 130, 40), "Options", customGuiStyle)) {
  //OptionsMenuEnabled = true;
  if(OptionsMenuEnabled == false){
        OptionsMenuEnabled = true;
  }
  else{
        OptionsMenuEnabled = false;
  }
}

if (GUI.Button (Rect (125, 295, 130, 40), "Credits", customGuiStyle)) {
  Application.LoadLevel (1);
}

if (GUI.Button (Rect (125, 345, 130, 40), "Exit", customGuiStyle)) {
  Application.Quit();
}


//------------ MENUES
if(OptionsMenuEnabled == true){
  GUI.Label (Rect (430, 195, 290, 40), "Options...", customGuiStyle);
  GUI.Label (Rect (430, 235, 990, 40), "______________________________________________");
  GUI.Label (Rect (430, 275, 290, 40), "Bloom");
  //SETTING FOR BLOOM
  if (GUI.Toggle(Rect(630, 275, 290, 40), toggleBloom, "On/Off")) {
        toggleBloom = true;
        //ENABLE Bloom IE
  }
  else{
        toggleBloom = false;
        //DISABLE Bloom IE
  }
  GUI.Label (Rect (430, 315, 290, 40), "Depth of Field");
  //SETTING FOR DoF
  if (GUI.Toggle(Rect(630, 275, 290, 40), toggleBloom, "On/Off")) {
        toggleDoF = true;
        //ENABLE DoF IE
  }
  else{
        toggleDoF = false;
        //DISABLE DoF IE
  }

}

//GUI.Label (Rect (45, 395, 130, 40), "ver 1.0.0");
GUI.Label (Rect (45, 425, 290, 40), "Song: Danosongs - The Streatham Hills Gods");

}

Another thing: This app will have serveral levels, which I all load via Application.LoadLevel. The user can change the quality settings in the Main/Options menue (only!, for now), but do I need PlayerPrefs in order to port these changed settings into other levels?

-Mauri

playerprefs is a good way to keep track of options and port them to the levels.

Mauri,

If you intend this program to run at only 1 screen resolution, then hardcoding the button and label locations is ok (at least to me). However, if you want to run this program to run at different resolutions, you’ll need to use some sort of relational positioning (i.e. screen.width/4 instead of 200).

You don’t have to use playerprefs to keep persistent data, but it is one way of doing so. You could also use static variables or Don’tDestroyOnLoad

Cheers,
Cahman