Spawning duplicate components is inconsistent
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
Bevy 0.9.0 / 7231e00507
## What I did
Since the addition of `Bundle`/`Component` agnostic spawns, the way bevy handles duplicate components is inconsistent.
Depending on how components are spawned, it either leads to a panic or just the first value of the component being overwritten.
Here, both `SpatialBundle` and `TransformBundle` have a `Transform` and `GlobalTransform`. When spawning them together with a `spawn()`, it panics, but if I spawn them separately, it doesn't panic:
```rust
// THIS PANICKS!!!
commands.spawn((
TransformBundle::default(),
SpatialBundle::default(),
))
// THIS just overwrites the GlobalTransform and Transform components
commands.spawn(TransformBundle::default())
.insert(SpatialBundle::default())
```
## What I expect
I expect neither version to panic.
Contributor guide
Research direction
Reproduce the issue with the two `commands.spawn` examples using `TransformBundle` and `SpatialBundle`; compare duplicate-component handling in tuple spawning with the separate `insert` path. Trace the Bundle/Component-agnostic spawn behavior, then verify that neither example panics and that duplicate components follow consistent behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100