- Home /
EditorWindow enum selection
Hey all,
just a quick question, when building custom editor windows, is it possible (and if so how) to add in a dropdown selection for an enum and populate it with all the values of that enum without having to manually add each one?
for example in one of my old scripts i had a KeyCode enum, now as a public script property it simply provides the drop down, but as something im building in an editor window i cant seem to find a way of doing this without building a popup window and manually adding in each value of the KeyCodes Enum.
any sugestions?
Answer by Bunny83 · Jul 28, 2012 at 02:16 AM
I guess you need EditorGUI.EnumPopup ;)
In C# you have to cast the return value to your enum type since EnumPopup returns just an generic enum value.
Wow i have no idea how i didn't come across that in the guide when i was looking, must have been way to fried. Thanks for the answer, works a charm.
Your answer
Follow this Question
Related Questions
Editor Color Picker issues 0 Answers
How to override geometry of a procedurally generated sprite in Editor Mode 0 Answers
Save/Attach content of editorWindow to a gameObject 1 Answer
How do you draw in an Editor Window and be able to move it to Scene View? 0 Answers
Why does my Unity Serialization not work? Do i miss something? 1 Answer