mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
Add Commands::new_from_entities (#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
This commit is contained in:
parent
947d3f9627
commit
516e4aaa10
1 changed files with 5 additions and 0 deletions
|
@ -55,6 +55,11 @@ impl<'w, 's> Commands<'w, 's> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new `Commands` from a queue and an [`Entities`] reference.
|
||||
pub fn new_from_entities(queue: &'s mut CommandQueue, entities: &'w Entities) -> Self {
|
||||
Self { queue, entities }
|
||||
}
|
||||
|
||||
/// Creates a new empty [`Entity`] and returns an [`EntityCommands`] builder for it.
|
||||
///
|
||||
/// To directly spawn an entity with a [`Bundle`] included, you can use
|
||||
|
|
Loading…
Reference in a new issue