Hey there,
I'm working with Bevy's SystemSets and Schedules and need clarification on the "new" Schedule implementation (0.10+). Specifically, I'm unsure where schedules added via .add_schedule() are placed by default. How can I insert them at a specific position in the execution order?
Additionally, I'm seeking best practices for using Schedules in Bevy. Here's the relevant code for context:
pub struct TrackPlugin;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
enum TrackSet {
Extract,
Queue,
}
#[derive(ScheduleLabel, Debug, Hash, PartialEq, Eq, Clone)]
pub struct TrackSchedule;
impl TrackSchedule {
pub fn base_schedule() -> Schedule {
use TrackSet::*;
let mut schedule = Schedule::new(Self);
schedule.configure_sets((Extract, Queue).chain());
return schedule;
}
}
// TODO: Could it run in a separate sub app parallel to the core and rendering?
impl Plugin for TrackPlugin {
fn build(&self, app: &mut App) {
// Register resources
app.init_resource::<TrackedEntities>();
app.init_resource::<ChangedComponents>();
// Register schedules
app.add_schedule(TrackSchedule::base_schedule());
// Register systems
app.add_systems(
TrackSchedule,
(
track_changes::<DimensionMixin>.in_set(TrackSet::Extract),
track_changes::<RelativeTransformMixin>.in_set(TrackSet::Extract),
queue_tracked_changes
.in_set(TrackSet::Queue)
.after(TrackSet::Extract),
),
);
}
}
Thanks ๐