How to make a combo box

Hi, i need to make a gui in unity and provide a combo box widget. Any drop-down list will do. Basically I need to provide the user a list of strings and then know which one the user has selected. Any ideas?

thanks

3 Answers

3

http://www.unifycommunity.com/wiki/index.php?title=SelectList

If you need custom strings, you can probably modify that script to do that.

thanks, it is close to what i want. do you know how to achieve the dropdown effect?

Sorry, I never really used UnityGUI, I found this script searching google and the unity community...which is generally a good idea to do. I am certain somebody already programmed a dropdown menu for Unity, you could find out how they did it there and use it for your case. Most liekly, it's an animation (iTween/AniMate/Unity) that is triggered when you click the list.

Well, i think i will stick with that selectlist script for simplicity. thank you

There is, actually, a ComboBox in my framework, check it out: http://edrivenunity.com/form2

Danko

Working example for editor GUI

int selected = 0;
string[] options = new string[]
{
    "Option1", "Option2", "Option3", 
};
selected = EditorGUILayout.Popup("Label", selected, options);