Skip to content

Commit

Permalink
Fix ToggleActions from releasing other action's inputs (#410)
Browse files Browse the repository at this point in the history
* Fix `ToggleActions` from releasing other action's inputs

* cargo fmt

* Update RELEASES.md
  • Loading branch information
100-TomatoJuice authored Nov 8, 2023
1 parent 4091c27 commit 42b0b21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## Unreleased

### Bugs
- A disabled `ToggleActions` of one `Action` now does not release other `Action`'s inputs.

## Version 0.11.1
- `bevy_egui` integration and the `egui` feature flag have been added back with the release of `bevy_egui` 0.23.

Expand Down
13 changes: 5 additions & 8 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,13 @@ impl<A: Actionlike> Plugin for InputManagerPlugin<A> {

app.add_systems(
PreUpdate,
update_action_state::<A>.in_set(InputManagerSystem::Update),
);

app.configure_sets(
PreUpdate,
InputManagerSystem::Update
update_action_state::<A>
.run_if(run_if_enabled::<A>)
.after(InputSystem),
.in_set(InputManagerSystem::Update),
);

app.configure_sets(PreUpdate, InputManagerSystem::Update.after(InputSystem));

#[cfg(feature = "egui")]
app.configure_sets(
PreUpdate,
Expand All @@ -125,7 +122,6 @@ impl<A: Actionlike> Plugin for InputManagerPlugin<A> {
app.configure_sets(
PreUpdate,
InputManagerSystem::ManualControl
.run_if(run_if_enabled::<A>)
.before(InputManagerSystem::ReleaseOnDisable)
.after(InputManagerSystem::Tick)
// Must run after the system is updated from inputs, or it will be forcibly released due to the inputs
Expand All @@ -139,6 +135,7 @@ impl<A: Actionlike> Plugin for InputManagerPlugin<A> {
app.add_systems(
PreUpdate,
update_action_state_from_interaction::<A>
.run_if(run_if_enabled::<A>)
.in_set(InputManagerSystem::ManualControl),
);
}
Expand Down

0 comments on commit 42b0b21

Please sign in to comment.