How to use after with multiple systems (e.g with a tuple)? #16381
Unanswered
Joel-Singh
asked this question in
Q&A
Replies: 1 comment
-
I found a solution: To have layout_nodes run during |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For context: I'm making a match 3 game
I have a layout_nodes system which is intending to control the layout of a board and match_counter entity. But layout_nodes must happen after those components have spawned in. I add my layout nodes in this line:
.add_systems(Startup, layout_nodes.after( (spawn_match_counter, spawn_board) ))
after
seems like it should accept a tuple of systems, but it doesn't. Here's the error I'm getting:rustc: required by a bound introduced by this call [E0277]
rustc:
(for<'a, 'b> fn(bevy::prelude::Commands<'a, 'b>) {spawn_match_counter}, for<'a, 'b> fn(bevy::prelude::Commands<'a, 'b>) {spawn_board})
is not a system setthe trait
IntoSystemSet<_>
is not implemented for(for<'a, 'b> fn(bevy::prelude::Commands<'a, 'b>) {spawn_match_counter}, for<'a, 'b> fn(bevy::prelude::Commands<'a, 'b>) {spawn_board})
[E0277]How would I actually specify a system to run after two other systems?
Here are the signatures for my functions:
fn layout_nodes( mut board: Query<Entity, With<Board>>, mut match_counter: Query<Entity, With<MatchCounter>>, mut commands: Commands ) {
fn spawn_match_counter(mut commands: Commands) {
pub fn spawn_board(mut commands: Commands) {
I realize I could chain the systems together like this:
.add_systems(Startup, ( spawn_board, spawn_match_counter, layout_nodes ).chain())
But, my spawn_board is already added to my app as it is in a "board" plugin. And the above add_systems call would result in spawn_board being called twice.
Thank you!
Joel Singh
Bevy version: 0.14.2
Beta Was this translation helpful? Give feedback.
All reactions