New Line and Quotation marks in Text

I would like to add a new line and some quotation marks to my text.

When I add a new line using Alt+Enter it doesn’t work in the panel renderer.

Adding quotation marks to the text from the UIBuilder breaks the uxml file after it has been saved.

Any solutions?

This is currently a bug. The UI Builder does not handle newlines (and other special symbols) in the UXML properly (and will actively undo all newline characters you manually add in UXML when it saves). We are tracking this and should have a fix soonish.

In the meantime, you’ll have to set the text with newlines in C# or in a different UXML template that you don’t ever modify in the UI Builder.

I try doing this in C# and it still won’t show newline on label?

            m_infoBoxLabel.text = text + "\n.";

Are labels unable to have multiline (saw that as option on Text Field?
UI

Hello,

From UXML directly it’s possible to input new lines in attributes with &#10

<engine:Label text="Hello
World"/>

Like Damian mentioned this not handled yet by the UI builder. It should be possible to have “\n” in the C# string and assign it to a label. Provided the Label is constrained in height it should expand to a new line.

1 Like

This should now be fixed in the latest UI Builder package: 0.10.1-preview

1 Like

Why was the decision made to deviate from HTML here and have text as an attribute, instead of just the content of a node?

1 Like

Mostly to reduce the scope of what we would need to support. We didn’t rule out support for content text in the future but that opens up a lot of other possibilities (like ) that we’re not ready yet to support.

1 Like

Thanks for the answer!

I can reproduce this issue, it seems like Labels currently don’t support text with newlines when assigned from c# code. I’ve tried \n, \r\n and

None of them seem to work, does anyone have more infos or even better a solution on this?

2 Likes

Can you please report this? It should work, there is not technical limitation that would prevent that, so that’s a bug. Thanks.

Still doesn’t work.

It does work in the UI Builder since the update, but it still doesn’t work when setting it programmatically…