Crate bevy_inspector_egui
source · [−]Expand description
This crate provides the ability to annotate structs with a #[derive(Inspectable)]
,
which opens a debug interface using egui where you can visually edit the values of your struct live.
Your struct will then be available to you as a bevy resource.
Example
use bevy_inspector_egui::Inspectable;
#[derive(Inspectable, Default)]
struct Data {
should_render: bool,
text: String,
#[inspectable(min = 42.0, max = 100.0)]
size: f32,
}
Add the InspectorPlugin
to your App.
use bevy_inspector_egui::InspectorPlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(InspectorPlugin::<Data>::new())
.run();
}
The list of built-in attributes is documented here.
World Inspector
If you want to display all world entities you can add the WorldInspectorPlugin
:
use bevy::prelude::*;
use bevy_inspector_egui::WorldInspectorPlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup.system())
.run();
}
You can configure it by inserting the WorldInspectorParams
resource.
In order for custom components to be displayed in the world inspector, you’ll need to register it on the InspectableRegistry
.
Features
- clipboard (enabled by default): enables
egui
’s clipboard integratoin
Re-exports
pub use bevy_egui;
pub use bevy_egui::egui;
Modules
Attributes for the built-in Inspectable
implementations
Internals for the inspector plugins
Commonly used imports
Inspectable
implementation for foreign types implementing Reflect
Utitly types implementing Inspectable
Configuration for the WorldInspectorPlugin
Structs
The context passed to Inspectable::ui
.
The InspectableRegistry
can be used to tell the WorldInspectorPlugin
how to display a type.
Bevy plugin for the inspector. See the crate-level docs for an example on how to use it.
Resource which controls the way the world inspector is shown.
Plugin for displaying an inspector window of all entites in the world and their components.
Traits
This trait describes how a struct should be displayed. It can be derived for structs and enums, see the crate-level docs for how to do that.
Helper trait for enabling app.register_inspectable::<T>()
Derive Macros
Derives the Inspectable
trait.