Replace startup systems with a built-in state enum that handles resource cleanup #5437
Labels
A-App
Bevy apps and plugins
A-Assets
Load files from disk to use for things like images, models, and sounds
A-ECS
Entities, components, systems, and events
A-States
App-level states machines
C-Feature
A new feature, making something new possible
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
X-Controversial
There is active debate or serious implications around merging this PR
Problem
AppExit
: we must listen for the event and carefully time the resources.Proposed solution
This allows us to use standard on-enter, on-exit and state transition methods to control things like asset loading, cleanup, pausing the game, autosaving on exit and so on.
Extensions
We could add an explicit asset loading state as well. This may work well, but could be controversial.
Context
Discussed with @IceSentry on Discord after trying to help a user ensure data is cleaned up correctly.
This builds on but does not require the patterns espoused by the [Stageless RFC}(https://github.com/bevyengine/rfcs/pull/45).
Would address #1353. If we were to implement this, we would likely want to have a more robust event strategy by default, to ensure that gameplay events do not get lost during a pause.
The text was updated successfully, but these errors were encountered: