Skip to content

Commit 6a03936

Browse files
TheRawMeatballexjam
authored andcommitted
Add Commands::new_from_entities (bevyengine#4423)
This change allows for creating `Commands` objects from just an entities reference, which allows for creating multiple dynamically in a normal system. Context: https://discord.com/channels/691052431525675048/774027865020039209/960857605943726142
1 parent 42ed98a commit 6a03936

File tree

1 file changed

+5
-0
lines changed
  • crates/bevy_ecs/src/system/commands

1 file changed

+5
-0
lines changed

crates/bevy_ecs/src/system/commands/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ impl<'w, 's> Commands<'w, 's> {
5555
}
5656
}
5757

58+
/// Create a new `Commands` from a queue and an [`Entities`] reference.
59+
pub fn new_from_entities(queue: &'s mut CommandQueue, entities: &'w Entities) -> Self {
60+
Self { queue, entities }
61+
}
62+
5863
/// Creates a new empty [`Entity`] and returns an [`EntityCommands`] builder for it.
5964
///
6065
/// To directly spawn an entity with a [`Bundle`] included, you can use

0 commit comments

Comments
 (0)