Game.UI.Widgets.FlagsField
Assembly:
Game
Namespace: Game.UI.Widgets
Type:
class
Base:
EnumField
Summary:
FlagsField is a thin specialization of EnumField intended to present and edit enum values that represent bitflags (enums marked with the [Flags] attribute). It inherits all behavior and API from EnumField but is intended for multi-select / bitmask enums so the UI shows/checks multiple independent flag values rather than a single selection.
Fields
This class declares no new instance fields
FlagsField does not add any private/public fields of its own — it reuses the storage and fields provided by its base class EnumField.
Properties
This class declares no new properties
All surface API for configuring the enum type, getting/setting the current value, and callbacks are inherited from EnumField.
Constructors
public FlagsField()
Default public constructor. Initializes an instance using base-class construction (no additional initialization performed by FlagsField itself).
Methods
This class declares no new methods
Any lifecycle, rendering, or value-change methods come from the base EnumField. FlagsField does not override or add methods.
Usage Example
// Example [Flags] enum used with FlagsField
[Flags]
public enum MyOptions
{
None = 0,
OptionA = 1 << 0,
OptionB = 1 << 1,
OptionC = 1 << 2,
}
// Example of creating and using a FlagsField in a UI component
[Preserve]
protected override void OnCreate()
{
base.OnCreate();
var flagsField = new FlagsField();
flagsField.name = "myFlagsField";
// Configure the enum type and default value using the inherited EnumField API
// (Exact property/method names are provided by EnumField; common patterns are shown)
flagsField.EnumType = typeof(MyOptions); // set the enum type to display
flagsField.Value = MyOptions.OptionA | MyOptions.OptionB; // set the initial flags selection
// Subscribe to value changes (use the callback mechanism provided by the UI framework / EnumField)
flagsField.RegisterValueChangedCallback(evt =>
{
var selected = (MyOptions)evt.newValue;
// Handle the selected bitmask...
});
root.Add(flagsField); // add to your UI root/container
}
Notes and tips - Use FlagsField with enums decorated with [Flags] so the control presents a bitmask/multi-select UI. If the enum is not a bitflags enum, prefer the regular EnumField usage. - Because FlagsField is just a specialization of EnumField, consult EnumField documentation for detailed API (properties for EnumType/Value, event/callback patterns, styling, localization). - When persisting values, the field typically stores the enum bitmask (often as an integral type). Convert or cast as needed when saving/loading.