Inspector List: DropDown list Update regarding Prefab in asset folder
Hello,
In the editor I'm made a custom component to let level designers construct their room, regarding some properties.
I want to use a dropdown list (like what enum is actually doing). But I want to have this list updated regarding prefabs in a specific folder (so it's only for unity editor and not runtine for sure).
Enum is doing the job for the dropdown list, but after a lot's of research and test I saw that enum cannot be modify or updated.
Is there a way to do it with enum/ or is there an alternative way to do it with something else? I attach a picture to show what I want.
Thanks
Answer by Adamcbrz · Apr 07, 2017 at 10:14 PM
You can do this in a couple way. 1) You can manage it yourself in a string array and use EditorGUILayout.Popup in your inpector script.
2) You can create a enum like you were thinking. Just create a string in the format of an enum and then save to file as cs file. Once unity re-compiles you will have an updated enum.
Your answer
Follow this Question
Related Questions
[Custom Inspector] How to keep a reference to a selecion in a drop down menu? 0 Answers
How to create a drop down menu in editor inspector 0 Answers
Expose protected variable in inspector 1 Answer
,Unity Custom Inspector CreateInspectorGUI redraw on change 1 Answer
The variables modified in the inspector are not kept on build 0 Answers