Skip to content

Multiline Texts #182

@BafDyce

Description

@BafDyce

Apparently Text (docs) does not support multi line strings. Not sure if this is expected (but undocumented) behavior or a bug?

I simply made the following change to the examples/ui/text.rs example:

diff --git a/examples/ui/text.rs b/examples/ui/text.rs
index ecd7f081..c511ef38 100644
--- a/examples/ui/text.rs
+++ b/examples/ui/text.rs
@@ -17,7 +17,7 @@ fn text_update_system(diagnostics: Res<Diagnostics>, mut query: Query<&mut Text>
     for mut text in &mut query.iter() {
         if let Some(fps) = diagnostics.get(FrameTimeDiagnosticsPlugin::FPS) {
             if let Some(average) = fps.average() {
-                text.value = format!("FPS: {:.2}", average);
+                text.value = format!("FPS: {:.2}\nsecond line", average);
             }
         }
     }

Expected behavior: two lines of output

Actual behavior: single line of output:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions