bevy
bevy copied to clipboard
Reflect everything by default & make it opt out
What problem does this solve or what need does it fill?
It's hard to remember everything you need to reflect on & it's quite verbose to do so.
What solution would you like?
Make derives for Component
, Resource
, State
, Asset
, Event
also derive Reflect
with a #[no_reflect]
attribute to opt out.
What alternative(s) have you considered?
Manually adding reflect to everything.
We could also add a real trait bound to all of these types. This would be more intrusive and limiting and worsen compile times, but would arguably be more idiomatic.
I think that implicitly doubling up on the derives is a better solution though.
Note that this would make those derives incompatible with each other, as they would generate multiple Reflect
impl
s. I've seen some people derive both Component
and Resource
for a given type, so this might not be ideal.
As an alternative: is it strictly necessary for them to derive Reflect
? Or could they just register something like ReflectComponent
in the TypeRegistry
, internally using some kind of remote reflect to sidestep not knowing whether Reflect
is implemented or not?
That sounds better