27 releases

new 0.15.0-rc.3 Nov 5, 2024
0.14.2 Sep 6, 2024
0.14.0 Jul 4, 2024
0.13.1 Mar 18, 2024
0.0.1 Mar 14, 2022

#2321 in Game dev

Download history 19286/week @ 2024-07-23 21700/week @ 2024-07-30 19420/week @ 2024-08-06 24368/week @ 2024-08-13 19785/week @ 2024-08-20 22425/week @ 2024-08-27 23394/week @ 2024-09-03 16956/week @ 2024-09-10 18308/week @ 2024-09-17 19784/week @ 2024-09-24 16326/week @ 2024-10-01 11472/week @ 2024-10-08 15085/week @ 2024-10-15 15670/week @ 2024-10-22 15759/week @ 2024-10-29 14062/week @ 2024-11-05

62,749 downloads per month
Used in 1,166 crates (60 directly)

MIT/Apache

3.5MB
64K SLoC

Bevy Hierarchy

License Crates.io Downloads Docs Discord


lib.rs:

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

~6–15MB
~189K SLoC