diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 6b8c3b548ac9fa..a1f2b1a4e57cd1 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -155,6 +155,23 @@ impl<'a> Commands<'a> { } /// Run a one-off [`System`]. + /// + /// ``` + /// # use bevy_ecs::prelude::*; + /// # struct MyComponent; + /// + /// # fn my_system(_components: Query<&MyComponent>) {} + /// + /// # fn main_system(mut commands: Commands) { + /// // Can take a standard system function + /// commands.run_system(my_system); + /// // Can take a closure system + /// commands.run_system(|query: Query<&MyComponent>| { + /// println!("count: {}", query.iter().len()); + /// }); + /// # } + /// # main_system.system(); + /// ``` pub fn run_system(&mut self, system: impl IntoSystem<(), (), Params>) { self.queue.push(RunSystem { system: Box::new(system.system()),