Open griffenliu opened 8 months ago
The only thing in bevy-inspector-egui
that depends on the primary window are the quick
plugins, which are just ~10 lines of code each.
You can copy them and tweak them to use your preferred window.
If this use case comes up a lot and can be integrated into the quick plugins without sacrificing usability in the common case I'll consider adding that as a feature
Ok, thank you very much. Here is a screenshot😀
This feature would be great imo!
This is what I ended up doing:
app.add_plugins(bevy_egui::EguiPlugin)
.add_plugins(DefaultInspectorConfigPlugin)
.add_systems(Startup, spawn_editor_window)
.add_systems(Update, editor_ui);
fn spawn_editor_window(mut commands: Commands) {
commands.spawn((Window::default(), EditorWindow));
}
fn editor_ui(world: &mut World) {
let mut egui_ctx = world
.query_filtered::<&mut EguiContext, With<EditorWindow>>()
.single(world)
.clone();
egui::CentralPanel::default().show(egui_ctx.get_mut(), |ui| {
egui::ScrollArea::vertical()
.auto_shrink([false, false])
.show(ui, |ui| {
bevy_inspector::ui_for_world(world, ui);
})
});
}
Agree it would have been nice to have it as a quick plugin. Sometimes the regular world inspector gets in the way of gameui, or the window layout makes it difficult (e.g. when making mobile games in portrait mode)
I want to implement a multi-window function, the main window shows the game, the second window shows the inspector, can you provide this support?