Editorguilayout.enumpopup Enumeration Popup Selection Menu

Source: Internet
Author: User

Http://www.unity Bull. com/thread-25490-1-1.html

Http://www.unity Bull. com/m/script/editorguilayout.enumpopup.html

Editorguilayout.enumpopup Enumeration Popup Selection Menu

static functionEnumpopup(selected: System.Enum,params Options: guilayoutoption[]): System.Enum
static functionEnumpopup(selected: System.Enum,style: Guistyle,params Options: guilayoutoption[]): System.Enum
static functionEnumpopup(label: String,selected: System.Enum,params Options: guilayoutoption[]): System.Enum
static functionEnumpopup(label: String,selected: System.Enum,style: Guistyle,params Options: guilayoutoption[]): System.Enum
static functionEnumpopup(label: Guicontent,selected: System.Enum,params Options: guilayoutoption[]): System.Enum
static functionEnumpopup(label: Guicontent,selected: System.Enum,style: Guistyle,params Options: guilayoutoption[]): System.Enum

ParametersParameters
    • label Optional label in front of the field. Optional label in front of the field.
    • selected The enum option the field shows.
      Enumeration display field options
    • style Optional Guistyle. Optional styles
    • Options An optional list of layout options, specify extra layouting properties. Any values passed in here would override settings defined by the style. See Also:GUILayout.Width, Guilayout.height, Guilayout.minwidth,guilayout.maxwidth, Guilayout.minheight, Guilayout.maxheight, Guilayout.expandwidth, Guilayout.expandheight
      Specifies an optional list of additional layout properties. Passing any value here overrides the settings defined by the style.

Returns

System.enum-the Enum option that have been selected by the user.

Returns the enumeration option for System.Enum, which is selected by the user.

Description Description

Make an enum popup selection field.

Make an enumeration popup selection field.

Takes the currently selected enum value as a parameter and returns the Enum value selected by the user.

Takes the currently selected enumeration value as a parameter and returns the enumeration value selected by the user.

Create a primitive depending on the option selected.
Create a basic object, depending on the option selected by the user

//creates an instance of a primitive depending on the option selected by the user.//create an instance of a base object, depending on the option selected by the userenumOPTIONS {CUBE=0, SPHERE=1, PLANE=2}classEditorguilayoutenumpopup extends Editorwindow {varop:options; @MenuItem ("examples/editor guilayout Enum Popup usage")    Staticfunction Init () {varwindow =GetWindow (Editorguilayoutenumpopup); Window.    Show (); } function Ongui () {op= Editorguilayout.enumpopup ("Primitive to create:", op); if(Guilayout.button ("Create") ) instantiateprimitive (OP); } function Instantiateprimitive (op:options) {Switch(OP) { CaseOPTIONS. CUBE:varCube:gameobject =gameobject.createprimitive (Primitivetype.cube); Cube.transform.position=Vector3.zero;  Break;  CaseOPTIONS. SPHERE:varSphere:gameobject =gameobject.createprimitive (Primitivetype.sphere); Sphere.transform.position=Vector3.zero;  Break;  CaseOPTIONS. PLANE:varPlane:gameobject =gameobject.createprimitive (Primitivetype.plane); Plane.transform.position=Vector3.zero;  Break; default: Debug.logerror ("Unrecognized Option");  Break; }    }}

Editorguilayout.enumpopup Enumeration Popup Selection Menu

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.