File tree 1 file changed +29
-3
lines changed
crates/bevy_ecs/src/system
1 file changed +29
-3
lines changed Original file line number Diff line number Diff line change 41
41
//!
42
42
//! - **System Stages:** They determine hard execution synchronization boundaries inside of
43
43
//! which systems run in parallel by default.
44
- //! - **Labeling:** First, systems are labeled upon creation by calling `.label()`. Then,
45
- //! methods such as `.before()` and `.after()` are appended to systems to determine
46
- //! execution order in respect to other systems.
44
+ //! - **Labels:** Systems may be ordered within a stage using the methods `.before()` and `.after()`,
45
+ //! which order systems based on their [`SystemLabel`]s. Each system is implicitly labeled with
46
+ //! its `fn` type, and custom labels may be added by calling `.label()`.
47
+ //!
48
+ //! [`SystemLabel`]: crate::schedule::SystemLabel
49
+ //!
50
+ //! ## Example
51
+ //!
52
+ //! ```
53
+ //! # use bevy_ecs::prelude::*;
54
+ //! # let mut app = SystemStage::single_threaded();
55
+ //! // Prints "Hello, World!" each frame.
56
+ //! app
57
+ //! .add_system(print_first.before(print_mid))
58
+ //! .add_system(print_mid)
59
+ //! .add_system(print_last.after(print_mid));
60
+ //! # let mut world = World::new();
61
+ //! # app.run(&mut world);
62
+ //!
63
+ //! fn print_first() {
64
+ //! print!("Hello");
65
+ //! }
66
+ //! fn print_mid() {
67
+ //! print!(", ");
68
+ //! }
69
+ //! fn print_last() {
70
+ //! println!("World!");
71
+ //! }
72
+ //! ```
47
73
//!
48
74
//! # System parameter list
49
75
//! Following is the complete list of accepted types as system parameters:
You can’t perform that action at this time.
0 commit comments