[Inspector] Populate Enum Options with List of Files?

I’d like to populate the options in an enum list based on the files inside a folder.

Here’s the current code:

enum Attacks {Option1, Option2, Option3}
var attackChoice : Attacks;

Instead of hard-coding the options, I want the list to include every Prefab I’ve created inside my “Attacks” folder. That way, as I create new “Attack Prefabs”, they are added to the list for selection.

Is this possible?

Modifying the contents of an enum is not possible during runtime. Doing that would defeat the whole purpose of an enum, which is to list - or enumerate - every possible option available at any given time during runtime.

What you can do, is read the contents of your folder, then add those files to a list or other data structure, whose contents you then show in your inspector.