Opt-out component reflection #2968
Labels
A-ECS
Entities, components, systems, and events
A-Reflection
Runtime information about types
A-Scenes
Serialized ECS data stored on the disk
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
S-Needs-Design-Doc
This issue or PR is particularly complex, and needs an approved design doc before it can be merged
What problem does this solve or what need does it fill?
Currently, registering components for reflection is tedious and error-prone.
This makes use cases where you want to serialize many different component types (such as game saving, scenes or networking) very frustrating to use.
As you can see in the reflection example, users must manually register every type they wish to reflect.
What solution would you like?
Now that #2254 is in place, make Reflect an additional trait bound on Component. Automatically derive Reflect for components, unless there is an existing manual impl for them.
When components are first added to the app, automatically register them.
What alternative(s) have you considered?
Other strategies for automatically registering components may exist, and may allow us to create a more complete list before the app begins (rather than causing spiky work during the game).
Some components may not have any validly reflected values; perhaps these should simply not implement
Reflect
?The text was updated successfully, but these errors were encountered: