-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example to output a debugdump (#576)
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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,33 @@ | ||
//! Example using bevy_mod_debugdump to output a graph of systems execution order. | ||
//! run with: | ||
//! `cargo run --example debugdump2 > dump.dot && dot -Tsvg dump.dot > dump.svg` | ||
|
||
use bevy::prelude::*; | ||
use bevy_mod_debugdump::{schedule_graph, schedule_graph_dot}; | ||
use bevy_rapier2d::prelude::*; | ||
|
||
fn main() { | ||
let mut app = App::new(); | ||
app.add_plugins(( | ||
DefaultPlugins, | ||
RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0), | ||
RapierDebugRenderPlugin::default(), | ||
)); | ||
|
||
let mut debugdump_settings = schedule_graph::Settings::default(); | ||
// Filter out some less relevant systems. | ||
debugdump_settings.include_system = | ||
Some(Box::new(|system: &(dyn System<In = (), Out = ()>)| { | ||
if system.name().starts_with("bevy_pbr") | ||
|| system.name().starts_with("bevy_render") | ||
|| system.name().starts_with("bevy_gizmos") | ||
|| system.name().starts_with("bevy_winit") | ||
|| system.name().starts_with("bevy_sprite") | ||
{ | ||
return false; | ||
} | ||
true | ||
})); | ||
let dot = schedule_graph_dot(&mut app, PostUpdate, &debugdump_settings); | ||
println!("{dot}"); | ||
} |