Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bevy_ecs: flush entities after running observers and hooks in despawn (…
…#15398) # Objective Fixes #14467 Observers and component lifecycle hooks are allowed to perform operations that subsequently require `Entities` to be flushed, such as reserving a new entity. If this occurs during an `on_remove` hook or an `OnRemove` event trigger during an `EntityWorldMut::despawn`, a panic will occur. ## Solution Call `world.flush_entities()` after running `on_remove` hooks/observers during `despawn` ## Testing Added a new test that fails before the fix and succeeds afterward.
- Loading branch information