disable GUI when loading is done

I’m making a random generated horror game and during the loading screen the world is generated. Its basically all in the same scene (except for the main menu).
But i have a problem, when my loader hits 100% the GUI wont disappear.
i know a script would be nice but every time i try to paste the code in the “< pre > < code >” section its all in the same line.
I basically have two troubles and need help with both of them…

You can disable the script displaying the loading progress, or use a boolean inside the OnGUI function. I can’t be more accurate without code.

var updateString: String = “”;
function UpdateProgress() {
var progress:float = tileCounter/(heightwidth6.0);
updateString = progress.ToString(“Loading: #0%”);

			if (progress.ToString("Loading: #10%"));
				GUI.enabled = false;
		
}
 
function OnGUI(){
	GUI.Box (Rect (0, 0, 3000, 3000),updateString);
		GUI.Box (Rect (0, 0, 3000, 3000),updateString);
			GUI.Box (Rect (0, 0, 3000, 3000),updateString);
				GUI.Box (Rect (0, 0, 3000, 3000),updateString);
					GUI.Box (Rect (0, 0, 3000, 3000),updateString);
						GUI.Box (Rect (0, 0, 3000, 3000),updateString);
							GUI.Box (Rect (0, 0, 3000, 3000),updateString);
								GUI.Box (Rect (0, 0, 3000, 3000),updateString);
									GUI.Box (Rect (0, 0, 3000, 3000),updateString);
	GUI.Box (Rect (Screen.width /2 - 100,Screen.height /2 - 0,300,25),updateString );	
	
	

}

heres the code, i only want to disable the gui part

The basic method to turn on/off any OnGUI element is to toss an if in front of your GUI commands:

if(!progress.isDone) {
  GUI.Box( .....
}

Probably a better way is to have the OnGUI script be on another gameObject, which is destroyed when you finish loading.

// Changed this to bypass the deprecated methods transitioning to Unity 2.6 : ACF
var next:Transform;

// maze dimensions
var height:int = 12;
var width:int = 12;

var mainMenuSceneName : String;
var pauseMenuFont : Font;
private var pauseEnabled = false;
   
private var maze;
private var tileCounter = 0;

private var facingDown:Quaternion = Quaternion.Euler(180,0,0);
 
class Room {
    var east:Transform;
    var west:Transform;
    var north:Transform;
    var south:Transform;
}

function Start() {
    maze = new Array(width*height);
    yield StartCoroutine("InstantiateFloor");
    yield StartCoroutine("InstantiateWalls");
    if (next != null) {
        next.gameObject.active = true;
        
 
    }
     // Added a Call to actually Make your Maze : ACF
     MakeMaze();
}
 
function InstantiateWalls() {
    var mid = tileSize/2;
    var pos = new Vector3(0,mid,0);
    for (var x:int =0; x< width; ++x) {
        var xpos:int = x*tileSize;
        for (var y:int =0; y< height; ++y) {
            var ypos:int = y*tileSize;
            var room = new Room();
            pos.x = xpos;
            pos.z = ypos-mid;
            // BlLENDER fix
            if(tile.rotation.eulerAngles.x == 270){
            	room.south = InstantiateTile(pos,tile.rotation);
				room.south.Rotate(90,0,0);
				pos.x = xpos-mid;
				pos.z = ypos;
				room.west = InstantiateTile(pos,tile.rotation);
				room.west.Rotate(90,0,0);
				room.west.Rotate(0,90,0);
				pos.x = xpos;
				pos.z = ypos+mid;
				room.north = InstantiateTile(pos,tile.rotation);
				room.north.Rotate(90,0,0);
				room.north.Rotate(0,180,0);
				pos.x = xpos+mid;
				pos.z = ypos;
				room.east =InstantiateTile(pos,tile.rotation);
				room.east.Rotate(90,0,0);
				room.east.Rotate(0,270,0);
			} else {
				room.south = InstantiateTile(pos,tile.rotation);
				room.south.Rotate(90,0,0);
				pos.x = xpos-mid;
				pos.z = ypos;
				room.west = InstantiateTile(pos,tile.rotation);
				room.west.Rotate(90,90,0);
				pos.x = xpos;
				pos.z = ypos+mid;
				room.north = InstantiateTile(pos,tile.rotation);
				room.north.Rotate(90,180,0);
				pos.x = xpos+mid;
				pos.z = ypos;
				room.east =InstantiateTile(pos,tile.rotation);
				room.east.Rotate(90,270,0);				
			}
			maze[MazeIndex(x,y)]=room;
			UpdateProgress();
			yield;
		}
	}
}
 
// floor and ceiling
function InstantiateFloor() {
	//Instead of assuming a zeroed prefab, let's grab the pos and rot of our prefab!
    var floorpos:Vector3 = tile.position;
    for (var x:int=0; x< width; ++x) {
        floorpos.x = x*tileSize;
        for (var y:int=0; y< height; ++y) {
            floorpos.z = y*tileSize;
            floorpos.y = 0;
            InstantiateTile(floorpos,tile.rotation);
            floorpos.y = tileSize;
            InstantiateTile(floorpos,tile.rotation * facingDown);
            UpdateProgress();
            yield;
        }
    }
}
 
 var updateString: String = "";
function UpdateProgress() {
    var progress:float = tileCounter/(height*width*6.0);
    	updateString = progress.ToString("Loading: #0%"); 
}
 
function OnGUI(){
	GUI.Box (Rect (0, 0, 3000, 3000),updateString);
		GUI.Box (Rect (0, 0, 3000, 3000),updateString);
			GUI.Box (Rect (0, 0, 3000, 3000),updateString);
				GUI.Box (Rect (0, 0, 3000, 3000),updateString);
					GUI.Box (Rect (0, 0, 3000, 3000),updateString);
						GUI.Box (Rect (0, 0, 3000, 3000),updateString);
							GUI.Box (Rect (0, 0, 3000, 3000),updateString);
								GUI.Box (Rect (0, 0, 3000, 3000),updateString);
									GUI.Box (Rect (0, 0, 3000, 3000),updateString);
	GUI.Box (Rect (Screen.width /2 - 100 ,Screen.height /2 - 0,200,50),updateString );

}
 
function InstantiateTile(pos:Vector3,rot:Quaternion):Transform {
    ++tileCounter;
    return Instantiate(tile,pos,rot);
}
 
function MakeMaze() {
    ClearMaze();
    SetOuterWalls();
 
	SubDivideMaze(0,width-1,0,height-1);
 
}
 
function ClearMaze() {
    for (var x:int=0; x< width; ++x) {
        for (var y:int=0; y< height; ++y) {
            maze[MazeIndex(x,y)].west.active = false;
            maze[MazeIndex(x,y)].east.active = false;
            maze[MazeIndex(x,y)].north.active = false;
            maze[MazeIndex(x,y)].south.active = false;
        }
    }
}
 
function SubDivideMaze(left,right,bottom,top) {
    if (left!=right && bottom != top) {
        var x:int = Random.Range(left,right);
        var leftdoor:int = Random.Range(left,x+1);
        var rightdoor:int = Random.Range(x+1,right+1);
        var y:int = Random.Range(bottom,top);
        var bottomdoor:int = Random.Range(bottom,y+1);
        var topdoor:int = Random.Range(y+1,top+1);
        AddNorthWall(left,right,y);
        AddEastWall(bottom,top,x);
        var doors = Random.value;
        if (doors < 0.25) {
            SetNorthWall(MazeIndex(leftdoor,y),false);
            SetNorthWall(MazeIndex(rightdoor,y),false);
            SetEastWall(MazeIndex(x,bottomdoor),false);
        } else {
            if (doors < 0.5) {
                SetNorthWall(MazeIndex(leftdoor,y),false);
                SetNorthWall(MazeIndex(rightdoor,y),false);
                SetEastWall(MazeIndex(x,topdoor),false);
            } else {
                    if (doors < 0.75) {
                        SetNorthWall(MazeIndex(rightdoor,y),false);
                        SetEastWall(MazeIndex(x,bottomdoor),false);
                        SetEastWall(MazeIndex(x,topdoor),false);
                    } else {
                            SetNorthWall(MazeIndex(leftdoor,y),false);
                            SetEastWall(MazeIndex(x,bottomdoor),false);
                            SetEastWall(MazeIndex(x,topdoor),false);
                    }
            }
        }
        SubDivideMaze(left,x,y+1,top);
        SubDivideMaze(x+1,right,y+1,top);
        SubDivideMaze(left,x,bottom,y);
        SubDivideMaze(x+1,right,bottom,y);
    }
}
 
function SetOuterWalls() {
    AddNorthWall(0,width-1,height-1);
    AddSouthWall(0,width-1,0);
    AddEastWall(0,height-1,width-1);
    AddWestWall(0,height-1,0);
    SetNorthWall(MazeIndex(width-1,height-1),false);
}
 
function MazeIndex(x:int,y:int):int {
    return y*width+x;
}
 
 
function SetNorthWall(room,value) {
    maze[room].north.active = value;
    var neighbor:int = RoomNorth(room);
    if (neighbor !=-1) {
        maze[neighbor].south.active = value;
    }
}
 
function SetSouthWall(room,value) {
    maze[room].south.active = value;
    var neighbor:int = RoomSouth(room);
    if (neighbor !=-1) {
        maze[neighbor].north.active = value;
    }
}
 
function SetEastWall(room,value) {
    maze[room].east.active = value;
    var neighbor:int = RoomEast(room);
    if (neighbor !=-1) {
        maze[neighbor].west.active = value;
    }
}
 
function SetWestWall(room,value) {
    maze[room].west.active = value;
    var neighbor:int = RoomWest(room);
    if (neighbor !=-1) {
        maze[neighbor].east.active = value;
    }
}
 
function AddNorthWall(left:int,right:int,y:int) {
    for (var hwall:int = left; hwall<=right; ++hwall) {
            SetNorthWall(MazeIndex(hwall,y),true);
        }
}
 
function AddEastWall(bottom:int,top:int,x:int) {
    for (var vwall:int = bottom; vwall<=top; ++vwall) {
        SetEastWall(MazeIndex(x,vwall),true);
    }
}
 
function AddSouthWall(left:int,right:int,y:int) {
    for (var hwall:int = left; hwall<=right; ++hwall) {
        SetSouthWall(MazeIndex(hwall,y),true);
    }
}
 
function AddWestWall(bottom:int,top:int,x:int) {
    for (var vwall:int = bottom; vwall<=top; ++vwall) {
        SetWestWall(MazeIndex(x,vwall),true);
    }
}
 
function RoomEast(index:int) {
    var y:int = index/width;
    var x:int = index-y*width;
    if (x==width-1) {
        return -1;
    } else {
        return MazeIndex(x+1,y);
    }
}
 
function RoomWest(index:int) {
    var y:int = index/width;
    var x:int = index-y*width;
    if (x==0) {
        return -1;
    } else {
        return MazeIndex(x-1,y);
    }
}
 
function RoomNorth(index:int) {
    var y:int = index/width;
    var x:int = index-y*width;
    if (y==height-1) {
        return -1;
    } else {
        return MazeIndex(x,y+1);
    }
}
 
function RoomSouth(index:int) {
    var y:int = index/width;
    var x:int = index-y*width;
    if (y==0) {
        return -1;
    } else {
        return MazeIndex(x,y-1);
    }
}
 
function GetRoom(x:int,y:int) {
    return maze[MazeIndex(x,y)];
}

I think i know what to put but im not sure where:

if (Random_Maze.isDone){
GUI.enabled = false;
}`
Can anyone help?
`