Skip to content

Commit dcffedc

Browse files
DJMcNabItsDoot
authored andcommitted
Apply buffers in ParamSet (bevyengine#4677)
# Objective - Fix bevyengine#4676 ## Solution - Fixes bevyengine#4676 - I have no reason to think this isn't sound, but `ParamSet` is a bit spooky
1 parent f1dfa66 commit dcffedc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

crates/bevy_ecs/macros/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
250250
#param.new_archetype(archetype, system_meta);
251251
)*
252252
}
253+
254+
fn apply(&mut self, world: &mut World) {
255+
self.0.apply(world)
256+
}
253257
}
254258

255259

crates/bevy_ecs/src/system/mod.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ mod tests {
103103
query::{Added, Changed, Or, With, Without},
104104
schedule::{Schedule, Stage, SystemStage},
105105
system::{
106-
IntoExclusiveSystem, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query,
106+
Commands, IntoExclusiveSystem, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query,
107107
RemovedComponents, Res, ResMut, System, SystemState,
108108
},
109109
world::{FromWorld, World},
@@ -906,4 +906,23 @@ mod tests {
906906
expected_ids
907907
);
908908
}
909+
910+
#[test]
911+
fn commands_param_set() {
912+
// Regression test for #4676
913+
let mut world = World::new();
914+
let entity = world.spawn().id();
915+
916+
run_system(
917+
&mut world,
918+
move |mut commands_set: ParamSet<(Commands, Commands)>| {
919+
commands_set.p0().entity(entity).insert(A);
920+
commands_set.p1().entity(entity).insert(B);
921+
},
922+
);
923+
924+
let entity = world.entity(entity);
925+
assert!(entity.contains::<A>());
926+
assert!(entity.contains::<B>());
927+
}
909928
}

0 commit comments

Comments
 (0)