Hide
EnumToggleButtons

A toggle buttons group for enum flags (bit mask) or a normal enum. It provides a button to toggle all bits on/off for flags, or a quick selector for normal enum.

This field has compact mode and expanded mode.

Note: Use DefaultExpand if you want it to be expanded by default.

(Old Name: EnumFlags)

Parameters:

  • bool noFold=false: when True, always expand the buttons
using SaintsField; [Serializable, Flags] public enum BitMask { None = 0, // this will be hide as we will have an all/none button Mask1 = 1, Mask2 = 1 << 1, Mask3 = 1 << 2, } [EnumToggleButtons] public BitMask myMask;

For a normal enum it allows you to do a quick select

[Serializable] public enum EnumNormal // normal enum, not flags { First, Second, [InspectorName("<color=lime><label /></color>")] Third, } [EnumToggleButtons] public EnumNormal myEnumNormal; [Serializable] public enum EnumExpand { Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, } // expand it by default [EnumToggleButtons, DefaultExpand] public EnumExpand enumExpand;

image

You can use RichLabel to change the name of the buttons. Note: only standard Unity RichText tag is supported at this point.

[Serializable, Flags] public enum BitMask { None = 0, // this will be replaced for all/none button [InspectorName("M<color=red>1</color>")] Mask1 = 1, [InspectorName("M<color=green>2</color>")] Mask2 = 1 << 1, [InspectorName("M<color=blue>3</color>")] Mask3 = 1 << 2, [InspectorName("M4")] Mask4 = 1 << 3, Mask5 = 1 << 4, } [EnumToggleButtons] public BitMask myMask;

image