Multiline string attribute

As by the title, I can’t find a way to have a string attribute that allows me to set a multiline text.
The editor already supports it for the Text element, so should not be that hard to allow it also for string attributes.

i think you have to add \n to go to a new line

I copy pasted a multiline text, and it ended up in a single line.

How are you showing the multiline text? Can you post an image to show what you mean?

The Text element below has a text with a newline character. I copied it and pasted it into the string attribute on top. As you can see there is no newline.
In play mode, the text appears on a single line (my script uses that string value to override the element text).

I tried to add a \n in the text and it just gets printed.
But even it worked wouldn’t be enough.
My suggestion is to have the same multiline input box for string attributes, as it appears in the Text element.

Had a quick look and it looks like there is a pass on the string attribute to be ‘literal’ so “\n” becomes “\n”.

So I end up doing: https://playcanvas.com/editor/scene/595012

Not great and I agree with you that the two textfields should have the same behaviour.

1 Like