bevy-ecs-composition
Installation
SKILL.md
Bevy ECS composition
When to use
Load this when gameplay data should be split across small components and systems, instead of one type that owns everything. The Quick Start ECS page is the source for the names below.
ECS shape
- Components are Rust structs that derive
Component. The ECS page splitsPersonandNameso more than one kind of entity can carry a name. - Entities are spawned with
Commandsin aStartupsystem. The page spawns a tuple of components:commands.spawn((Person, Name(...))). - Systems are functions.
Query<&Name, With<Person>>reads names on entities that also havePerson.Query<&mut Name, With<Person>>writes. Register withadd_systems. - Schedule:
Startupruns once.Updateruns afterward. Systems run in parallel unless you call.chain(). The page chainsupdate_peoplebeforegreet_peopleand leaves an unrelated system outside the chain.
Use the tuple spawn the ECS page shows. Check the ECS docs for a Bundle trait before writing a bundle macro.