Store enum values as text

gumboots

Member
Hi there!

I wonder if it's possible to store enum values as their text value, rather than (I assume) their integer value? The issue is if I add a new enum value that occurs before a selected value, then it messes up previous tasks.

Alternatively I'd love another way around this! I understand it's an issue in general with Unity.
 
Hmm.. I'm not completely following what the issue is - can you explain more?
 
So if I have an enum say:
C#:
enum Names { First, Second, Third }

And have a public Names field in a task, with the value Names.Second, if I later change my enum to:
C#:
enum Names { First, Broken, Second, Third }

Then my previous reference to Names.Second becomes Names.Broken, and tracking down everywhere this has happened is somewhat of a nightmare.
 
Top