var WindowSwitch : boolean; var windowRect : Rect = Rect(20, 40, 200, 100); //点击出窗口 function OnGUI () { if(WindowSwitch) { windowRect = GUI.Window (0, windowRect, WindowFunction, "wayne"); } } function WindowFunction (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; }
转载于:https://www.cnblogs.com/wayne1984/archive/2012/08/09/2630679.html