Need help with toggle button

First of all sorry for posting the whole code here but if there is a chance that anyone of you would like to improve it overall may it be so. Now on to my problem. The thing is that the toggle buttons wont toggle and their values are always set to zero (the togglewata and togglebloom ones) so here is the code

var togglewata : boolean = true;
var togglebloom : boolean = true;
var optionsobject : GameObject;
var togglewaterbool : boolean = true;
var togglebloombool : boolean = true;
var isinoptions = 0;
var isingame = 0;
function Awake(){
isingame = 0;

function OnGUI () {
if(isinoptions==0 ){
    GUI.Box (Rect (10,10,100,90), "Loader Menu");

   if (GUI.Button (Rect (105,40,110,20), "Load World")) {
        Application.LoadLevel ("world");

    if (GUI.Button (Rect (105,70,110,20), "Lag-Free World")) {
        Application.LoadLevel ("Waterless World");
if (GUI.Button (Rect (105,100,110,20), "Options")) {
if (GUI.Button (Rect (105,140,110,20), "Quit")) {


togglewata = GUI.Toggle (Rect (25, 25, 100, 30), optionsobject.GetComponent("togglewaterbool"), "Water");
togglebloom = GUI.Toggle (Rect (25, 50, 100, 30), optionsobject.GetComponent("togglebloombool"), "Bloom");
if (GUI.Button (Rect (105,140,90,20), "Back")) {
        isinoptions = 0;



function Update () 
    if (Input.GetKeyDown(KeyCode.P))

Personally, I think it's better to store the toggle values in a separate array. If you don't mind coding it that way, here's another Answer that has full code: How can I setup a series of toggle buttons?

And another thing I noticed, is that you're not giving the saved toggle value to the Toggle button code (again, see the other Answer for an example of how it's done), so the button will never change. You have to tell the Toggle function, what value to use every time you call it. For example, I think this should do it (haven't tested it):

hasWater = GUI.Toggle (Rect (25, 25, 100, 30), hasWater, "Water");

Update: minor point, but to follow good naming practices, I'd rename the Booleans, as above for example, to hasX.