It’s a well-known problem with serialization of enums in Unity3d:
- Use enum as a serialized field in your
MonoBehaviour
orScriptableObject
(or anything serializable). - Fine-tune everything and code your game further casually.
- Add some new enumerators in the middle of your enum.
- BAM!! You are screwed.
What happened? Nothing fancy: new enumerators of your enum just shifted down the old ones occupying their values, because Unity serializes enums as ints.
Solution is easy: serialize enums as strings. And StableEnum will help you with this.