#Error with running a one-shot system

3 messages · Page 1 of 1 (latest)

timber crystal
#

I'm getting an error

CommandQueue has un-applied commands being dropped. Did you forget to call SystemState::apply?

when I'm trying to run a one-shot. The offending system is

pub fn spawn_initial_hand(mut commands: Commands, deck_state: Res<DeckState>, spawn_ui_card_system: Res<SpawnUICardSystem>) {
    for (i, card_id) in deck_state.current_hand.iter().enumerate() {
        commands.run_system_with(spawn_ui_card_system.0, (card_id.clone(), i));
    }
}

with SpawnUICardSystem being

#[derive(Resource, Deref)]
pub struct SpawnUICardSystem(pub SystemId<In<(CardId, usize)>>);

impl FromWorld for SpawnUICardSystem {
    fn from_world(world: &mut World) -> Self {
        //spawn_ui_card is a predefind system
        SpawnUICardSystem(world.register_system(spawn_ui_card))
    }
}

// in a plugin
app.init_resource::<SpawnUICardSystem>();

I don't think I'm using any SystemStates, so how can I resolve the error?

smoky fulcrum
#

I'm guessing you have app.init_resource::<SpawnUICardSystem>() somewhere too, right?

timber crystal