bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add feature to disallow a Type of Component to coexist on an entity

Open pemattern opened this issue 1 year ago • 0 comments

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.

pemattern avatar Dec 01 '24 09:12 pemattern