diff --git a/crates/bevy_ecs/src/component/mod.rs b/crates/bevy_ecs/src/component/mod.rs index 7b101c4bcb..f2038a151f 100644 --- a/crates/bevy_ecs/src/component/mod.rs +++ b/crates/bevy_ecs/src/component/mod.rs @@ -11,6 +11,19 @@ use std::{ }; use thiserror::Error; +/// A component is data associated with an `Entity`. Each entity can have multiple different types +/// of components, but only one of them per type. +/// +/// Any type that is `Send + Sync + 'static` automatically implements `Component`. +/// +/// Components are added with new entities using [Commands::spawn](crate::system::Commands::spawn), +/// or to existing entities with [Commands::insert](crate::system::Commands::insert), +/// or their [World](crate::world::World) equivalents. +/// +/// Components can be accessed in systems by using a [Query](crate::system::Query) +/// as one of the arguments. +/// +/// Components can be grouped together into a [Bundle](crate::bundle::Bundle). pub trait Component: Send + Sync + 'static {} impl Component for T {} diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index 1c03c9b784..ca36b1d9aa 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -13,7 +13,11 @@ use std::{ /// Lightweight unique ID of an entity /// -/// Obtained from `World::spawn`. Can be stored to refer to an entity in the future. +/// Obtained from [World::spawn](crate::world::World::spawn), typically via [Commands::spawn](crate::system::Commands::spawn). Can be stored to refer to an entity in the future. +/// +/// `Entity` can be a part of a query, e.g. `Query<(Entity, &MyComponent)>`. +/// Components of a specific entity can be accessed using +/// [Query::get](crate::system::Query::get) and related methods. #[derive(Clone, Copy, Hash, Eq, Ord, PartialEq, PartialOrd)] pub struct Entity { pub(crate) generation: u32, diff --git a/crates/bevy_ecs/src/system/system.rs b/crates/bevy_ecs/src/system/system.rs index 8d38ddfd5f..8e2d3de2a7 100644 --- a/crates/bevy_ecs/src/system/system.rs +++ b/crates/bevy_ecs/src/system/system.rs @@ -17,6 +17,15 @@ impl SystemId { } /// An ECS system that can be added to a [Schedule](crate::schedule::Schedule) +/// +/// Systems are functions with all arguments implementing [SystemParam]. +/// +/// Systems are added to an application using `AppBuilder::add_system(my_system.system())` +/// or similar methods, and will generally run once per pass of the main loop. +/// +/// Systems are executed in parallel, in opportunistic order; data access is managed automatically. +/// It's possible to specify explicit execution order between specific systems, +/// see [SystemDescriptor](crate::schedule::SystemDescriptor). pub trait System: Send + Sync + 'static { type In; type Out;