Skip to content

feat: reactive ui example, an inventory which reads and writes the ECS - #731

Open
makspll wants to merge 4 commits into
agent/reactive-ui-docsfrom
agent/reactive-ui-example
Open

makspll wants to merge 4 commits into
agent/reactive-ui-docsfrom
agent/reactive-ui-example

Conversation

@makspll

@makspll makspll commented Nov 13, 2026

Copy link
Copy Markdown
Owner

cargo run --example reactive_ui --features lua54: an inventory of 500 items which live in the ECS as Item components, shown and edited by a reactive ui in Lua (assets/scripts/inventory_ui.lua).

  • ECS → ui: a Rust system restocks a few items five times a second. The ui watches the components, only the rows of the items which changed update, with no script code run (the rows are a row template)
  • ui → ECS: clicking a slot selects it, the buttons of the selected item write to its Item component from the script. Rust systems see those like any change
  • the bar at the top shows how long the last ui update took, measured by two systems around ReactiveUiSystems, and how often Rust restocked
  • filters by kind, a details component with closures next to the templated list, context free: the two styles side by side
  • editing the script while it runs reloads the ui and keeps its state

Also in this PR, needed by the example: ui.list, ui.list_template and ui.show take the properties of the node holding their children as a last argument, so a list can be laid out (a wrapping row here).

The root crate's dev dependencies gain the bevy features the example needs to draw and click a ui (bevy_ui_render, bevy_text, bevy_picking, ui_picking) and the ui crate.

Checked here by running a headless copy of the example for 200 frames: 500 rows mounted, counts following the restocking, no script errors. It could not be run in a window in this environment, so clicking through it is not verified.

Stacked on #730.

@semanticdiff-com

semanticdiff-com Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/bevy_mod_scripting_reactive_ui/src/runtime.rs  62% smaller
  crates/bevy_mod_scripting_reactive_ui/src/lib.rs  34% smaller
  Cargo.toml Unsupported file format
  assets/scripts/inventory_ui.lua  0% smaller
  docs/src/ReactiveUi/introduction.md Unsupported file format
  docs/src/ReactiveUi/reference.md Unsupported file format
  examples/reactive_ui.rs  0% smaller

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectBevy Scripting
Branchagent/reactive-ui-example
Testbedlinux-gha

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant