Inspector List: DropDown list Update regarding Prefab in asset folder


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.


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.