Editor Script to add element to an enum
Does anyone know a way that you can modify the values stored inside an enum at using an editor script.
I am importing a list from a spreadsheet where each element has a unique Id that i would like to store on the object as a enum (this is mainly for easy comparison with later behaviours). I have got the importer working however currently i have to go into the script every time i add a new element to the spreadsheet and add the ID to the enum list. Im wondering if anyone knows of a way i can make this automatically add a value when i run the importer editor class
eg.
Enum IDS Element1 Element2 Element 3
when i click import for a spreed sheet that i now added element4 it will add it to the bottom.
This only need to work for development so can fully be an editor class
Thanks
Answer by TBruce · Apr 10, 2016 at 04:49 PM
@reddevildragg This can not be done as enums are set of constant values with a set size which is determined at design time. Your best bet would most likely to be to either use a list or a dictionary.
Answer by Reddevildragg · Apr 11, 2016 at 10:43 AM
Thats cool
I did not think it was possible with my initial research but nice to confirm. Ill work using a dictionary or something similar for the importer.
Thanks for the help