Skip to content

Commit ec822c8

Browse files
authored
Update breakout example's stepping plugin to use children (#18271)
# Objective Contributes to #18238 Updates the `SteppingPlugin` of the `breakout` example to use the `children!` macro. Note that in order to test this usage you must use `--features bevy_debug_stepping` and hit the back-tick key to enable stepping mode to see the proper text spans rendered. ## Solution Updates examples to use the Improved Spawning API merged in #17521 ## Testing - Did you test these changes? If so, how? - Opened the examples before and after and verified the same behavior was observed. I did this on Ubuntu 24.04.2 LTS using `--features wayland`. - Are there any parts that need more testing? - Other OS's and features can't hurt, but this is such a small change it shouldn't be a problem. - How can other people (reviewers) test your changes? Is there anything specific they need to know? - Run the examples yourself with and without these changes. - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - see above --- ## Showcase n/a ## Migration Guide n/a
1 parent a33161c commit ec822c8

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

examples/games/stepping.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,25 +161,20 @@ fn build_ui(
161161
stepping.always_run_node(label, node);
162162
}
163163

164-
commands
165-
.spawn((
166-
Text::default(),
167-
SteppingUi,
168-
Node {
169-
position_type: PositionType::Absolute,
170-
top: state.ui_top,
171-
left: state.ui_left,
172-
padding: UiRect::all(Val::Px(10.0)),
173-
..default()
174-
},
175-
BackgroundColor(Color::srgba(1.0, 1.0, 1.0, 0.33)),
176-
Visibility::Hidden,
177-
))
178-
.with_children(|p| {
179-
for span in text_spans {
180-
p.spawn(span);
181-
}
182-
});
164+
commands.spawn((
165+
Text::default(),
166+
SteppingUi,
167+
Node {
168+
position_type: PositionType::Absolute,
169+
top: state.ui_top,
170+
left: state.ui_left,
171+
padding: UiRect::all(Val::Px(10.0)),
172+
..default()
173+
},
174+
BackgroundColor(Color::srgba(1.0, 1.0, 1.0, 0.33)),
175+
Visibility::Hidden,
176+
Children::spawn(text_spans),
177+
));
183178
}
184179

185180
fn build_stepping_hint(mut commands: Commands) {

0 commit comments

Comments
 (0)