-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Setting Run Criteria for State-based System Set Overwrites System Set State Run Critera #1839
Comments
This is underdocumented, but expected behavior. This is a result of the fact that there is no obviously correct truth table for merging 2 run criteria. However, you should be able to counteract this issue by using piped run criteria. |
Could we maybe add some kind of combinators then like ( maybe different name ) Also, I think that if this is expected behavior it would be much better to take out the convenience |
Yes, the states' sets are a bit of a holdover right now. A good chunk of API is due for a second pass to tighten inconsistencies like this. "Piping" criteria is a little bit different from chaining, hence a dedicated verb. This test should serve as an example; the gist: label the criteria when first inserting it, and then use |
I'm a little confused with the piping though, because what if I don't have a system to add the run first run critiera to and I only have the piped version. For instance, in the test you linked to you first add the "every other time" run criteria by itself to a system and label it, but what if I don't have a separate system to add it to and I only have one system. Then I can't add it to one system with a label and use the label later. That's why tried a chain instead, because it let me insert it in one step. Also, I'm not able to pipe two built-in systems that aren't designed for chaining such as Maybe we need "proxy" criteria that can be used to chain two run criterias with Anyway, thanks both for the help! I'm just kind of brainstorming ideas, but I get that there's still some work to be done here and I've got a decent work-around so I'm happy. 😃 |
There are methods to add criteria directly to stage, without having to attach them to a system. They do require you to label it, though, for obvious reasons. |
Ah, OK. Got it. 👍 |
Wanted to mention I ran into this same issue, and this thread helped immensly thanks everyone asking and starting the conversation
You can find the running example here for reference for the curious https://github.com/bayswaterpc/bevy_egui/blob/main/examples/bevy_central_panel.rs |
Fixed by #7267. |
Bevy version
97d8e4e
Operating system & version
Pop!_OS ( Ubuntu ) 20.04
What you did
Here's a full example with working and not working:
It appears that the
with_run_criteria
is overwriting the run criteria of theSystemSet
that is supposed to run it only when theGameState::Running
state is active.What you expected to happen
Both the working and the not working examples should run the same, with all the assets being loaded before the program exits.
What actually happened
The working output is as expected, all "assets" are loaded before game goes into running state and send the exit event:
The not working output though will run the game system that exits the program before all the assets have finished loading and the state transition is made:
Extra Context
Here's my current workaround to combine the fixed timestep run criteria with the game state run criteria:
The text was updated successfully, but these errors were encountered: