Systems that can run multiple times that internally reset change detection #5851
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Sometimes you need to do work based on calculated components before they would normally be calculated.
You could move the corresponding systems before your system but systems after that system might update these components again.
You could run the corresponding systems before your system by adding them again right before your own but this will cause them to be calculated twice.
What solution would you like?
It would be nice to have some way to configure a system to have an internally change detection that is synced across multiple instances of itself. Basically resetting each time it runs even if it appears multiple times in a schedule.
I don't think this should be the default behavior for systems because it is just an optimization for some use cases.
Basically having a method on system that could recreate a new system that has this behavior.
Something like
update_system.internal_change_detection()
which returns a system that can be used multiple times.Could also be a different query filter like
InternalChanged
orInternalAdded
.I don't think "internal" is the best word for this but it is the only thing I can think of right now.
What alternative(s) have you considered?
Additional context
My use cases in the past have been with
GlobalTransform
so an external library would not be an optimal solution.I just lived with a one frame delay because I didn't think of finding the systems responsible for updating
GlobalTransform
in Bevy and reading them before my system. This would cause them to be calculated twice even if they weren't changed between the two duplicate instances of the systems.The text was updated successfully, but these errors were encountered: