-
-
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
Create a System Builder Syntax instead of using System Descriptors #2736
Create a System Builder Syntax instead of using System Descriptors #2736
Conversation
Attempt at fixing `SystemConfig`, `StartupConfig`
@alice-i-cecile, could you please clarify what you mean by
and also
from where? |
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
So, this is "the method to add a system to a stage should point to the Stage docs" and so on.
From e.g. the Stage docs. The idea here is that we want bidirectional links between "the thing we're configuring" and "the tool used to configure it". |
I believe all are now complete bar the book :) |
I'm also curious what happens if a system in a SystemSet specifies a stage like so .add_system_set(
SystemSet::new()
.stage(Stage::Label)
.with_system(example_system.stage(Stage::OtherLabel))) |
|
@Ratysz yeah, sorry that was copy pasted from the first part of my question before I noticed it was removed and I removed that part of my comment. It's not in the code anymore. |
Right. I don't remember if it came up during implementation, but that should crash, the same as with extra run criteria. |
We don't actually throw any errors when a system has it's own stage and is also inside a set. On baking the SystemSet, we either overwrite or add to data in the systems. |
Well... I think both the system and the set it's in having a stage label should be a hard error, because it's code that doesn't have an obvious correct pathway. See here for similar discussion about run criteria. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not particularly important to fix this, but some of the impl block have inconsistent spacing between functions. MOst of the codebase has a space between each function.
Overall, I really like this new api.
@@ -229,6 +229,23 @@ impl App { | |||
} | |||
|
|||
pub fn add_system_set(&mut self, set: SystemSet) -> &mut Self { | |||
fn ensure_no_conflicts(set: &SystemSet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could keep a reference to the conflicting stage name and add that to the panic message.
Small suggestion, you could use this instead conflict = set.systems.iter().any(|system| system.config().stage != set.config().stage);
, but that's entirely up to preference.
Fixed by #7267. |
Objective
Closes #1978
Solution
Working around @cart's [design](https://github.com/bevyengine/bevy/issues/1978#issuecomment-825337056], implement a builder syntax for systems such that we can do something like:
Please do watch this pr and comment on the changes made :)
Made with love and significant help from @Ratysz XD