Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,31 @@ Now try changing that string at runtime and then check your logs!
Note that changing the `greet` function's signature at runtime by e.g. adding a new parameter will still require a restart.
In general, you can only change the code *inside* the function at runtime. See the *Advanced Usage* section for more.

## Alternative Method
Copy link
Member

@janhohenheim janhohenheim May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add its caveats? I think Resources and Local / EventReaders should be noted there

```rust,ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the readme slim, can we put this behind <details>?

use bevy::prelude::*;
use bevy_simple_subsecond_system::prelude::*;

fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(SimpleSubsecondPlugin::default())
.with_hot_patch(|app: &mut App| {
app.add_systems(Update, greet)
})
.run()
}

fn greet(time: Res<Time>) {
info_once!(
"Hello from a hotpatched system! Try changing this string while the app is running! Patched at t = {} s",
time.elapsed_secs()
);
}
```

This method allows you to add/remove new systems at runtime. See `examples/add_systems` for more info.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth noting that you're allowed to change signatures at runtime, too :)


## Examples

Run the examples with
Expand Down