#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