Skip to content

Warn on unused system sets to mitigate ordering bugs #19979

@cBournhonesque

Description

@cBournhonesque

What problem does this solve or what need does it fill?

I've been bitten by this 'bug' many times, and it's always been very hard to debug:

// for some reason (refactoring, mistake, etc.), I put system1 in schedule First instead of schedule PreUpdate
app.add_systems(First, system2.in_set(B));
app.add_systems(PreUpdate, system1.in_set(A));

// I add a dependency between sets and I expect A -> B
app.configure_sets(PreUpdate, (A, B).chain());

I now expect to have system1 run before system2 because of the A->B set constraint.
However, I made a mistake and put my system2 in the First schedule, which runs before PreUpdate, therefore my system2 runs before system1.

This is usually pretty hard to detect, because you don't get any error messages since the code is technically valid.
The only hint that something is wrong is that set B is empty inside schedule PreUpdate, which might mean that something has been misconfigured.

What solution would you like?

Emit a warning if a set was created in a schedule and contains no systems.

I guess a longer-term solution would be to only have 1 schedule?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions