#`StateAlreadyQueued` error

5 messages · Page 1 of 1 (latest)

dull hemlock
#

A call to game_state.set(GameScene::Walking).unwrap() errors.
I have a bit complex function that does quite a bit of work.

fn calculate_damage(
    mut commands: Commands,
    ...
    mut game_state: ResMut<State<GameScene>>,
) {
    ...
    if battle_circle.finished(&entities) {
        println!("Battle finished!");
        game_state.set(GameScene::Walking).unwrap();
    } else {
        println!("Back to Card selection...");
        game_state.set(GameScene::CardSelection).unwrap();
    }
}

The game_state isn't used anywhere else in the function.

dull hemlock
#

Having replaced it with game_state.overwrite_set seems to have solved it.
I'm currently worried that this came from a parallel system and that this is an issue I'll probably hit later on as well.

dim perch
#

I do have same issue. Having StateAlreadyQueued error while setting up state that is diffidently not being set anywhere

#

overwrite_set works but I don't understand what causing the issue. Regular set should work

#

the system that calls state change is only called once