#Any way to avoid adding systems to a given schedule every time?

7 messages · Page 1 of 1 (latest)

daring tinsel
#

I'd like to add a lot of systems to CoreSchedule::FixedUpdate, but I couldn't find any alternative way to in_schedule:

.add_system(
    test.in_set(PhysicsSet)
        .in_schedule(CoreSchedule::FixedUpdate),
)

In previous versions of bevy it could be done with a system set + run criteria, but now it doesn't seem to work anymore. Would it be possible to add them even if they're in different plugins?

gentle abyss
#

The call to in_schedule is unavoidable if you want a system to be added to another schedule

daring tinsel
#

You're right, I just thought there could be a way to add systems to schedules the same way run conditions can be added through system sets. Probably the easiest way is through something like:

.add_systems((test, one_system, one_more_system).in_schedule(CoreSchedule::FixedUpdate))
#

However unfortunately, that doesn't work for systems added by different plugins.

#

I wonder if there would be any alternative way to use a system set + run condition instead of CoreSchedule::FixedUpdate.

gentle abyss
#

A running at a fixed interval might require running systems multiple times per frame, which in turn requires using a schedule.

add_systems in 0.11 will always require a schedule to be specified (no more default schedule).
The code above would become this:

.add_systems(FixedUpdate, (test, one_system, one_more_system))
daring tinsel
#

interesting, in this case I think that's unavoidable anyway. I've tested this and it didn't work:

.edit_schedule(CoreSchedule::FixedUpdate, |s| {
    s.configure_set(PhysicsSet.run_if(pause::should_run));
})
.add_system(test.in_set(PhysicsSet))

while this works fine:

.edit_schedule(CoreSchedule::FixedUpdate, |s| {
    s.configure_set(PhysicsSet.run_if(pause::should_run)).add_system(test.in_set(PhysicsSet));
})