From e8dd5bc73eae67fbba0a9cd14388a4a881b3b8f8 Mon Sep 17 00:00:00 2001 From: Kevin King <4kevinking@gmail.com> Date: Thu, 9 Dec 2021 21:47:29 -0800 Subject: [PATCH] improve error message for attempting to add startup systems using add_system_to_stage Fixes #3250 Notes: We perform this extra check in bevy_app so that the `StartupStage` type id is available to us. --- crates/bevy_app/src/app.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 04024d794a4d3..6fc2efb3e71cc 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -353,6 +353,10 @@ impl App { stage_label: impl StageLabel, system: impl IntoSystemDescriptor, ) -> &mut Self { + use std::any::TypeId; + if stage_label.type_id() == TypeId::of::() { + panic!("add systems to a startup stage using App::add_startup_system_to_stage"); + } self.schedule.add_system_to_stage(stage_label, system); self } @@ -383,6 +387,10 @@ impl App { stage_label: impl StageLabel, system_set: SystemSet, ) -> &mut Self { + use std::any::TypeId; + if stage_label.type_id() == TypeId::of::() { + panic!("add system sets to a startup stage using App::add_startup_system_set_to_stage"); + } self.schedule .add_system_set_to_stage(stage_label, system_set); self