Tutorial for Dropdown item needed

I’m planning to use the drop down menu item in the UI for a character generator script. I can’t find any tutorials on it. There are plenty of “do it yourself” drop down, but there is an actual drop down, but I’m not sure how to work with it. Does anyone know of any tutorials working with this?

Thanks!

He’s not asking about building a drop down menu, he’s asking about the drop list that’s a standard UI component.

Sadly, the drop menu UI component is lacking in good tutorials. I managed to get mine working although it’s certainly not working like any drop list I’ve ever used.

Basically to add items you call the following;

string stringtoadd = "Some String Value";
_DropToFill.options.Add(new Dropdown.OptionData() { text = stringtoadd });

That will add the ‘stringtoadd’ variable to the drop list as a selectable item. Do this for each item you need to add (so itterate through an array or whatever).

To determine what value of the list has been selected create an appropriately named method and apply that to the OnValueChanged event of the dropdown list component in the Inspector. Note, the OnValueChanged event is called anytime a user simply clicks on the drop list as opposed to when the value is actually changed(!) This strikes me as a Unity bug becuase the name implies that the event should only happen when the value of the drop list changes (otherwise it would be an OnClick event).

Anyway, hopefully that gets you started.