-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: Add comprehensive read-only Bevy Inspector with remote inspection capabilities #20189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jbuehler23
wants to merge
50
commits into
bevyengine:main
Choose a base branch
from
jbuehler23:joe-editor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
cbfefbf
feat(editor): introduce reusable UI widgets for the editor interface
jbuehler23 51dcded
remove unnecessary readmes
jbuehler23 3e9bede
more readme cleanup
jbuehler23 6543102
feat(editor): integrate ListView for entity list management and updat…
jbuehler23 53a5fe4
Refactor: Remove inspector module and related components
jbuehler23 f86ec6f
feat(editor): implement smart entity naming system for improved displ…
jbuehler23 e39f3f3
Refactor entity list plugin and enhance entity naming system
jbuehler23 359fb33
chore: remove debug logging and heartbeat systems from entity list an…
jbuehler23 63b14b9
refactor: begin moving bevy_editor code from PR into bevy_dev_tools
jbuehler23 d981b40
Refactor inspector module to use updated Bevy APIs and improve organi…
jbuehler23 9bf1a25
Refactor code structure for improved readability and maintainability
jbuehler23 016bc85
Implement inspector systems and UI widgets for entity inspection in B…
jbuehler23 2d3d7e5
Add resizable panel and resize handle components
jbuehler23 df4117f
feat: Add Entity Inspector plugin for runtime entity/component inspec…
jbuehler23 400c424
feat: Enhance Entity Inspector with improved UI constraints and state…
jbuehler23 210e378
feat: Implement connection status UI component and related systems
jbuehler23 bc02d3f
feat: Implement robust virtual scrolling with infinite loading and en…
jbuehler23 d25dc03
cleanup: fixed docs and logging
jbuehler23 64aff14
feat: Refactor infinite scrolling display for improved performance an…
jbuehler23 dc90d1d
feat: Enhance virtual scrolling with scrollbar implementation and imp…
jbuehler23 07f622a
feat: Enhance README and UI components with high-performance virtual …
jbuehler23 900795d
feat: Add moving target application example with real-time updates an…
jbuehler23 4ef79a5
cleanup: start migrating code to bevy_dev_tools
jbuehler23 bdfc41e
Remove deprecated widgets and themes from the Bevy Editor, including …
jbuehler23 f5515b0
refactor: Update virtual scrolling implementation to use viewport-rel…
jbuehler23 dde2e81
feat(inspector): implement selection debounce to prevent rapid flashi…
jbuehler23 39f4eb8
feat(inspector): enhance text selection handling with improved state …
jbuehler23 470557c
refactor(inspector): remove tokio dependency and simplify HTTP client…
jbuehler23 10b855d
refactor: extract reusable widgets for upstreaming as necessary
jbuehler23 b027489
refactor: get realtime component updates via bevy_remote and http SSE
jbuehler23 8d4d89f
fix: get realtime data updates for all components on initial connection
jbuehler23 ae5317a
docs: add comprehensive documentation and formatting to get the PR re…
jbuehler23 25a2a42
cleanup: remove unnecessary docs
jbuehler23 c5f6b61
cleanup: remove debug logging
jbuehler23 6092ddd
format: run cargo fmt and hope for the best :)
jbuehler23 25a2be5
bugfix: fix bug with -/+ switching when collapsed/expanded
jbuehler23 dcd470b
cleanup: remove logging
jbuehler23 b01a67b
cleanup: more formatting and clippy/docs :)
jbuehler23 8130889
add examples to readme
jbuehler23 ca53d03
cleanup readme lints
jbuehler23 9ae705e
ci: try and get passing builds for a final time :)
jbuehler23 b44337f
cleanup: remove unnecessary clippy expectations and debug prints for …
jbuehler23 6440e0b
cleanup: remove redundant blank lines and reorder imports for clarity
jbuehler23 879b9fb
cleanup: update README sections for clarity and consistency
jbuehler23 242c4cc
fix: cleanup bugs around query name
jbuehler23 079986b
fix: fix duplicate components being printed when entity is marked as …
jbuehler23 fa00184
revert src/lib changes that snuck in at alice's request :)
jbuehler23 85dbadf
fix: consolidate .DS_Store entries in .gitignore for better clarity
jbuehler23 288998a
Merge remote-tracking branch 'upstream/main' into joe-editor
jbuehler23 98c3ac0
Merge branch 'main' of https://github.com/jbuehler23/bevy into joe-ed…
jbuehler23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| # Bevy Entity Inspector | ||
|
|
||
| The Bevy Entity Inspector is a powerful debugging tool that allows you to inspect and monitor entities and components in real-time, both locally and remotely. It provides two distinct modes of operation: | ||
|
|
||
| 1. **Local Inspector** - An embedded, in-game inspector overlay | ||
| 2. **Remote Inspector** - An external application that connects to your game via `bevy_remote` | ||
|
|
||
| ## Local Inspector (In-Game Overlay) | ||
|
|
||
| The local inspector provides an in-game overlay that can be toggled on/off during development. | ||
|
|
||
| ### Local Setup - TO BE COMPLETED | ||
|
|
||
| Add the `InspectorPlugin` to your application: | ||
|
|
||
| ```rust | ||
| use bevy::dev_tools::inspector::InspectorPlugin; | ||
| use bevy::prelude::*; | ||
|
|
||
| fn main() { | ||
| App::new() | ||
| .add_plugins(DefaultPlugins) | ||
| .add_plugins(InspectorPlugin::debug()) // Use debug preset with F11 toggle | ||
| .run(); | ||
| } | ||
| ``` | ||
|
|
||
| ### Local Usage - TO BE COMPLETED | ||
|
|
||
| - Press **F11** to toggle the inspector overlay | ||
| - Browse entities in the left panel | ||
| - Click on entities to view their components in the right panel | ||
| - Component values update in real-time | ||
|
|
||
| ### Example | ||
|
|
||
| Run the local inspector example: | ||
|
|
||
| ```bash | ||
| cargo run --example inspector --features="bevy_dev_tools" | ||
| ``` | ||
|
|
||
| ## Remote Inspector (External Application) | ||
|
|
||
| The remote inspector runs as a separate application that connects to your game over HTTP using the `bevy_remote` protocol. This is particularly useful for: | ||
|
|
||
| - Inspecting headless applications | ||
| - Debugging without UI overlay interference | ||
| - External tooling and automation | ||
| - Multi-monitor setups | ||
|
|
||
| ### Remote Setup | ||
|
|
||
| #### Target Application (Your Game) | ||
|
|
||
| Add `bevy_remote` plugins to enable external connections: | ||
|
|
||
| ```rust | ||
| use bevy::prelude::*; | ||
| use bevy::remote::{RemotePlugin, http::RemoteHttpPlugin}; | ||
|
|
||
| fn main() { | ||
| App::new() | ||
| .add_plugins(DefaultPlugins) | ||
| .add_plugins(RemotePlugin::default()) // Enable JSON-RPC | ||
| .add_plugins(RemoteHttpPlugin::default()) // Enable HTTP transport | ||
| // Your game systems here... | ||
| .run(); | ||
| } | ||
| ``` | ||
|
|
||
| #### Inspector Application | ||
|
|
||
| Create a separate inspector app: | ||
|
|
||
| ```rust | ||
| use bevy::prelude::*; | ||
| use bevy::dev_tools::inspector::InspectorPlugin; | ||
|
|
||
| fn main() { | ||
| App::new() | ||
| .add_plugins(DefaultPlugins) | ||
| .add_plugins(InspectorPlugin) // Remote inspector (no debug preset) | ||
| .run(); | ||
| } | ||
| ``` | ||
|
|
||
| ### Remote Usage | ||
|
|
||
| 1. **Start your target application** with `bevy_remote` enabled: | ||
|
|
||
| ```bash | ||
| cargo run --example server --features="bevy_remote" | ||
| ``` | ||
|
|
||
| 2. **Start the inspector** in a separate terminal/window: | ||
|
|
||
| ```bash | ||
| cargo run --example entity_inspector_minimal --features="bevy_dev_tools" | ||
| ``` | ||
|
|
||
| The inspector will automatically connect to `localhost:15702` and display your entities. | ||
|
|
||
| ### Features | ||
|
|
||
| - **Real-time Updates**: Component values update live as they change | ||
| - **Interactive UI**: Click to select entities, text selection with copy/paste | ||
| - **Connection Resilience**: Auto-retry logic handles connection failures gracefully | ||
| - **Performance**: Virtual scrolling efficiently handles large numbers of entities | ||
| - **All Components**: Automatically discovers and displays all component types | ||
|
|
||
| ### Connection Details | ||
|
|
||
| - **Default Address**: `localhost:15702` | ||
| - **Protocol**: HTTP with JSON-RPC 2.0 | ||
| - **Endpoints**: | ||
| - `/health` - Connection health check | ||
| - `/jsonrpc` - Main JSON-RPC interface | ||
|
|
||
| ## Component Registration | ||
|
|
||
| For components to be visible in the inspector, they must implement `Reflect`: | ||
|
|
||
| ```rust | ||
| use bevy::prelude::*; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Component, Reflect, Serialize, Deserialize)] | ||
| #[reflect(Component, Serialize, Deserialize)] | ||
| struct Player { | ||
| health: i32, | ||
| speed: f32, | ||
| } | ||
|
|
||
| fn main() { | ||
| App::new() | ||
| .add_plugins(DefaultPlugins) | ||
| .register_type::<Player>() // Required for reflection | ||
| .run(); | ||
| } | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Remote Inspector Issues | ||
|
|
||
| **Inspector shows "Awaiting connection":** | ||
|
|
||
| - Ensure target app is running with `bevy_remote` plugins enabled | ||
| - Verify target app is listening on port 15702 | ||
| - Check firewall/network connectivity | ||
|
|
||
| **Components not visible:** | ||
|
|
||
| - Ensure components implement `Reflect` | ||
| - Register component types with `.register_type::<YourComponent>()` | ||
| - Verify components implement `Serialize`/`Deserialize` for remote inspection | ||
|
|
||
| **Connection drops frequently:** | ||
|
|
||
| - Check target application stability | ||
| - Monitor network connectivity | ||
| - The inspector will automatically retry connections | ||
|
|
||
| ### Local Inspector Issues | ||
|
|
||
| **F11 doesn't toggle inspector:** | ||
|
|
||
| - Ensure you're using `InspectorPlugin::debug()` not `InspectorPlugin` | ||
| - Check if another system is handling F11 key input | ||
|
|
||
| **UI elements not visible:** | ||
|
|
||
| - Verify UI camera is present in your scene | ||
| - Check for UI layer conflicts | ||
|
|
||
| ## Architecture | ||
|
|
||
| The inspector uses several key components: | ||
|
|
||
| - **HTTP Client** (`crates/bevy_dev_tools/src/inspector/http_client.rs`): Manages remote connections and JSON-RPC communication | ||
| - **UI Components** (`crates/bevy_dev_tools/src/inspector/ui/`): Entity list, component viewer, connection status | ||
| - **Virtual Scrolling**: Efficient rendering for large entity lists | ||
| - **Live Updates**: Real-time component value streaming | ||
|
|
||
| ## Examples | ||
|
|
||
| | Example | Purpose | Command | | ||
| |---------|---------|---------| | ||
| | `inspector` | Local in-game overlay | `cargo run --example inspector --features="bevy_dev_tools"` | | ||
| | `server` | Target app for remote inspection | `cargo run --example server --features="bevy_remote"` | | ||
| | `entity_inspector_minimal` | Remote inspector client | `cargo run --example entity_inspector_minimal --features="bevy_dev_tools"` | |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't this just be 1 line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, done