
# Objective Based on and closes #18054, this PR builds on #18035 and #18147 to remove: - `Commands::insert_or_spawn_batch` - `Entities::alloc_at_without_replacement` - `Entities::alloc_at` - `entity::AllocAtWithoutReplacement` - `World::insert_or_spawn_batch` - `World::insert_or_spawn_batch_with_caller` ## Testing Just removing unused, deprecated code, so no new tests. Note that as of writing, #18035 is still under testing and review. ## Future Work Per [this](https://github.com/bevyengine/bevy/issues/18054#issuecomment-2689088899) comment on #18054, there may be additional performance improvements possible to the entity allocator now that `alloc_at` no longer is supported. At a glance, I don't see anything obvious to improve, but it may be worth further investigation in the future. --------- Co-authored-by: JaySpruce <jsprucebruce@gmail.com>
20 lines
887 B
Markdown
20 lines
887 B
Markdown
---
|
|
title: Removed Deprecated Batch Spawning Methods
|
|
pull_requests: [18148]
|
|
---
|
|
|
|
The following deprecated functions have been removed:
|
|
|
|
- `Commands::insert_or_spawn_batch`
|
|
- `World::insert_or_spawn_batch`
|
|
- `World::insert_or_spawn_batch_with_caller`
|
|
|
|
These functions, when used incorrectly, could cause major performance problems and were generally viewed as anti-patterns and foot guns.
|
|
They were deprecated in 0.16 for being unnecessary with the retained render world and easily misused.
|
|
|
|
Instead of these functions consider doing one of the following:
|
|
|
|
Option A) Instead of despawing entities, insert the `Disabled` component, and instead of respawning them at particular ids, use `try_insert_batch` or `insert_batch` and remove `Disabled`.
|
|
|
|
Option B) Instead of giving special meaning to an entity id, simply use `spawn_batch` and ensure entity references are valid when despawning.
|