using UnityEngine;
using System.Collections;
public class GUIDragWindow : MonoBehaviour {
Rect windowRect = new Rect (20, 20, 250, 250);
void OnGUI () {
windowRect = GUI.Window (0, windowRect, DoMyWindow, "My Window");
}
void DoMyWindow (int windowID) {
GUI.Button (new Rect (10,20,100,20), "Can't drag me");
//GUI.DragWindow (new Rect (0,0, 1000, 20));//Rect设置Drag区域
GUI.DragWindow ();
}
}
运行效果