- edited description
[Suggestion/Example] The Case for Enum Sets
(As suggested in Discord) (Odin version not relevant)
Say I have some enum called ElementalDamage. I want to display it in the inspector as buttons, like with [EnumToggleButtons], and I want to choose multiple damage types at the same time. Say, storm & fire damage for my sword!
Right now, I can do this with bitmask (Example A). But I want to do this without bitmask (Example B).
I may not want to use bitmask for my enum because:
• Working with bitmask is not as easy as working with collections like lists, sets, and arrays; these have many available methods and Linq support, but enums do not come with any methods besides HasFlag.
• Maybe I am using an enum from a plugin that is not bitmask, so it cannot be changed to bitmask since it is not my code.
• This would be a great ease of life feature by Odin – no more need for bitmasks in Unity if you like to avoid them. The performance difference will be minor anyway.
Relevant documentation for [EnumToggleButtons]:
https://odininspector.com/documentation/sirenix.odininspector.enumtogglebuttonsattribute
In Discord, Sirenix suggested a possible workaround for now by using:
https://odininspector.com/documentation/sirenix.odininspector.valuedropdownattribute
Comments (1)
-
reporter - Log in to comment