function OnGUI () {
// Register the window.
windowRect = GUI.Window (0, windowRect, DoMyWindow, "My Window");
}
// Make the contents of the window
function DoMyWindow (windowID : int) {
// Make a very long rect that is 20 pixels tall.
// This will make the window be resizable by the top
// title bar - no matter how wide it gets.
GUI.DragWindow (Rect (0,0, 10000, 20));
}
根据这个内容可以想到鼠标点击拖动图片::
var image:Texture;
var guiTexture:Rect;
function Awake()
{
guiTexture.width=image.width;
guiTexture.height=image.height;
}
function OnGUI()
{
guiTexture=GUI.Window(0,guiTexture,popWin,"");
}
function popWin(winId:int)
{
GUI.DrawTexture(Rect(0,0,guiTexture.width,guiTexture.height),image);
GUI.DragWindow();
}