mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
Make StartupSet
a base set (#7574)
# Objective Closes #7573 - Make `StartupSet` a base set ## Solution - Add `#[system_set(base)]` to the enum declaration - Replace `.in_set(StartupSet::...)` with `.in_base_set(StartupSet::...)` **Note**: I don't really know what I'm doing and what exactly the difference between base and non-base sets are. I mostly opened this PR based on discussion in Discord. I also don't really know how to test that I didn't break everything. Your reviews are appreciated! --- ## Changelog - `StartupSet` is now a base set ## Migration Guide `StartupSet` is now a base set. This means that you have to use `.in_base_set` instead of `.in_set`: ### Before ```rs app.add_system(foo.in_set(StartupSet::PreStartup)) ``` ### After ```rs app.add_system(foo.in_base_set(StartupSet::PreStartup)) ```
This commit is contained in:
parent
104c74c3bc
commit
9b7060c4d2
9 changed files with 16 additions and 16 deletions
|
@ -166,6 +166,7 @@ impl CoreSet {
|
|||
/// that runs immediately after the matching system set.
|
||||
/// These can be useful for ordering, but you almost never want to add your systems to these sets.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
#[system_set(base)]
|
||||
pub enum StartupSet {
|
||||
/// Runs once before [`StartupSet::Startup`].
|
||||
PreStartup,
|
||||
|
@ -189,11 +190,12 @@ impl StartupSet {
|
|||
pub fn base_schedule() -> Schedule {
|
||||
use StartupSet::*;
|
||||
let mut schedule = Schedule::new();
|
||||
schedule.set_default_base_set(Startup);
|
||||
|
||||
// Create "stage-like" structure using buffer flushes + ordering
|
||||
schedule.add_system(apply_system_buffers.in_set(PreStartupFlush));
|
||||
schedule.add_system(apply_system_buffers.in_set(StartupFlush));
|
||||
schedule.add_system(apply_system_buffers.in_set(PostStartupFlush));
|
||||
schedule.add_system(apply_system_buffers.in_base_set(PreStartupFlush));
|
||||
schedule.add_system(apply_system_buffers.in_base_set(StartupFlush));
|
||||
schedule.add_system(apply_system_buffers.in_base_set(PostStartupFlush));
|
||||
|
||||
schedule.configure_set(PreStartup.before(PreStartupFlush));
|
||||
schedule.configure_set(Startup.after(PreStartupFlush).before(StartupFlush));
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<T: Asset> Default for AssetCountDiagnosticsPlugin<T> {
|
|||
|
||||
impl<T: Asset> Plugin for AssetCountDiagnosticsPlugin<T> {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_startup_system(Self::setup_system.in_set(StartupSet::Startup))
|
||||
app.add_startup_system(Self::setup_system)
|
||||
.add_system(Self::diagnostic_system);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ pub struct EntityCountDiagnosticsPlugin;
|
|||
|
||||
impl Plugin for EntityCountDiagnosticsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_startup_system(Self::setup_system.in_set(StartupSet::Startup))
|
||||
app.add_startup_system(Self::setup_system)
|
||||
.add_system(Self::diagnostic_system);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub struct FrameTimeDiagnosticsPlugin;
|
|||
|
||||
impl Plugin for FrameTimeDiagnosticsPlugin {
|
||||
fn build(&self, app: &mut bevy_app::App) {
|
||||
app.add_startup_system(Self::setup_system.in_set(StartupSet::Startup))
|
||||
app.add_startup_system(Self::setup_system)
|
||||
.add_system(Self::diagnostic_system);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ mod log_diagnostics_plugin;
|
|||
mod system_information_diagnostics_plugin;
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::schedule::IntoSystemConfig;
|
||||
pub use diagnostic::*;
|
||||
pub use entity_count_diagnostics_plugin::EntityCountDiagnosticsPlugin;
|
||||
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
|
||||
|
@ -18,10 +17,8 @@ pub struct DiagnosticsPlugin;
|
|||
|
||||
impl Plugin for DiagnosticsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<Diagnostics>().add_startup_system(
|
||||
system_information_diagnostics_plugin::internal::log_system_info
|
||||
.in_set(StartupSet::Startup),
|
||||
);
|
||||
app.init_resource::<Diagnostics>()
|
||||
.add_startup_system(system_information_diagnostics_plugin::internal::log_system_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::DiagnosticId;
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::prelude::*;
|
||||
|
||||
/// Adds a System Information Diagnostic, specifically `cpu_usage` (in %) and `mem_usage` (in %)
|
||||
///
|
||||
|
@ -15,7 +14,7 @@ use bevy_ecs::prelude::*;
|
|||
pub struct SystemInformationDiagnosticsPlugin;
|
||||
impl Plugin for SystemInformationDiagnosticsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_startup_system(internal::setup_system.in_set(StartupSet::Startup))
|
||||
app.add_startup_system(internal::setup_system)
|
||||
.add_system(internal::diagnostic_system);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ impl Plugin for GilrsPlugin {
|
|||
{
|
||||
Ok(gilrs) => {
|
||||
app.insert_non_send_resource(gilrs)
|
||||
.add_startup_system(gilrs_event_startup_system.in_set(StartupSet::PreStartup))
|
||||
.add_startup_system(
|
||||
gilrs_event_startup_system.in_base_set(StartupSet::PreStartup),
|
||||
)
|
||||
.add_system(
|
||||
gilrs_event_system
|
||||
.before(InputSystem)
|
||||
|
|
|
@ -28,7 +28,7 @@ impl<T: CameraProjection + Component + GetTypeRegistration> Plugin for CameraPro
|
|||
fn build(&self, app: &mut App) {
|
||||
app.register_type::<T>()
|
||||
.edit_schedule(CoreSchedule::Startup, |schedule| {
|
||||
schedule.configure_set(CameraUpdateSystem.in_set(StartupSet::PostStartup));
|
||||
schedule.configure_set(CameraUpdateSystem.in_base_set(StartupSet::PostStartup));
|
||||
})
|
||||
.configure_set(CameraUpdateSystem.in_base_set(CoreSet::PostUpdate))
|
||||
.add_startup_system(
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Plugin for TransformPlugin {
|
|||
.configure_set(TransformSystem::TransformPropagate.in_base_set(CoreSet::PostUpdate))
|
||||
.edit_schedule(CoreSchedule::Startup, |schedule| {
|
||||
schedule.configure_set(
|
||||
TransformSystem::TransformPropagate.in_set(StartupSet::PostStartup),
|
||||
TransformSystem::TransformPropagate.in_base_set(StartupSet::PostStartup),
|
||||
);
|
||||
})
|
||||
// FIXME: https://github.com/bevyengine/bevy/issues/4381
|
||||
|
|
Loading…
Add table
Reference in a new issue