-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Labels
C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
main: 284889c
Operating system & version
Windows 10 20H2
What you did
use bevy::{
prelude::*,
input::{
keyboard::KeyboardInput,
ElementState
}
};
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_state(GameState::Start)
.add_system_set(SystemSet::on_update(GameState::Start).with_system(transition_check.system()))
.add_system_set_to_stage(CoreStage::PreUpdate, SystemSet::on_update(GameState::Freeze).with_system(do_something.system()))
.run();
}
#[derive(Clone, Eq, PartialEq)]
pub enum GameState {
Start,
Freeze
}
fn transition_check(mut state: ResMut<State<GameState>>, mut keyboard_event_reader: EventReader<KeyboardInput>) {
for event in keyboard_event_reader.iter() {
if event.key_code == Some(KeyCode::Return) && event.state == ElementState::Pressed {
state.set_next(GameState::Freeze).unwrap();
}
}
}
fn do_something() {}What you expected to happen
When the return key is pressed the state transitions to GameState::Freeze and the do_something system begins firing.
What actually happened
When the return key is pressed the application hard locks and enters "not responding".
Additional information
If I try to use a state that I added with add_state(..) as a run criteria for a system I add to any stage other than update (via add_system_set_to_stage(..), the application freezes as soon as the state transition occurs.
rparrett, DenisVerkhoturov and dimvoly
Metadata
Metadata
Assignees
Labels
C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior