-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
computed_states example broken #22822
Description
Bevy version and features
- 0.18.0
- bevy_dev_tools
What you did
While running the computed_states example, pausing or activating the turbo causes a duplicate sprite to be produced.
What went wrong
State transitions for ComputedStates are not idempotent and will trigger OnEnter schedules per underlying state change without their corresponding OnExit schedules.
The provided example for ComputedStates will rerun the setup_game system and produce an additional sprite per pause or turbo switch.
Additional information
The behavior change occured on Pull Request #21792
On crates/bevy_state/src/state/computed_states.rs:79
/// Whether state transition schedules should be run when the state changes to the same value. Default istrue. const ALLOW_SAME_STATE_TRANSITIONS: bool = true;
Setting the flag to false returns the example to 0.17.0 behavior.
I'm very new to Bevy, so I'm unsure if this should be considered a bug in Bevy or an example that needs updated to meet new behavior.