Cant get my gui in the quiwindow to load there functions...

#pragma strict
var urlpath : String = “”;
private var showWindow : boolean = false;
function OnGUI ()
{
if (GUILayout.Button(“Inventory”))
{
showWindow = true;
}

if (showWindow)
{
		GUI.Window(5,Rect((Screen.width/2)-(300/2),(Screen.height/2)-(300/2),300,300),OnWindowDraw5,"Inventory");
}

} 
 function Start () {    
}

 function load() {
	var testobj : GameObject;   
    testobj = new GameObject ("object");
    testobj.AddComponent (OBJ);
    var targetComp : OBJ = testobj.GetComponent(OBJ);
    targetComp.objPath = urlpath ;
    testobj.AddComponent (MeshCollider);
    yield WaitForSeconds(3);
    var targetComp2 : MeshCollider = testobj.GetComponent(MeshCollider);
    var targetComp3 : MeshFilter = testobj.GetComponent(MeshFilter);
	targetComp2.sharedMesh = targetComp3.mesh;
   
}

function OnWindowDraw5(winid:int)

{
	
if (GUI.Button(Rect(15,98,79,22),"Spawn1"))
	
{
	urlpath = "http://www.gamesite.x10.mx/OBJs/monkey.obj"; 
	load();	
}
	
if (GUI.Button(Rect(203,101,79,22),"Spawn3"))
	
{
	
}
if (GUI.Button(Rect(265,5,30,15),"X"))
	
{
	showWindow = false;	
}
		
if (GUI.Button(Rect(109,100,79,22),"Spawn2"))
	
{
	urlpath = "http://www.gamesite.x10.mx/OBJs/tree2.obj" ;
	load();	
}
	
GUI.Box(Rect(12,25,85,100),"Monkey");
	
GUI.Box(Rect(200,26,85,100),"Test");
	
GUI.Box(Rect(106,25,85,100),"Tree");

}

the bottom of this script in the function OnWindowDraw5(winid:int) when the buttons are pressed nothing happens. i have tested code in the buttons and it works fine… Its like the cose in the if button blocks arent being called… this is a javascript

The best way to track what is happening when you can’t seem to see whether some code is being executed or not is to use the MonoDevelop Debugger. In other words,

  • Run your app,
  • navigate to your test case where the GUI is displaying,
  • go to MonoDevelop
  • add a Breakpoint to the line of code inside the if(button),
  • push the Play button,
  • “Attach”,
  • go back to your editor,
  • push the GUI button on your screen

This should cause MonoDevelop to stop execution at the breakpoint if your code is being called. After that you may step through it as you wish.