Allow required components to specify relationships
- 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?
As mentioned in #19045 and #16840 it would be nice to have a way to specify relationships in required components
## What solution would you like?
Perhaps something like this?
```rust
#[derive(Component)]
#[require(
Related::((
Text::new("Some interesting..."),
(
Text::new("writing here."),
TextColor(css::PURPLE)
)
))
// Not sure if this should override or add to the parent if it already exists, leaning to add, but depends on feasibility and what other people want
Related::(
Node
)
Related::((
// This gets more tricky because observers are m-m, not sure how to do this without duplicating a lot of observers that do the exact same thing.
))
)]
pub struct TextContainer;
```
## What alternative(s) have you considered?
Use the old method, but that doesn't hold up relationship invariants.
Contributor guide
Assessment
This issue has not been assessed yet.