#bevy #egui #inspector #derive #plugin

macro bevy-inspector-egui-derive

Implementation detail of the bevy-inspector-egui crate

9 breaking releases

0.12.0 Aug 2, 2022
0.11.0 May 8, 2022
0.10.0 Apr 16, 2022
0.7.1 Jan 8, 2022
0.3.0 Jan 24, 2021

#111 in Game dev

Download history 609/week @ 2022-04-26 796/week @ 2022-05-03 1217/week @ 2022-05-10 892/week @ 2022-05-17 1090/week @ 2022-05-24 1018/week @ 2022-05-31 686/week @ 2022-06-07 702/week @ 2022-06-14 1015/week @ 2022-06-21 670/week @ 2022-06-28 481/week @ 2022-07-05 652/week @ 2022-07-12 634/week @ 2022-07-19 700/week @ 2022-07-26 1667/week @ 2022-08-02 1335/week @ 2022-08-09

4,438 downloads per month
Used in 13 crates (via bevy-inspector-egui)

MIT license

515 lines


This crate provides a debug interface using egui where you can visually edit the values of your components live.

demonstration with a running bevy app


You can either inspect a single resource using the InspectorPlugin, or use the WorldInspectorPlugin to inspect all entities.


The InspectorPlugin<T> will insert a resource of type T and display UI for editing that resource.

use bevy::prelude::*;
use bevy_inspector_egui::{InspectorPlugin, Inspectable};

#[derive(Inspectable, Default)]
struct Data {
    should_render: bool,
    text: String,
    #[inspectable(min = 42.0, max = 100.0)]
    size: f32,

fn main() {

World inspector

use bevy::prelude::*;
use bevy_inspector_egui::WorldInspectorPlugin;

fn main() {
world inspector ui

You can configure the WorldInspectorPlugin by inserting the WorldInspectorParams resource. If you want to only display some components, you may want to use the InspectorQuery instead.

Custom components in the world inspector

By default, types implementing Inspectable will not be displayed in the WorldInspector, because the there is no way to know of the trait implementation at runtime. You can call world.register_inspectable::<T>() to tell bevy-inspector-egui how that type should be displayed, and it will show up correctly in the world inspector.

Alternatively, you can #[derive(Reflect)] and call world.register_type::<T>(). This will enable bevy's reflection feature for the type, and it will show up in the world inspector.

use bevy::prelude::*;
use bevy_inspector_egui::{WorldInspectorPlugin, Inspectable, RegisterInspectable};

#[derive(Inspectable, Component)]
struct InspectableType;

#[derive(Reflect, Component, Default)]
struct ReflectedType;

fn main() {
    .register_inspectable::<InspectableType>() // tells bevy-inspector-egui how to display the struct in the world inspector
    .register_type::<ReflectedType>() // registers the type in the `bevy_reflect` machinery, so that even without implementing `Inspectable` we can display the struct fields

More examples (with pictures) can be found in the examples folder.

Common issues

CJK characters aren't rendered correctly

This is because the default egui font does not support rendering these characters, but you can add your own font with support for it by configuring the EguiContext:

fn configure_visuals(mut egui_ctx: ResMut<EguiContext>) {
  let mut fonts = egui::FontDefinitions::default();
  // install your own font (.ttf and .otf supported)
  fonts.font_data.insert("cjk_font".to_string(), egui::FontData::from_static(include_bytes!("../assets/fonts/SourceHanSansCN-Normal.otf")));
  // insert it at the beginning for highest priority
  fonts.families.get_mut(&egui::FontFamily::Proportional).unwrap().insert(0, "cjk_font".to_owned());

Bevy support table

bevy bevy-inspector-egui
0.7 0.11
0.7 0.10
0.6 0.9
0.6 0.8
0.6 0.7
0.5 0.5-0.6
0.5 0.4
0.4 0.1-0.3


~15K SLoC