Add feature to disallow a Type of Component to coexist on an entity
- 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?
Some Components generally aren't compatible with each other, or are nonsensical when coexisting on an entity.
For example:
- `TemporalAntiAliasing` and `MSAA`
- `Sprite` and `MeshMaterial3d`
This feature adds a generalized API to avoid conflicting Components from coexisting on an entity. Idea comes from #16364.
The benefit of such a feature would be easier bug-fixing.
## What solution would you like?
A macro like `#[disallow(ComponentA, ComponentB)]`. This would compliment the `#[require(...)]` macro.
Violating the rule would cause a runtime panic with a message about the conflicting types.
## What alternative(s) have you considered?
- Not implementing this and handling each case specifically.
- Move conflicting types into enum variants.
## Additional context
I have no idea if this has been proposed before, and if there are glaring reasons why this is a bad idea.
Contributor guide
Assessment
This issue has not been assessed yet.