Error when having 16 components with the new tuple .spawn(())
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
bevy = {version = "0.9.1", features = ["dynamic", "wayland"]}
## \[Optional\] Relevant system information
OS: Manjaro Linux x86_64
Kernel: 5.15.85-1-MANJARO
## What you did
When creating 16 (different) components and using the new tuple way of spawning `.spawn(())`, building the project causes an error:
Components:
```
#[derive(Component)]
struct One;
#[derive(Component)]
struct Two;
#[derive(Component)]
struct Three;
#[derive(Component)]
struct Four;
#[derive(Component)]
struct Five;
#[derive(Component)]
struct Six;
#[derive(Component)]
struct Seven;
#[derive(Component)]
struct Eight;
#[derive(Component)]
struct Nine;
#[derive(Component)]
struct Ten;
#[derive(Component)]
struct Eleven;
#[derive(Component)]
struct Twelve;
#[derive(Component)]
struct Thirteen;
#[derive(Component)]
struct Fourteen;
#[derive(Component)]
struct Fifteen;
```
Spawning:
```
commands.spawn((
Name::new("Hi it's me"),
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Eleven,
Twelve,
Thirteen,
Fourteen,
Fifteen
));
```
Error:
`error[E0277]: the trait bound `(bevy::prelude::Name, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen): bevy::prelude::Component` is not satisfied`
The components themselves do not matter, just that there are more than 15 of them:
```
commands.spawn((
Name::new("Hi it's me"),
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Eleven,
Twelve,
// ...
Fifteen,
Sixteen,
Seventeen,
));
```
Results in the same error.
However, when using the old way of spawning, `.spawn().insert().insert()...`, it works fine and compiles.
It also compiles just fine when using one less component, i.e., just until `Fourteen`.
Old way:
```
commands
.spawn(Name::new("Hi it's me"))
.insert(One)
.insert(Two)
.insert(Three)
.insert(Four)
.insert(Five)
.insert(Six)
.insert(Seven)
.insert(Eight)
.insert(Nine)
.insert(Ten)
.insert(Eleven)
.insert(Twelve)
.insert(Thirteen)
.insert(Fourteen)
.insert(Fifteen)
.insert(Sixteen)
.insert(Seventeen);
```
Works fine:

## What went wrong
- what were you expecting?
All components to be inserted into the newly spawned object.
- what actually happened?
Only up to 16 components can be loaded using the new tuple way, after that it errors with:
```
error[E0277]: the trait bound `(bevy::prelude::Name, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen): bevy::prelude::Component` is not satisfied
--> src/main.rs:355:20
|
355 | commands.spawn((
| ______________-----_^
| | |
| | required by a bound introduced by this call
356 | | Name::new("Aye caramba"),
357 | | One,
358 | | Two,
... |
371 | | Fifteen
372 | | ));
| |_____^ the trait `bevy::prelude::Component` is not implemented for `(bevy::prelude::Name, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen)`
|
= help: the following other types implement trait `bevy::prelude::Component`:
AdditionalMassProperties
AlphaMode
Analyzer
AnimationPlayer
AsyncCollider
AsyncSceneCollider
BackgroundColor
Barracks
and 191 others
= note: required for `(bevy::prelude::Name, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen)` to implement `Bundle`
```
## Additional information
The note in the message suggests aligning them into a `Bundle`, but if it is indeed the solution, then the limit of 16 with the new spawn system should be documented somewhere. However, the fact that there are no errors with the old way of spawning is a bit suspicious.
Shall any more info be required, please let me know.
Thanks for your help!
Contributor guide
Assessment
This issue has not been assessed yet.