Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the CoreStage::Startup to a seperate StartupSchedule label (#2434)
# Objective - `CoreStage::Startup` is unique in the `CoreStage` enum, in that it represents a `Schedule` and not a `SystemStage`. - This can lead to confusion about how `CoreStage::Startup` and the `StartupStage` enum are related. - Beginners sometimes try `.add_system_to_stage(CoreStage::Startup, setup.system())` instead of `.add_startup_system(setup.system())`, which causes a Panic: ``` thread 'main' panicked at 'Stage 'Startup' does not exist or is not a SystemStage', crates\bevy_ecs\src\schedule\mod.rs:153:13 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\/library\std\src\panicking.rs:493 1: std::panicking::begin_panic_fmt at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\/library\std\src\panicking.rs:435 2: bevy_ecs::schedule::{{impl}}::add_system_to_stage::stage_not_found at .\crates\bevy_ecs\src\schedule\mod.rs:153 3: bevy_ecs::schedule::{{impl}}::add_system_to_stage::{{closure}}<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Me at .\crates\bevy_ecs\src\schedule\mod.rs:161 4: core::option::Option<mut bevy_ecs::schedule::stage::SystemStage*>::unwrap_or_else<mut bevy_ecs::schedule::stage::SystemStage*,closure-0> at C:\Users\scher\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:427 5: bevy_ecs::schedule::Schedule::add_system_to_stage<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Mesh>>, bevy_ec at .\crates\bevy_ecs\src\schedule\mod.rs:159 6: bevy_app::app_builder::AppBuilder::add_system_to_stage<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Mesh>>, be at .\crates\bevy_app\src\app_builder.rs:196 7: 3d_scene::main at .\examples\3d\3d_scene.rs:4 8: core::ops::function::FnOnce::call_once<fn(),tuple<>> at C:\Users\scher\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227 ``` ## Solution - Replace the `CoreStage::Startup` Label with the new `StartupSchedule` unit type. Resolves #2229
- Loading branch information