| Crates.io | bevy_mod_config |
| lib.rs | bevy_mod_config |
| version | 0.2.2 |
| created_at | 2025-07-09 16:46:42.457223+00 |
| updated_at | 2025-07-18 15:52:47.7507+00 |
| description | A Bevy plugin for configuration management |
| homepage | |
| repository | https://github.com/SOF3/bevy_mod_config |
| max_upload_size | |
| id | 1745149 |
| size | 226,578 |
A bevy plugin for configuration management.
#[derive(Config)] that can be used to access config values
through ReadConfig in systems.Declare one or more config hierarchies with #[derive(Config)]:
#[derive(Config)]
struct Foo {
thickness: i32,
color: Color,
}
#[derive(Config)]
#[config(expose(read))] // Expose the generated `ColorRead`
enum Color {
White,
Black,
}
Initialize the root field with App::init_config:
type ManagerType = (Manager1, Manager2, ...);
bevy_mod_config::ScalarManager,
)
app.init_config::<ManagerType, Foo>("foo");
Root fields can be accessed from systems using ReadConfig:
fn my_system(foo: ReadConfig<Foo>) {
let foo = foo.read();
assert_eq!(foo.thickness, 3);
assert!(matches!(foo.color, ColorRead::White));
}
Note that read() returns the Reader type instead of the original type
(similar to how #[derive(QueryData)] gives XxxItem to systems).
This may have an impact on matching and passing values around.
The Reader type may be accessed as <Foo as ConfigField>::Read<'_>,
or directly exposed with #[config(expose(read))] after the derive.
Managers enable systematic management of scalar config fields.
bevy_mod_config::manager::Serde exposes APIs to
load/save config values to/from serialized data.bevy_mod_config::manager::EguiEditor provides an in-game egui editor
to modify config values live.