Closed
Description
Bevy version
0.11.0
Relevant system information
rust 1.71
What you did
I add a text bundle to show the fps and a counter:
in setup:
commands.spawn((
TextBundle::from_sections([
text_section(Color::GREEN, "\nFPS (SMA): "),
text_section(Color::CYAN, ""),
text_section(Color::GREEN, "\nCounter: "),
text_section(Color::CYAN, "111"),
])
.with_style(Style {
position_type: PositionType::Absolute,
top: Val::Px(15.0),
left: Val::Px(15.0),
..default()
}),
FpsLabel,
));
in update:
let mut text = query.single_mut();
if let Some(fps) = diagnostics.get(FrameTimeDiagnosticsPlugin::FPS) {
if let Some(sma) = fps.average() {
text.sections[1].value = format!("{sma:.2}");
}
};
text.sections[3].value = format!("{}", ball_counter.0);
What went wrong
the line of counter not showing on the screen!
but if I add a empty line after it:
...
TextBundle::from_sections([
text_section(Color::GREEN, "\nFPS (SMA): "),
text_section(Color::CYAN, ""),
text_section(Color::GREEN, "\nCounter: "),
text_section(Color::CYAN, "111"),
text_section(Color::CYAN, "\n END"),
])
...
now the Counter appears! but the END not shows on the screen