Crates.io | iyes_perf_ui |
lib.rs | iyes_perf_ui |
version | |
source | src |
created_at | 2024-03-19 19:16:12.45533+00 |
updated_at | 2025-02-26 08:39:35.528757+00 |
description | Customizable Performance/Debug Overlay for Bevy UI |
homepage | https://github.com/IyesGames/iyes_perf_ui |
repository | https://github.com/IyesGames/iyes_perf_ui |
max_upload_size | |
id | 1179569 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Sponsor me:
Bevy Compatibility:
Bevy Version | Plugin Version |
---|---|
0.15 |
0.4 |
0.14 |
0.3 |
0.13 |
0.2 ,0.1 |
This crate provides an implementation of an in-game performance/debug UI overlay for the Bevy game engine.
The goal of this crate is to make it as useful as possible for any Bevy project:
simple
example)specific_entries
example):
custom_minimal
and custom
examples)settings
, fps_minimalist
examples)Spawning a Perf UI can be as simple as:
commands.spawn(PerfUiDefaultEntries::default());
This creates a Perf UI with a curated selection of entries, which are in my opinion the most useful out of everything provided in this crate.
If you want a UI with all the available entries (note: may have significant performance overhead):
commands.spawn(PerfUiAllEntries::default());
If you want to create a Perf UI with specific entries of your choice, just spawn an entity with the components representing your desired entries, instead of using the above bundles.
commands.spawn((
PerfUiEntryFPS::default(),
PerfUiEntryClock::default(),
// ...
));
There are also some bundles to help you add some common groups of entries:
commands.spawn((
// Contains everything related to FPS and frame time
PerfUiFramerateEntries::default(),
// Contains everything related to the window and cursor
PerfUiWindowEntries::default(),
// Contains everything related to system diagnostics (CPU, RAM)
PerfUiSystemEntries::default(),
// Contains everything related to fixed timestep
PerfUiFixedTimeEntries::default(),
// ...
));
If you want to customize the appearance, set the various fields in each of the
structs, instead of using default()
. To customize settings that apply to all entries,
add the PerfUiRoot
component.
It is possible to visualize the value in other ways, not just display it as text.
iyes_perf_ui
currently provides one such widget implementation: Bar. To
use it, wrap your entries in PerfUiWidgetBar
.
For example, to display FPS as a Bar:
commands.spawn((
PerfUiRoot::default(),
PerfUiWidgetBar::new(PerfUiEntryFPS::default()),
// ...
));
If you want to create your own custom widgets, have a look at implementing
the PerfUiWidget
trait.
Displaying the Perf UI might add non-negligible overhead to your app, depending on configuration. The overhead can be reduced by spawning a simpler UI with fewer entries.
Just keep this in mind. Your game will run slightly faster when the Perf UI is not being displayed. This crate is designed to eliminate all perf overhead when the UI is not rendered on-screen.
A "full" UI with all the entries offered by this crate can add a few hundred
microseconds of frame time on typical gaming hardware, most of which is CPU
time spent in Bevy's UI layout systems (in PostUpdate
).
I am looking for ways to optimize this crate to reduce its overhead.