2D Toolkit Forum

2D Toolkit => Support => Topic started by: Madrayken on October 08, 2013, 02:52:40 am

Title: Sending a TextMesh a string with a newline...
Post by: Madrayken on October 08, 2013, 02:52:40 am
Hiyo,

I'm trying to get a multi-line text box working with my externalised strings (for localisation purposes). I'm sending the TextMesh strings like this: "Death be\nnot proud." and then calling Commit().

The text is updating, but the newlines are not being interpreted correctly. I've tried toggling 'Formatted', 'Inline styling' etc, but nothing seems to work. Any suggestions?

Many thanks.
Title: Re: Sending a TextMesh a string with a newline...
Post by: unikronsoftware on October 08, 2013, 11:37:17 am
You need to set .text with the proper character. It looks like you're sending
Death be \\nnot proud. - i.e. the \ character followed by n
Try setting text = theString.Replace("\\n", "\n");
to actually set the newline character instead of \\n

You dont need formatting, inline styling or anything else turned on.
Title: Re: Sending a TextMesh a string with a newline...
Post by: Madrayken on October 08, 2013, 04:16:59 pm
Perfect! Thank so much. I would never have guessed that!