diff --git a/crates/bevy_ecs/src/world/command_queue.rs b/crates/bevy_ecs/src/world/command_queue.rs index e8f820c066..ef98e47008 100644 --- a/crates/bevy_ecs/src/world/command_queue.rs +++ b/crates/bevy_ecs/src/world/command_queue.rs @@ -83,9 +83,6 @@ impl CommandQueue { /// This clears the queue. #[inline] pub fn apply(&mut self, world: &mut World) { - // flush the previously queued entities - world.flush_entities(); - // flush the world's internal queue world.flush_commands(); diff --git a/crates/bevy_ecs/src/world/deferred_world.rs b/crates/bevy_ecs/src/world/deferred_world.rs index 02c12fe6a3..b7aa959c62 100644 --- a/crates/bevy_ecs/src/world/deferred_world.rs +++ b/crates/bevy_ecs/src/world/deferred_world.rs @@ -23,7 +23,7 @@ use super::{unsafe_world_cell::UnsafeWorldCell, Mut, World, ON_INSERT, ON_REPLAC /// /// This means that in order to add entities, for example, you will need to use commands instead of the world directly. pub struct DeferredWorld<'w> { - // SAFETY: Implementors must not use this reference to make structural changes + // SAFETY: Implementers must not use this reference to make structural changes world: UnsafeWorldCell<'w>, } @@ -69,7 +69,7 @@ impl<'w> DeferredWorld<'w> { // SAFETY: &mut self ensure that there are no outstanding accesses to the queue let command_queue = unsafe { self.world.get_raw_command_queue() }; // SAFETY: command_queue is stored on world and always valid while the world exists - unsafe { Commands::new_raw_from_entities(command_queue, self.world.entities()) } + unsafe { Commands::new_raw_from_entities(command_queue, self.world.entities_allocator()) } } /// Retrieves a mutable reference to the given `entity`'s [`Component`] of the given type. @@ -415,7 +415,8 @@ impl<'w> DeferredWorld<'w> { // - Command queue access does not conflict with entity access. let raw_queue = unsafe { cell.get_raw_command_queue() }; // SAFETY: `&mut self` ensures the commands does not outlive the world. - let commands = unsafe { Commands::new_raw_from_entities(raw_queue, cell.entities()) }; + let commands = + unsafe { Commands::new_raw_from_entities(raw_queue, cell.entities_allocator()) }; (fetcher, commands) } diff --git a/crates/bevy_ecs/src/world/spawn_batch.rs b/crates/bevy_ecs/src/world/spawn_batch.rs index 16bd9bb805..b24eb483a0 100644 --- a/crates/bevy_ecs/src/world/spawn_batch.rs +++ b/crates/bevy_ecs/src/world/spawn_batch.rs @@ -36,7 +36,6 @@ where let (lower, upper) = iter.size_hint(); let length = upper.unwrap_or(lower); - world.entities.reserve(length as u32); let mut spawner = BundleSpawner::new::(world, change_tick); spawner.reserve_storage(length);