Hi Unity,
I was playing around in PropertyDrawers today and found an undocumented feature of EditorGUI.Popup. When you format your displayedOptions array elements with “/” characters in the strings the popup will create sub-menus collecting options that shared the same roots.
So for instance the code below will generate the popup menus in the linked image.
int selectedIndex = EditorGUI.Popup(
position,
label.text,
0,
new string[4] { "Split1/Value1", "Split1/Value2", "Split2/Value1", "Split2/Value2" });
I know that this is known to a few others but I just happened to stumble across this feature as I was unaware it was even possible. I would have loved to have known about it on an earlier project this year. I’d like to put in a request to have this feature added to the documentation of EditorGUI.Popup so that others can benefit from it.
Sarah