Usability: `children!` macro is easy to subtly hold wrong
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
First of all, I'm a fan of what the macro is trying to the achieve, when used correctly it yields a much more ergonomic way to build a hierarchy. That said, there is an easy mistake to make which can be hard to diagnose, especially for beginners.
I've found myself accidentally writing e.g.:
```rust
commands.insert(
SomeComponent,
children![Enemy, Mesh3d(enemy_mesh)]
)
```
Besides game logic failing, the first thing to notice are the warnings about missing `InheritedVisiblity` in entities whose parent do have such a component. Obviously I had meant to write:
```rust
commands.insert(
SomeComponent,
children![(Enemy, Mesh3d(enemy_mesh))]
)
```
I would consider myself a decently experienced Bevy user and I got bitten by this a couple times already, I can imagine that beginners would have a much harder time figuring out what went wrong. I don't really have a constructive solution here, but I'm hoping we could somehow guard users more effectively against this footgun.
Contributor guide
Assessment
This issue has not been assessed yet.