var WindowSwitch : boolean; var windowRect : Rect =Rect(20, 40, 200, 100); //点击出窗口 function OnGUI () { if(WindowSwitch) { windowRect = GUI.Window(0, windowRect, WindowFunction, "wayne"); } } 点击出窗口有更简单的写法吗,还有这套写法有问题吗?
functionWindowFunction (windowID : int) { if (GUI.Button (Rect(40,40,160,20), "close window")) { WindowSwitch = false; } } function OnMouseEnter() { renderer.material.color = Color.blue; } function OnMouseDown() { WindowSwitch = true; } function OnMouseExit() { renderer.material.color = Color.white; }
|