diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index f67ce35bbb..0f57f448a1 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -250,6 +250,10 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream { #param.new_archetype(archetype, system_meta); )* } + + fn apply(&mut self, world: &mut World) { + self.0.apply(world) + } } diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 52d8b0a12d..541cd674be 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -103,7 +103,7 @@ mod tests { query::{Added, Changed, Or, With, Without}, schedule::{Schedule, Stage, SystemStage}, system::{ - IntoExclusiveSystem, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, + Commands, IntoExclusiveSystem, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, RemovedComponents, Res, ResMut, System, SystemState, }, world::{FromWorld, World}, @@ -906,4 +906,23 @@ mod tests { expected_ids ); } + + #[test] + fn commands_param_set() { + // Regression test for #4676 + let mut world = World::new(); + let entity = world.spawn().id(); + + run_system( + &mut world, + move |mut commands_set: ParamSet<(Commands, Commands)>| { + commands_set.p0().entity(entity).insert(A); + commands_set.p1().entity(entity).insert(B); + }, + ); + + let entity = world.entity(entity); + assert!(entity.contains::()); + assert!(entity.contains::()); + } }