Split States
into their own crate, and add convenience app extension methods
#7906
Labels
A-App
Bevy apps and plugins
A-ECS
Entities, components, systems, and events
C-Code-Quality
A section of code that is hard to understand or change
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
X-Controversial
There is active debate or serious implications around merging this PR
What problem does this solve or what need does it fill?
Bevy states are well-isolated from other app or ECS logic, and not all users will want to use our exact implementation (e.g. some users may want a state stack).
Adding dedicated methods to manage and work with states to both
bevy_app
andbevy_ecs
feels "wrong" as a result: it ends up polluting APIs with what could reasonably be an add-on.What solution would you like?
bevy_states
crate.bevy_ecs
.App::add_state
out ofbevy_app
onto an extension trait..on_update
,.on_enter
and.on_exit
system modifiers via an extension trait.bevy_states
inbevy_core
as an optional dependency and add the extension traits and structs back to the prelude.What alternative(s) have you considered?
If we want to replace startup systems with states as in #5437, we should be able to retain this design, and simply import
bevy_states
inbevy_core
.Additional context
This was proposed by @maniwani in #7790 here, which attempted to add sugar for on_update.
#7634 is also something to be mindful of during the implementation.
The text was updated successfully, but these errors were encountered: