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)