Unity3d inside, also contains the window form, the following look at the details of the Gui.window method
Below we use the code to implement a switch to display the hidden and displayed form of the function, the code is as follows:
Public classWindowsscript:monobehaviour {BOOLwindowshow=true; Rect Windowrect=NewRect (0,0, -, -); voidOngui () {//defines the display and hiding of a toggle control formWindowshow=gui. Toggle (NewRect (Ten,Ten, -, at), Windowshow,"whether the form is displayed"); if(windowshow) Windowrect=gui. Window (0, Windowrect,mywindowfunction,"my Window"); } voidMywindowfunction (intWindowid) { if(GUI. Button (NewRect (Ten, -, -, -),"Window Body button") {print ("window button is clicked"); } //define the scope in which a form can be activeGui. Dragwindow (NewRect (0,0,10000,10000)); }
As follows:
A form can be dragged.
Learn Unity3d from scratch (GUI GUI. Window)