Skip to content

Conversation

hymm
Copy link
Contributor

@hymm hymm commented Jul 26, 2025

Objective

Solution

  • add remove_systems_in_set method which removes all the systems by their set name. In most cases systems are added to a schedule once, so just passing the system (which is an implicit set by it's type name) will just remove the one system. If a system is added multiple times such as apply_deferred, then you may need to give the system a unique set, if you just want to remove just one system.
  • The method also tries to remove all the configuration for the set and the systems found.
  • We need to pass world to the method because user build passes are allowed to write to the world.

Testing

  • Added some unit tests.

Future work

  • In the future of systems as entities this will probably look much different. We'd probably store all the edges as relationships, so hopefully cleanup would be easier.
  • It'd be better if remove_systems_in_set could take a tuple of system sets. I looked into using IntoScheduleConfigs, but that won't work since the system set version of it errors if you try to pass a system type set. This would allow for less rebuilding of the schedule. The schedule needs to be rebuilt to each call to be able to find the system set.

Copy link
Contributor

@andriyDev andriyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting! Nice to see our schedule API getting more dynamic.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events M-Release-Note Work that should be called out in the blog due to impact labels Jul 27, 2025
@github-actions
Copy link
Contributor

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@alice-i-cecile alice-i-cecile added X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 27, 2025
@alice-i-cecile alice-i-cecile requested a review from ItsDoot July 27, 2025 19:30
@alice-i-cecile
Copy link
Member

This fixes a long-enough standing issue that I'd like a release note.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fundamental strategy seems good, and there's nice tests. Before we merge though:

  • this fixes an important and old enough issue that I think this needs a release note
  • I would like a few convenience APIs for this, ideally on World, App and Commands
  • I would like a brief note in the docs comparing and contrasting this to run conditions

I am very excited about this work though; please let me know if you don't have time and I'll finish this up for you.

Copy link
Contributor

@onkoe onkoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo, cool change!

There are a few doc changes I recommend to the primary functions. I also have some veeery optional docs for the tests:

Tests

Comments

I added some doc-comments to the tests. The other ones don't really do that, so feel free to leave em unchanged.

It's my preference for module-name-irrelevant stuff like this (but, tbh, it's nice for all tests lol)

World

It might be nice to have a quick schedule.run() test on the changes. Just to ensure things work right in practice aside from theory :)

Copy link
Contributor

@chescock chescock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, this is exciting!

@hymm hymm added the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Jul 28, 2025
@hymm
Copy link
Contributor Author

hymm commented Sep 23, 2025

Updated the pr to have some removal policies, where we have options to

  • remove only the systems, but leave the set in case a user wants to reuse the constraints on the set
  • fix the transitive dependencies automatically. I think this is good for cases where you only want to remove a set or system. Not fixing the dependencies is useful for where you'll be adding more sets and systems and fix the ordering then.

I'm not 100% convinced that a flat enum is the best choice here. It might be better to have some sort of configuration struct. Just brainstorming, but some other policies could be to remove sub sets, or run conditions.

@alice-i-cecile alice-i-cecile removed the S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged label Sep 24, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 25, 2025
@alice-i-cecile
Copy link
Member

@chescock's suggestion is solid and we might as well clean this up now, but I'll merge this next Monday if you don't have time to get to that.

@hymm
Copy link
Contributor Author

hymm commented Sep 25, 2025

I still need to update the release note

@alice-i-cecile alice-i-cecile added X-Contentious There are nontrivial implications that should be thought through and removed X-Uncontroversial This work is generally agreed upon labels Sep 29, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 29, 2025
Merged via the queue into bevyengine:main with commit cf19650 Sep 29, 2025
38 checks passed
@hymm hymm deleted the remove-systems branch October 1, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible M-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API for dynamic management of systems (adding and removing at runtime)

6 participants