jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.1k stars 164 forks source link

Adding `EguiPlugin` plugin before `WorldInspectorPlugin::new()` causes panic #175

Open anton-carlsson opened 6 months ago

anton-carlsson commented 6 months ago

Hello!

Rust/bevy newbie here.

Using the latest versions of rustc (1.74.1), bevy (0.12.1), bevy_egui (0.24) and bevy-inspector-egui (0.21) causes a panic with this code:

App::new()
  .add_plugins(DefaultPlugins)
  .add_plugins(EguiPlugin)
  .add_plugins(WorldInspectorPlugin::new())
  .run();

Code in WorldInspectorPlugin::new() is checking if EguiPlugin is already added, but fails, and causes this panic:

thread 'main' panicked at C:\Users\[name]\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy-inspector-egui-0.21.0\src\quick.rs:67:17:
Error adding plugin bevy_egui::EguiPlugin: : plugin was already added in application

My dependencies looks like this:

bevy = { version = "0.12.1", features = [] }
bevy_egui = { version = "0.24" }
bevy-inspector-egui = { version = "0.21" }

I'm still new to the rust eco-system and bevy so I can't wrap my head around this issue yet :)

FYI, I had a working project before this, using these dependencies:

bevy = { version = "0.11.3", features = [] }
bevy_egui = { version = "0.22" }
bevy-inspector-egui = { version = "0.20" }

Let me know if you need more information.