dear-imgui-bevy
Bevy-native backend for dear-imgui-rs.
This crate integrates Dear ImGui with Bevy's ECS, window/input messages, WGPU render world, camera
targets, and texture assets. It is intentionally not a wrapper around dear-imgui-winit plus
dear-imgui-wgpu: Bevy owns the app loop and render schedules, so this backend follows Bevy's
ownership model directly.
Quick Facts
| Item | Status |
|---|---|
| Rust | 1.95.0 or newer |
| Bevy | =0.19.0-rc.2 |
| dear-imgui-rs | 0.14 |
| Primary-window overlay | Supported with the render feature |
| Docking in the primary window | Supported when the ImGui context enables docking |
| Native multi-viewport OS windows | Preview-grade with render,multi-viewport |
| WASM | Core and render feature sets compile for wasm32-unknown-unknown; browser runtime integration is still limited |
Getting Started
Use the same Bevy version as the backend:
[]
= "=0.19.0-rc.2"
= { = "0.15", = ["render"] }
= "0.14"
A minimal overlay app registers ImguiPlugin, marks the camera that should receive the ImGui
overlay, and draws UI from ImguiPrimaryContextPass:
use *;
use ;
Application UI systems should draw through the Ui returned by ImguiContexts. Do not call
Context::frame() or Context::render() yourself; the plugin owns the frame lifecycle.
Examples
Start with simple, then move to app_integration and game_engine as your integration needs
grow.
| Category | Example | Source | Run command | Purpose |
|---|---|---|---|---|
| Basic | simple |
examples/basic/simple.rs |
cargo run -p dear-imgui-bevy --features render --example simple |
Smallest visible Dear ImGui overlay in a normal Bevy app. |
| App | app_integration |
examples/app/app_integration.rs |
cargo run -p dear-imgui-bevy --features render --example app_integration |
Plugin-style integration into an existing app/game loop with Bevy input policy. |
| Game engine | game_engine |
examples/game_engine/game_engine.rs |
cargo run -p dear-imgui-bevy --features render --example game_enginecargo run -p dear-imgui-bevy --features render,multi-viewport --example game_engine |
Docked editor surface with scene render-target texture interop, plus optional native multi-viewport. |
| Ecosystem | ecosystem |
examples/ecosystem/ecosystem.rs |
cargo run -p dear-imgui-bevy --features render --example ecosystem |
Shared-frame ImPlot, ImNodes, and ImGuizmo integration. |
| Ecosystem | bevy_plot_controls |
examples/ecosystem/bevy_plot_controls.rs |
cargo run -p dear-imgui-bevy --features render --example bevy_plot_controls |
Focused Bevy scene plus ImPlot controls demo. |
Screenshots
Cargo Features
| Feature | What it enables |
|---|---|
default |
Core plugin, context lifecycle, schedules, and input translation. No renderer is installed. |
render |
Bevy RenderApp extraction, WGPU overlay renderer, ImguiOverlayCamera, ImguiOverlayDisabled, and ImguiBevyTextures. |
multi-viewport |
Native Dear ImGui PlatformIO window lifecycle bridge. Use with render for full routed rendering. |
ImPlot, ImNodes, ImGuizmo, and other Ui-based extension crates compose with this backend through
the same ImguiPrimaryContextPass frame. They are not dear-imgui-bevy feature flags; add the
extension crates you use to your application dependencies directly.
Integration Guide
Frame Lifecycle
ImguiPlugin installs three main-world schedules:
ImguiBeginFrametranslates Bevy input and opens the Dear ImGui frame.ImguiPrimaryContextPassruns your UI systems against the already-open frame.ImguiEndFramerenders once and stores an ownedFrameSnapshotfor the render world.
The main user-facing APIs are:
| Need | API |
|---|---|
| Add the backend | ImguiPlugin |
| Configure requested backend behavior | ImguiBackendConfig |
| Check runtime capability | ImguiBackendStatus |
| Draw UI inside Bevy schedules | ImguiContexts and ImguiPrimaryContextPass |
| Route gameplay/editor input | input::ImguiInputCapture |
| Select overlay render targets | render::ImguiOverlayCamera |
| Prevent offscreen scene targets from receiving the global overlay | render::ImguiOverlayDisabled |
| Show Bevy images in ImGui | ImguiBevyTextures |
Render Targets and Scene Views
With the render feature enabled, the backend extracts ImGui frame snapshots into Bevy's render
world and draws them through Bevy cameras. Add ImguiOverlayCamera to the camera that should
receive the overlay for a render target.
Editor-style scene views usually render Bevy content into an Image, register that image through
ImguiBevyTextures, and show it with ui.image(...). Add ImguiOverlayDisabled to the offscreen
scene camera so the global ImGui overlay is not rendered back into the scene texture.
Docking and Multi-Viewport
Docking inside the primary Bevy window works like normal Dear ImGui docking: enable docking on the context, create a dockspace, then dock or drag windows inside it.
Native multi-viewport OS windows are experimental. They require a native target, render, and
multi-viewport. The backend creates Bevy windows for Dear ImGui platform viewports, maps
input/focus/cursor/IME feedback, and routes each viewport's draw data to the matching Bevy
Window render target. Detached-window z-order and dock-target edge cases are still preview-grade.
| Target / feature set | Lifecycle bridge | Input / feedback | Full rendering |
|---|---|---|---|
Native without multi-viewport |
No | No | No |
Native with render,multi-viewport and Bevy RenderApp |
Yes | Yes | Yes |
Native with multi-viewport but no RenderApp |
Yes | Yes | No |
wasm32-unknown-unknown |
No | No | No |
Input Policy
The backend forwards Bevy input messages into Dear ImGui IO and does not consume or delete Bevy
messages. Gameplay and editor systems should use ImguiInputCapture as a policy hint after ImGui
has computed capture intent.
Current boundaries:
- pointer and keyboard capture are policy hints only;
- clipboard remains application-provided;
- accessibility nodes are not generated for Dear ImGui widgets;
- file drop, gamepad navigation, and Bevy picking integration are not part of this backend yet;
- wasm builds compile, but browser runtime IME and clipboard behavior depend on the host.
Development Checks
Recommended checks for this crate:
Use cargo run commands from the examples table for manual smoke tests.