Skip to content

Commit

Permalink
fix example in readme
Browse files Browse the repository at this point in the history
fixes #167
  • Loading branch information
cbrown1234 authored and jakobhellermann committed Dec 27, 2023
1 parent 30ed19c commit 0c01c75
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ fn main() {
}

fn inspector_ui(world: &mut World) {
let egui_context = world.resource_mut::<bevy_egui::EguiContext>().ctx_mut().clone();

egui::Window::new("UI").show(&egui_context, |ui| {
let Ok(egui_context) = world
.query_filtered::<&mut EguiContext, With<PrimaryWindow>>()
.get_single(world)
else {
return;
};
let mut egui_context = egui_context.clone();

egui::Window::new("UI").show(egui_context.get_mut(), |ui| {
egui::ScrollArea::vertical().show(ui, |ui| {
// equivalent to `WorldInspectorPlugin`
// bevy_inspector_egui::bevy_inspector::ui_for_world(world, ui);
bevy_inspector_egui::bevy_inspector::ui_for_world(world, ui);

egui::CollapsingHeader::new("Materials").show(ui, |ui| {
bevy_inspector_egui::bevy_inspector::ui_for_assets::<StandardMaterial>(world, ui);
Expand Down

0 comments on commit 0c01c75

Please sign in to comment.