If I wanna create a drop down menu, how should I do that?
Please help~~~
If I wanna create a drop down menu, how should I do that?
Please help~~~
Use an EditorGUI.Popup field.
http://unity3d.com/support/documentation/ScriptReference/EditorGUILayout.Popup.html
You may also find EditorGUI.Foldout useful.
Popup field example
int selected = 0;
string[] options = new string[]
{
"Option1", "Option2", "Option3",
};
selected = EditorGUILayout.Popup("Label", selected, options);
Its a bit old topic, but maybe someone still loking for another answer.
If you look for a simple solution for dropowns based on enums:
Try using the new asset Dropdown Attribute
you can make the dropdown without creating a custom editor
string[] options = new string[]
{
"Option1", "Option2", "Option3",
};
[Dropdown("options")]
string selected;