How to do unity Gadget for your Art sister (ii)

Source: Internet
Author: User

Do you imagine opening a unity window for your own unity gadget? It looks great, doesn't she?

It's a good habit to check manual before you do what you don't know. Let's have a look.

Want an interface but know what the specific class is called? Let's check the window first to see if we can find it.

It's like there's a Derive from the This class to the Create an editor window. The window that derives the class used to create the editor looks pretty good.

Let's take a look at the first example of it in our own code.

usingUnityengine;usingUnityeditor; Public classMywindow:editorwindow {stringMyString ="Hello World"; BOOLgroupenabled; BOOLMybool =true; floatMyfloat =1.23f; //Add menu named "My window" to the Window menu[MenuItem ("window/my Window")]    Static voidInit () {//Get Existing open window or if none, make a new one:Mywindow window = (mywindow) Editorwindow.getwindow (typeof(Mywindow)); }        voidOngui () {Guilayout.label ("Base Settings", Editorstyles.boldlabel); MyString= Editorguilayout.textfield ("Text Field", myString); Groupenabled= Editorguilayout.begintogglegroup ("Optional Settings", groupenabled); Mybool= Editorguilayout.toggle ("Toggle", Mybool); Myfloat= Editorguilayout.slider ("Slider", Myfloat,-3,3);    Editorguilayout.endtogglegroup (); }}

It's My window under window. We found out if we had an interface.

Okay, so let's take a look at the manual API in a sentence.

Editorwindow.getwindow  Public Static BOOL false string NULL BOOL true);

With three parameters the type of the window created must be an inherited Editorwindow utility if true, a floating window cannot be dragged and dropped into the interface like the Project window, and a normal window can be dragged and dropped into the interface for false creation.

The word focus focus in the upper-left corner of the title window

GetWindow has a lot of overloaded methods also have a generic type of writing specific use when you can choose according to their own needs

After the code is editorguilayout (editing environment automatic layout gui) painting components inherited from Guilayout not all look at the creation of more components can be manual search editorguilayout to see

How to do unity Gadget for your Art sister (ii)

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.