Skip to content

Opt-out component reflection #2968

@alice-i-cecile

Description

@alice-i-cecile

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsA-ReflectionRuntime information about typesA-ScenesSerialized ECS data stored on the diskC-UsabilityA targeted quality-of-life change that makes Bevy easier to useS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be merged

    Type

    No type

    Projects

    Status

    Open

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions