use beet_ecs::prelude::*; use bevy::prelude::*; #[derive(Component, Action)] #[observers(log_name_on_run, log_on_run::)] struct LogOnRun(pub T); fn log_on_run( trigger: Trigger, query: Query<&LogOnRun>, ) { let name = query .get(trigger.entity()) .map(|n| n.0.to_string()) .unwrap(); println!("log_on_run: {name}"); } fn log_name_on_run(trigger: Trigger, query: Query<&Name>) { let name = query .get(trigger.entity()) .map(|n| n.as_str()) .unwrap_or(""); println!("log_name_on_run: {name}"); } fn main() { let mut world = World::new(); world .spawn((Name::new("root1"), LogOnRun("root2".to_string()))) .flush_trigger(OnRun); }