I'm attempting to write the text "Foo" to a blank window using Rust and bevy = 0.10.1
. As of version 0.10, the way to update text for a spawned entity is by using the text: Text::from_selection(value, style)
submitted to TextBundle
as noted here: https://docs.rs/bevy/latest/bevy/prelude/struct.TextBundle.html. However, nothing is ever drawn to the screen.
use bevy::math::Vec3;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(write_text)
.run();
}
fn write_text(mut commands: Commands,) {
commands.spawn(Camera3dBundle::default());
commands.spawn( TextBundle {
text: Text::from_section("Foo", TextStyle {
color: Color::WHITE,
..default()
}),
transform: Transform::from_translation(Vec3::new(4., 0., 4.)),
..default()
});
}