Skip to content

WidgetsBook

WidgetsBook is the built-in way to compose a debug panel. Organize controls into pages (tabs) using a declarative widget library built on AppUI. Widgets support data binding — they stay in sync with your runtime values automatically without any manual refresh calls.

Available Widgets

WidgetDescription
InfoDisplay a read-only string or bool value
TextDisplay a read-only text without a label
ToggleSwitch a boolean value on/off
Button / ButtonsGridTrigger sync or async debug actions
Slider (int / float)Adjust a numeric value with configurable range and step
Range SliderSelect a min/max range with two handles
StepperIncrement/decrement a value
SelectorPick from a list (dropdown)
Text InputEnter and bind a string value

Building a Panel

Use Widget.Create() with a fluent builder API to compose widgets into a descriptor, then add them to a page:

csharp
private void Awake()
{
    FludeX.Instance.Initialize();

    if (!FludeX.Instance.TryGetModule<FludexPlaygroundModule>(out var playground))
        return;

    var page = new WidgetsPageDescriptor("My Controls");
    page.AddWidget(Widget.Create()
        .WithTitle("GAMEPLAY")
        .WithToggle("God Mode", () => godMode)
        .WithButton("Reload Scene", ButtonType.Accent, OnReloadPressed)
        .WithSlider("Time Scale", () => Time.timeScale, 0f, 2f)
        .Build());

    playground.AddPage(page);
}

Data Binding

Pass a C# expression to any widget that binds a value — FludeX inspects the expression at runtime to derive both the getter and the setter automatically. No separate setter callback, no manual refresh calls needed.

csharp
// Member access — FludeX auto-derives the setter; widget stays in sync both ways
.WithToggle("Dark Mode", () => mySettings.darkMode)
.WithSlider("Volume", () => AudioListener.volume, 0f, 1f)

// Computed expression — getter only, no setter (no writable target to set back to)
.WithInfo("FPS", () => (1f / Time.deltaTime).ToString("F0"))

If the target object implements INotifyPropertyChanged, the binding wires up change notifications automatically — the widget updates immediately when the value changes, without polling.

See Sample 02 – WidgetsBook and Sample 04 – WidgetsShowcase for full examples.