diff --git a/examples/2d/text2d.rs b/examples/2d/text2d.rs index 56c2d3dc63069..e18d315bff519 100644 --- a/examples/2d/text2d.rs +++ b/examples/2d/text2d.rs @@ -124,13 +124,18 @@ fn setup(mut commands: Commands, asset_server: Res) { (Anchor::BottomRight, Color::Srgba(BLUE)), (Anchor::BottomLeft, Color::Srgba(YELLOW)), ] { - commands.spawn(( - Text2d::new(format!(" Anchor::{text_anchor:?} ")), - slightly_smaller_text_font.clone(), - TextColor(color), - Transform::from_translation(250. * Vec3::Y), - text_anchor, - )); + commands + .spawn(( + Text2d::new(" Anchor::".to_string()), + slightly_smaller_text_font.clone(), + Transform::from_translation(250. * Vec3::Y), + text_anchor, + )) + .with_child(( + TextSpan(format!("{text_anchor:?} ")), + slightly_smaller_text_font.clone(), + TextColor(color), + )); } }