bevy
bevy copied to clipboard
Add feature to disallow a Type of Component to coexist on an entity
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:
TemporalAntiAliasingandMSAASpriteandMeshMaterial3d
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.