We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
On::set_next_state
This is a common simple pattern that uses a surprising amount of boilerplate. We could simplify this to a single method call.
The text was updated successfully, but these errors were encountered:
A simple working prototype:
fn set_next_state<S: States + Clone>(next_state: S) -> Self { On::run(move |mut state: ResMut<NextState<S>>| { state.set(next_state.clone()); }) }
The Clone bound is required as NextState::set takes ownership, and we need to be able to reuse the callback.
Clone
NextState::set
Sorry, something went wrong.
You might want to change this to take a closure instead, like mentioned here: #25
That would avoid the need for Clone, and you would be able to react to the contents of the event that is causing a state change.
set_next_state<S: States>(impl FnMut(E) -> S) -> Self
No branches or pull requests
This is a common simple pattern that uses a surprising amount of boilerplate. We could simplify this to a single method call.
The text was updated successfully, but these errors were encountered: