How to create enum out of array of string?

Hi,

I want to create the below scenario :

I have 2 scripts

1 attached to a GameObject with the name “MaterialManager
This accepts the array of strings:

Cobalt, Sandstorm, SangriaRed, Smoke etc
This script is constant for one object
Should look like this:


I should have one more script with the Name “ProductsEnum” which should have array of enum.
This enum should show the MaterialManager’s array of string as enum in the editor.

I don’t mind keeping an editor button to update the enum list when any new material is added in the material manager.

Can Look something Like this


Can someone please help me do this?
All these things must be Custom Editor Script and not the runtime one.

Thanks.

Here is youtube tutorial how to show List as Enum in inspector

https://www.youtube.com/watch?v=ThcSHbVh7xc

158744-gif.gif

You can not simply set enum values. Enum values are constant values. Enums need to be compiled while values in an array are runtime values. You can however use an editor script to create a new script file dynamically like shown over here.