bevyengine / bevyengine/bevy

spawn_batch doesnt return the spawned entities

Open
#21,136 2 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature C-Usability D-Straightforward
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

When I call commands.spawn(...) I get the entity back. I would expect to get a list of entities when I spawn_batch.
Not providing this forces me to bend over backwards if I need the entities. Any solution I have found is terrible for performance and has high complexity. Even if I write a custom impl for Command, it still requires a world lock which should be unnecessary.

## What solution would you like?

commands.spawn_batch() -> Vec

## What alternative(s) have you considered?
Inserting a tag and then have another system pull the tagged entities (bad for performance and sloppy)
Writing custom Command (hard, overkill, adds complication needlessly)
Writing exclusive system (world lock slows everything else down)

Also all of the above force the spawning to be delayed, causing race conditions and other nonsense.
The docs claim all spawn_batch does is pre-allocate and use iterators. If that is true, returning the entities should be very possible and easy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.