Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Unity 5.1 UI: DropDown Menu

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 7.01k
    Comment on it

    Unity 5.1 UI : DropDown Menu

    We have to go through the following steps to create a DropDown menu in Unity 5.1 UI -
    • In the Hierarchy Window go through UI -> Canvas

    • Create a Panel1 as a child of this canvas

    • Create a Button1 as a child of this Panel1

    • Select this button1 and pass the panel2 (see next line) to the GameObject of the OnClick Function of button and select function as GameObject -> SetActive (True)

    • Again create a Panel2 as a child of this Button1

    • Select this panel2 and go to Inspector Window and follow :

      • Add Component -> Layout -> Content Size Filter

      • In Content Size Filter set, Horizontal Fit as Unconstrained and Vertical Fit as Min Size

      • Add Component -> Layout -> Vertical Layout Group

      • Add Component -> Event -> Event Trigger

      • In Event Trigger click on Add New Event Type and select Pointer Exit function

      • Then click on '+' button and pass Panel as GameObject and select function as GameObject -> SetActive (False)

      ![alt text][1]

    • Create Button2, Button3 and Button4 as a child of panel2 and all the properties of these buttons and OnClick functions as you desired.

    • Now disable this pannel2 and Click on Play button. The Scene will look like -

    • ![alt text][2]

      Thankyou !

      Happy Coding ! [1]: http://findnerd.s3.amazonaws.com/imagedata/2720/2720.png [2]: http://findnerd.s3.amazonaws.com/imagedata/2721/2721.png

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: