Crates.io | dexterous_developer_internal |
lib.rs | dexterous_developer_internal |
version | 0.2.0 |
source | src |
created_at | 2023-09-06 19:24:26.825688 |
updated_at | 2024-02-18 01:25:33.243144 |
description | A modular hot reload system for rust |
homepage | https://lee-orr.github.io/dexterous_developer/ |
repository | https://github.com/lee-orr/dexterous_developer |
max_upload_size | |
id | 965596 |
size | 25,679 |
An experimental hot reload system for the bevy game engine. Inspired by DGriffin91's Ridiculous bevy hot reloading - adding the ability to re-load arbitrary systems, and the ability to transform resource/component structures over time.
Fuller documentation is available at: https://lee-orr.github.io/dexterous_developer/
Grab the CLI by running: cargo install dexterous_developer_cli
.
You'll be able to run the dexterous version of your code by running dexterous_developer_cli run
in your terminal.
In your Cargo.toml
add the following:
[lib]
name = "lib_THE_NAME_OF_YOUR_GAME"
path = "src/lib.rs"
crate-type = ["rlib"]
[dependencies]
bevy = "0.13"
dexterous_developer = "0.1.1"
serde = "1" # If you want the serialization capacities
[package.metadata]
hot_reload_features = ["bevy/dynamic_linking", "bevy/embedded_watcher"] # this injects these features into the build, enabling the use of bevy's dynamic linking and asset hot reload capacity.
If your game is not a library yet, move all your main logic to lib.rs
rather than main.rs
. Then, in your main.rs
- call the bevy_main function:
fn main() {
lib_NAME_OF_YOUR_GAME::bevy_main();
}
and in your lib.rs
, your main function should become:
#[hot_bevy_main]
pub fn bevy_main(initial_plugins: impl InitialPlugins) {
App::new()
.add_plugins(initial_plugins.initialize::<DefaultPlugins>()) // You can use either DefaultPlugins or MinimnalPlugins here, and use "set" on this as you would with them
// Here you can do what you'd normally do with app
// ... and so on
}
If you have a plugin where you want to add reloadable elements, add the following in the file defining the plugin:
impl Plugin for MyPlugin {
fn build(&self, app: &mut App) {
app
.setup_reloadable_elements::<reloadable>();
}
}
#[dexterous_developer_setup]
fn reloadable(app: &mut ReloadableAppContents) {
app
.add_systems(Update, this_system_will_reload);
}
Bevy | Dexterous Developer |
---|---|
0.13 | >= 0.2 |
0.12 | 0.0.12, 0.1 |
0.11 | <= 0.0.11 |