Skip to content

Add Observer::add_component #21848

@Shatur

Description

@Shatur

What problem does this solve or what need does it fill?

We have Observer::with_entities and Observer::with_entity, but for components it's only Observer::with_component. But for dynamic case I don't think with_ is convenient. In bevy_replicon I store ComponentId after user registrations and I need to create an observer for then during Plugin::finish.

What solution would you like?

Extend the API by adding Observer::add_component. It's not a builder and just pushes a component into the list of components.

What alternative(s) have you considered?

Add Observer::with_components that accepts an iterator, similar to Observer::with_entities. But for my use case add_component would be more convenient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useS-Needs-ReviewNeeds reviewer attention (from anyone!) to move forward

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions