docs/bevy/examples/ecs/startup_system.rs 484 B · 20 lines · raw · history
| 1 | //! Demonstrates a startup system (one that runs once when the app starts up). |
| 2 | |
| 3 | use bevy::prelude::*; |
| 4 | |
| 5 | fn main() { |
| 6 | App::new() |
| 7 | .add_systems(Startup, startup_system) |
| 8 | .add_systems(Update, normal_system) |
| 9 | .run(); |
| 10 | } |
| 11 | |
| 12 | /// Startup systems are run exactly once when the app starts up. |
| 13 | /// They run right before "normal" systems run. |
| 14 | fn startup_system() { |
| 15 | println!("startup system ran first"); |
| 16 | } |
| 17 | |
| 18 | fn normal_system() { |
| 19 | println!("normal system ran second"); |
| 20 | } |