bevyengine / bevyengine/bevy

Warn on unused system sets to mitigate ordering bugs

Open
#19,979 0 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Usability D-Modest
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.