Skip to content

Hook and observer ordering for on_remove/on_replace should be inverted #16498

@nakedible

Description

@nakedible

Bevy version

0.15.0-rc.3 (exists before as well)

What you did

When adding a component, the order of hooks and observers are:

  • on_add hook
  • on_add observers
  • on_insert hook
  • on_insert observers

When removing a component, the order of hooks and observers are:

  • on_replace hook
  • on_replace observers
  • on_remove hook
  • on_remove observers

What went wrong

The remove ordering matches the add ordering, while it would be more natural for it to be inverted – running observers before hooks, that is.

Additional information

Note that this bug is to provoke discussion. The current behaviour may be considered correct as well. So this bug should be used to discuss the matter and make a decision so that the decision is then documented for posterity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorX-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions