-
-
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
FixedTimeStep systems do not honor their associated app state #8059
Comments
Does this work if you use a |
Yes, then it works. Thanks! |
@alice-i-cecile I'm trying to run a set of systems only when the game is in a certain state, and with a fixed timestep. First I tried this: app.add_systems(
(
system_a,
system_b,
system_c,
)
.in_set(labels::Lobby)
.after(labels::Network)
.in_set(OnUpdate(GameState::Lobby))
.in_schedule(CoreSchedule::FixedUpdate)
) which led me to this issue. Then I tried app.add_systems(
(
system_a,
system_b,
system_c,
)
.in_set(labels::Lobby)
.after(labels::Network)
.run_if(in_state(GameState::Lobby))
.in_schedule(CoreSchedule::FixedUpdate)
) Which gave me some unsatisfied trait bounds:
I found app.add_systems(
(
system_a,
system_b,
system_c,
)
.in_set(labels::Lobby)
.after(labels::Network)
.distributive_run_if(in_state(GameState::Lobby))
.in_schedule(CoreSchedule::FixedUpdate)
) which gave:
At this point I'm not sure of the best way to specify that a set of systems should run on a fixed timestep, and only while in a certain state. If the answer is currently "add the Thanks so much for your work on the new stageless API, it's been really cool to see my bevy code shrink in size while remaining functionally the same (along with gaining new ergonomics!) |
@st0rmbtw nice! I changed |
@alice-i-cecile can this be closed now that #8260 has been merged? |
Bevy version
0.10
What you did
Consider the following Bevy app:
What went wrong
The
print_hello
system runs regardless of the application state. It should only run in theAppState::Second
state but it runs also in theAppState::First
state.The following output is generated:
If line the line with
.in_schedule(CoreSchedule::FixedUpdate)
is commented out, the output is:It's as expected. But of course the system is now run every frame.
The text was updated successfully, but these errors were encountered: