1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use bevy_ecs::{event::Event, prelude::Entity};

/// An [`Event`] that is fired whenever there is a change in the world's hierarchy.
///
/// [`Event`]: bevy_ecs::event::Event
#[derive(Event, Debug, Clone, PartialEq, Eq)]
pub enum HierarchyEvent {
    /// Fired whenever an [`Entity`] is added as a child to a parent.
    ChildAdded {
        /// The child that was added
        child: Entity,
        /// The parent the child was added to
        parent: Entity,
    },
    /// Fired whenever a child [`Entity`] is removed from its parent.
    ChildRemoved {
        /// The child that was removed
        child: Entity,
        /// The parent the child was removed from
        parent: Entity,
    },
    /// Fired whenever a child [`Entity`] is moved to a new parent.
    ChildMoved {
        /// The child that was moved
        child: Entity,
        /// The parent the child was removed from
        previous_parent: Entity,
        /// The parent the child was added to
        new_parent: Entity,
    },
}