Anyone have any idea how to create a line break in yarn spinner? I’ve tried
and
and neither works.
2 Answers
2A little late, but here it goes:
when Yarn spinner imports your text to unity the "
" is not being interpreted as new line but as two characters "" + “n” wich is why it only prints this out in the text. You have to make your own line feed character to use in yarn for line breaking (i.e. ^) To do that, open DialogUI script of the yarn spinner and on the line 287 use a replace method on the “text” variable, like this:
text = text.Replace('^', '
');
This replaces your custom yarn character for a new line with "
" but this time unity will iterpret it as a line feed not as a "" + “n” as it does when importing from yarn file.
Now, when writing your dialogue, use the custom character (i.e “^”) to break new line without making yarn skip to the next yarn.line. Took me a few days to find this solution but it works.
If you use YarnSpinner with Text Mesh Pro, you can do a line break by typing .
For example:
This is the first line.
This is the second line.
Will return this:
This is the first line.
This is the second line.
This will not work correctly with the build in type-writer effect ( DialogueUI.TextSpeed > 0 ), because it will generate the command step by step. Meaning that you can see how it types < then b and then r , before the command disappears and the line break happens.
> A little late, but here it goes No worries, this is still highly relevant. Thank you for this solution. Works great for me.
– Vivien_Lynn