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?