diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 60b3c8d48b..d9495f80c4 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -17,13 +17,19 @@ pub trait Command: Send + Sync + 'static { fn write(self, world: &mut World); } -/// A list of commands that modify a [`World`], running at the end of the stage where they -/// have been invoked. +/// A list of commands that runs at the end of the stage of the system that called them. +/// +/// Commands are executed one at a time in an exclusive fashion. +//// Each command can be used to modify the [`World`] in arbitrary ways: +/// * spawning or despawning entities +/// * inserting components on new or existing entities +/// * inserting resources +/// * etc. /// /// # Usage /// -/// `Commands` is a [`SystemParam`](crate::system::SystemParam), therefore it is declared -/// as a function parameter: +/// Add `mut commands: Commands` as a function argument to your system to get a copy of this struct that will be applied at the end of the current stage. +/// Commands are almost always used as a [`SystemParam`](crate::system::SystemParam). /// /// ``` /// # use bevy_ecs::prelude::*; @@ -33,7 +39,8 @@ pub trait Command: Send + Sync + 'static { /// } /// ``` /// -/// Then, commands can be invoked by calling the methods of `commands`. +/// Each command is implemented as a separate method. +/// Check the [`Command`] trait for a list of available commands (or implement your own!). pub struct Commands<'w, 's> { queue: &'s mut CommandQueue, entities: &'w Entities,