Adding Data
Scriptable Enum
Last updated
Scriptable Enum
Last updated
One benefit of using ScriptableObjects as enums is the ability to easily add additional data, which is not possible with C# enums. For instance, we can include a name, a sprite field and a color field:
You can see how useful and flexible this approach is. It allows for various enhancements, such as adding resistance multipliers to other elements or a list of elements that one destroys. To compare these enums, you can simply compare the reference.
Another advantage is that ScriptableEnums can be modified and created at runtime. ScriptableEnums enable much more innovative functionalities, and for more details and examples, you can check out the documentation and the scene 6_ScriptableEnums_Example_Scene.