Gameplay UI Runtime And Bevy Sync
Gameplay UI runtime turns authored UI layouts, skins, input profiles, and authoritative player state into live Bevy UI surfaces. It owns HUD and panel view models, layout reloads, frame snapshots, patch generations, input capture, and live preview behavior.
How It Works
Authoring produces layout and skin data. Runtime builds gameplay UI surfaces from descriptors, projects player state into view models, and syncs Bevy entities from layout documents. The live-sync layer tracks frame snapshots and patch generations so reloads update UI without rebuilding unrelated state.
Input capture sits between UI focus and gameplay actions, so typing in chat or interacting with a panel does not leak into movement or combat controls.
How To Use It
Add new gameplay panels through the surface descriptor path. Provide authored layout, skin keys, view-model data, input actions, and sync behavior together. Use runtime keybind and input profile APIs rather than raw key checks.
When testing a UI change, verify both local live preview and multiplayer state projection; they exercise different parts of the sync path.
Invariants
Surface descriptors must stay stable. Patch generations must advance only when the UI source or projected state changes. Input capture must respect focus and should release cleanly when panels close. Layout reload must preserve player state and avoid duplicate entities.
Debugging
Use UI layout and skin validation reports for authored data. Inspect live-sync frame snapshots when entities do not match the layout. Check reload polling and patch generation counters when a live edit does not appear. For input issues, inspect the active profile, focus scope, and captured action.
Examples
To add an inventory-style panel, add a layout document, declare the surface descriptor, project authoritative inventory state into a view model, wire input profile actions, and verify live reload. To add a keybind menu action, define the action in input profiles and make the UI surface consume it through the input manager.