-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow same-state transitions and add ChangeState
system param
#11160
Conversation
2704f67
to
f9c7e6d
Compare
It might be worth updating examples to use |
Looking for obscure wrappers is difficult without examples, good idea |
I could also remove |
f9c7e6d
to
af56d7e
Compare
Renamed Updated examples to use |
I had an idea that might make the names more coherent. I won't include it in this PR, but figured I'd mention it anyways: Rename |
|
Closing as outdated after #11426. The issue in #9130 persists, mentioned in the Future Work section of the computed states PR:
Alternatively, a similar approach as in this PR may still be possible -- I haven't read through the computed states PR. |
Objective
Fixes #9130.
Solution
Add a system param
ChangeState<S>
to set the next state depending on the current state. Remove the same-state check fromapply_state_transition
.See #11158 for an alternative approach.
Changelog
ChangeState<S>
to set the next state depending on the current state.Migration Guide
NextState
can now trigger state transitions fromcurrent_state
to itself.To preserve the old behavior, replace instances of
next_state: ResMut<NextState<S>>
withstate: ChangeState<S>
, and replacenext_state.set(Foo)
withstate.change(Foo)
.