Skip to content

adding a new system with only before and after dependencies can lead to hard to diagnose errors #7258

@hymm

Description

@hymm

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

With stageless merged, doing something like this can lead to hard to a hard to fix error for beginners.

// this will error because this will add the system to the `Update` set
// that wants to be after the `transform_propagate` system
// but the `transform_propagate` system is in `PostUpdate` set
// so it can't be both before `PostUpdate` and after `transform_propagate`
app.add_system(my_system.after(transform_propagate);

The way to fix this is to change it to

app.add_system(my_system.in_set(PostUpdate).after(transform_propagate));

But this requires knowledge that the transform_propagate system is in the PostUpdate set. The only way you could know this is to either see this in some schedule debugger tool like bevy_mod_debug_dump or looking up the transform_propagate system in the source code.

What solution would you like?

We can add a couple api's that would allow fixing this without knowledge of how a systems dependency is configured. These won't fix discovery of how to fix the problem, but will at least require less knowledge of how to configure it.

Allow the system to free float

app.add_system(my_system.no_default_set().after(transfrom_propagate));

Calling no_default_set would add the set to the schedule without a default set. This would allow the system to be only contrained by only the after constraint.

Allow system to be added as a "sibling" of a set

app.add_system(my_system.in_sets_with(transform_propagation).after(transform_propagation));

in_sets_with would inherit all the constraints that transform_propagation has. A discussion is probably worth having whether this is just the sets containing transform_propagation or also the run criteria and direct before and after constraints too.

I think we want both of these as they have significantly different behavior.

What alternative(s) have you considered?

Better schedule visualization tools and good error message will help here too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions