jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.12k stars 166 forks source link

Way to avoid including dependency in production code #106

Closed tylerkayser closed 1 year ago

tylerkayser commented 1 year ago

Is there any way to avoid including bevy_inspector_egui as a dependency? I'd like for it to be only a dev-dependency, but the Inspectable derive seems to be required for every custom type (enum in my case).

jakobhellermann commented 1 year ago

You can add a feature for it, and only derive Inspectable if that feature is enabled:

#[cfg_attr(feature = "inspector", derive(Inspectable)]
struct YourStruct {}
[features]
inspector = ["bevy-inspector-egui"]

[dependencies]
bevy-inspector-egui = { version = "..", optional = true }