38 releases (20 breaking)

0.20.1 Mar 12, 2023
0.19.0 Jan 15, 2023
0.18.0 Dec 11, 2022
0.17.1 Nov 13, 2022
0.0.1 Aug 14, 2020

#8 in Game dev

Download history 2063/week @ 2022-11-30 3103/week @ 2022-12-07 2216/week @ 2022-12-14 2916/week @ 2022-12-21 2751/week @ 2022-12-28 2323/week @ 2023-01-04 2846/week @ 2023-01-11 3308/week @ 2023-01-18 3493/week @ 2023-01-25 4012/week @ 2023-02-01 2687/week @ 2023-02-08 4316/week @ 2023-02-15 3607/week @ 2023-02-22 3243/week @ 2023-03-01 4943/week @ 2023-03-08 3722/week @ 2023-03-15

16,501 downloads per month
Used in 69 crates (40 directly)

MIT license

110KB
1.5K SLoC

Stand With Ukraine

bevy_egui

Crates.io Documentation License Downloads Rust

This crate provides a Egui integration for the Bevy game engine.

Trying out:

An example WASM project is live at mvlabat.github.io/bevy_egui_web_showcase [source].

Features:

bevy_egui can be compiled with using only bevy and egui as dependencies: manage_clipboard and open_url features, that require additional crates, can be disabled.

bevy_egui

Dependencies

On Linux, this crate requires certain parts of XCB to be installed on your system. On Debian-based systems, these can be installed with the following command:

$ sudo apt install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev

Usage

Here's a minimal usage example:

# Cargo.toml
[dependencies]
bevy = "0.10"
bevy_egui = "0.20"
use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(EguiPlugin)
        // Systems that create Egui widgets should be run during the `CoreSet::Update` set,
        // or after the `EguiSet::BeginFrame` system (which belongs to the `CoreSet::PreUpdate` set).
        .add_system(ui_example_system)
        .run();
}

fn ui_example_system(mut contexts: EguiContexts) {
    egui::Window::new("Hello").show(contexts.ctx_mut(), |ui| {
        ui.label("world");
    });
}

For a more advanced example, see examples/ui.rs.

cargo run --example ui

See also

Bevy support table

Note: if you're looking for a bevy_egui version that supports main branch of Bevy, check out open PRs, there's a great chance we've already started working on the future Bevy release support.

bevy bevy_egui
0.10 0.20
0.9 0.17-0.19
0.8 0.15-0.16
0.7 0.13-0.14
0.6 0.10-0.12
0.5 0.4-0.9
0.4 0.1-0.3

Dependencies

~25–61MB
~1M SLoC