Skip to content

Commit

Permalink
fix compiling examples without serde features
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz committed Jul 12, 2024
1 parent b5195af commit b80ed6b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bevy_rapier2d/examples/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ fn main() {
}

pub fn print_physics(context: Res<RapierContext>) {
println!(
#[cfg(feature = "serde-serialize")]
info!(
"{}",
serde_json::to_string_pretty(&(*context)).expect("Unable to serialize `RapierContext`")
);
#[cfg(not(feature = "serde-serialize"))]
error!("Example 'serialization' should be run with '--features serde-serialize'.");
}

fn quit(mut exit_event: EventWriter<AppExit>) {
Expand Down

0 comments on commit b80ed6b

Please sign in to comment.