bevy/crates/bevy_hierarchy/src
Gabriel Bourgeois 6b75589e2c Fix inconsistent children removal behavior (#6017)
# Objective

Fixes #6010

## Solution

As discussed in #6010, this makes it so the `Children` component is removed from the entity whenever all of its children are removed. The behavior is now consistent between all of the commands that may remove children from a parent, and this is tested via two new test functions (one for world functions and one for commands).

Documentation was also added to `insert_children`, `push_children`, `add_child` and `remove_children` commands to make this behavior clearer for users.

## Changelog

- Fixed `Children` component not getting removed from entity when all its children are moved to a new parent.

## Migration Guide

- Queries with `Changed<Children>` will no longer match entities that had all of their children removed using `remove_children`.
- `RemovedComponents<Children>` will now contain entities that had all of their children remove using `remove_children`.
2022-10-06 21:39:34 +00:00
..
components Make Children constructor pub(crate). (#5532) 2022-08-05 03:49:12 +00:00
child_builder.rs Fix inconsistent children removal behavior (#6017) 2022-10-06 21:39:34 +00:00
events.rs Fix some grammatical errors in the docs (#6109) 2022-09-26 21:47:31 +00:00
hierarchy.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
lib.rs Add warning when a hierarchy component is missing (#5590) 2022-09-19 16:12:11 +00:00
valid_parent_check_plugin.rs Add warning when a hierarchy component is missing (#5590) 2022-09-19 16:12:11 +00:00