bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Hook and observer ordering for `on_remove`/`on_replace` should be inverted

Open nakedible opened this issue 3 months ago • 2 comments

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.

nakedible avatar Nov 25 '24 00:11 nakedible