System Sets

System Sets allow you to easily apply common properties to multiple systems, for purposes such as labeling, ordering, run criteria, and states.

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)

        // group our input handling systems into a set
        .add_system_set(
            SystemSet::new()
                .label("input")
                .with_system(keyboard_input.system())
                .with_system(gamepad_input.system())
        )

        // our "net" systems should run before "input"
        .add_system_set(
            SystemSet::new()
                .label("net")
                .before("input")
                // individual systems can still have
                // their own labels (and ordering)
                .with_system(server_session.system().label("session"))
                .with_system(server_updates.system().after("session"))
        )

        // some ungrouped systems
        .add_system(player_movement.system().after("input"))
        .add_system(session_ui.system().after("session"))
        .add_system(smoke_particles.system())

        .run();
}