- Home /
Drop down menu in Custom Editor
If I wanna create a drop down menu, how should I do that?
Please help~~~
Answer by karl_ · Jun 06, 2011 at 04:56 AM
Use an EditorGUI.Popup field.
http://unity3d.com/support/documentation/ScriptReference/EditorGUILayout.Popup.html
You may also find EditorGUI.Foldout useful.
Answer by vikingfabian-com · Aug 27, 2014 at 01:38 PM
Popup field example
int selected = 0;
string[] options = new string[]
{
"Option1", "Option2", "Option3",
};
selected = EditorGUILayout.Popup("Label", selected, options);
Answer by pcdrive · Jul 04, 2018 at 06:02 PM
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:
https://answers.unity.com/questions/201848/how-to-create-a-drop-down-menu-in-editor.html
Answer by hackerG7 · Oct 21, 2020 at 08:44 AM
Try using the new asset Dropdown Attribute https://assetstore.unity.com/packages/tools/utilities/dropdown-attribute-180951
you can make the dropdown without creating a custom editor
string[] options = new string[]
{
"Option1", "Option2", "Option3",
};
[Dropdown("options")]
string selected;
Your answer
Follow this Question
Related Questions
New dropdown menu sample 3 Answers
Native Picker Wheel - iOS UI 0 Answers
How do I replicate brushes selection in Unity terrain component? 0 Answers
ShaderGraph-like EditorWindow 0 Answers