I have a bevy function that renders a dynamic table. I need to be able to spawn sprites in the various cells of the table, and therefore I need to be able to access Commands and asset-server. What is the best way to pass in commands and asset server into sub-functions? Passing in asset-server is compiling but causing a QueryDoesNotMatch(117v0) panic.... Is there a way to pass asset-server cleanly into the subfunction?
builder
.spawn(NodeBundle {
style: Style {
height: Val::Percent(100.0),
width: Val::Percent(100.0),
aspect_ratio: Some(1.0),
display: Display::Grid,
padding: UiRect { left: Val::Px(0.0),right:Val::Px(0.0),top: Val::Px(1.0),bottom: Val::Px(1.0) },
grid_template_rows: vec![
GridTrack::percent(5.0),
RepeatedGridTrack::flex(10, 1.0),
GridTrack::percent(5.0),
],
grid_template_columns: RepeatedGridTrack::flex(3, 1.0),
row_gap: Val::Px(0.0),
column_gap: Val::Px(0.0),
..default()
},
background_color: BackgroundColor(Color::DARK_GRAY),
..default()
})
.with_children(|builder| {
item_rect(builder, Color::ORANGE);
item_rect(builder, Color::BISQUE);
item_rect_double(builder, Color::WHITE);
for i in 0..10 {
item_rect(builder, Color::GRAY);
item_rect(builder, Color::GRAY);
item_rect_double(builder, Color::GRAY);
}
item_rect_bottom(builder, Color::GRAY,);