Hello Guest

Author Topic: Sending a TextMesh a string with a newline...  (Read 4440 times)

Madrayken

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Sending a TextMesh a string with a newline...
« 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sending a TextMesh a string with a newline...
« Reply #1 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.

Madrayken

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Sending a TextMesh a string with a newline...
« Reply #2 on: October 08, 2013, 04:16:59 pm »
Perfect! Thank so much. I would never have guessed that!