47 releases (27 breaking)

new 0.27.0 Apr 17, 2024
0.26.0 Mar 18, 2024
0.25.0 Feb 19, 2024
0.24.0 Dec 11, 2023
0.0.1 Aug 14, 2020

#3 in Game dev

Download history 5175/week @ 2023-12-24 5465/week @ 2023-12-31 7835/week @ 2024-01-07 7847/week @ 2024-01-14 5772/week @ 2024-01-21 5138/week @ 2024-01-28 4935/week @ 2024-02-04 5829/week @ 2024-02-11 8437/week @ 2024-02-18 6961/week @ 2024-02-25 7885/week @ 2024-03-03 7376/week @ 2024-03-10 8662/week @ 2024-03-17 8116/week @ 2024-03-24 8651/week @ 2024-03-31 5181/week @ 2024-04-07

31,111 downloads per month
Used in 156 crates (82 directly)

MIT license

125KB
2K SLoC

Stand With Ukraine

Hey! I'm the author of the crate, and I was born in Mariupol, Ukraine. When russians started the war in 2014, I moved to Kyiv. My parents, who had been staying in Mariupol till the start of the full-scale invasion, barely escaped the city alive. By the moment of writing (November 5th, 2023), we had 874 air raid alerts in Kyiv, and russians managed to bomb the city 132 times.

If you are using this crate, please consider donating to any of the listed funds (see the banner above), that will mean a lot to me.

bevy_egui

Crates.io Documentation License Downloads Rust

This crate provides an 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.13"
bevy_egui = "0.27"
use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(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_systems(Update, 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.13 0.25-0.27
0.12 0.23-0.24
0.11 0.21-0.22
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

~24–69MB
~1M SLoC