Learn Unity3d from scratch (GUI GUI. Window)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.