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 -
0 Comment(s)