17 unstable releases (7 breaking)

new 0.13.2 Apr 4, 2024
0.13.1 Mar 18, 2024
0.13.0 Feb 17, 2024
0.12.1 Nov 30, 2023
0.0.1 Mar 14, 2022

#1949 in Game dev

Download history 8491/week @ 2023-12-21 8977/week @ 2023-12-28 8108/week @ 2024-01-04 10329/week @ 2024-01-11 10536/week @ 2024-01-18 8513/week @ 2024-01-25 7295/week @ 2024-02-01 8763/week @ 2024-02-08 14554/week @ 2024-02-15 12491/week @ 2024-02-22 13101/week @ 2024-02-29 12948/week @ 2024-03-07 11964/week @ 2024-03-14 14056/week @ 2024-03-21 13184/week @ 2024-03-28 13272/week @ 2024-04-04

54,277 downloads per month
Used in 867 crates (32 directly)

MIT/Apache

2.5MB
44K SLoC

Parent-child relationships for Bevy entities.

You should use the tools in this crate whenever you want to organize your entities in a hierarchical fashion, to make groups of entities more manageable, or to propagate properties throughout the entity hierarchy.

This crate introduces various tools, including a plugin for managing parent-child relationships between entities. It provides two components, Parent and Children, to store references to related entities. It also provides command and world API extensions to set and clear those relationships.

More advanced users may also appreciate query extension methods to traverse hierarchies, and events to notify hierarchical changes. There is also a diagnostic plugin to validate property propagation.

Hierarchy management

The methods defined in this crate fully manage the components responsible for defining the entity hierarchy. Mutating these components manually may result in hierarchy invalidation.

Hierarchical relationships are always managed symmetrically. For example, assigning a child to an entity will always set the parent in the other, and vice versa. Similarly, unassigning a child in the parent will always unassign the parent in the child.

Despawning entities

The commands and methods provided by bevy_ecs to despawn entities are not capable of automatically despawning hierarchies of entities. In most cases, these operations will invalidate the hierarchy. Instead, you should use the provided hierarchical despawn extension methods.

Dependencies

~5.5–9.5MB
~177K SLoC