Hello Guest

Author Topic: Multiline TextMesh?  (Read 5838 times)

aphexyuri

  • Newbie
  • *
  • Posts: 14
    • View Profile
Multiline TextMesh?
« on: May 10, 2012, 07:37:53 pm »
Hi,

I'm dynamically setting the value of a TextMesh, but the text needs to have multiple lines.

And example of text would be:

Code: [Select]
public string exampleTxt = "Hello,\nhow are you";
I've tried both
Code: [Select]
\n and
Code: [Select]
\r chars but it does not seem to be working. Can this be done, and if so how?

Thanks,
Yuri

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiline TextMesh?
« Reply #1 on: May 10, 2012, 08:00:12 pm »
That should just work (\n). Check out sample #5 - animation. In tk2dDemoAnimationController.cs, void AnimationEventDelegate(tk2dAnimatedSprite sprite, tk2dSpriteAnimationClip clip, tk2dSpriteAnimationFrame frame, int frameNum),
it constructs a multiline string and sets it to a textmesh.

Perhaps there is an issue with encoding?

Another thing that could be an issue is the number of characters, perhaps its clipping at 6 characters?

aphexyuri

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Multiline TextMesh?
« Reply #2 on: May 10, 2012, 08:19:17 pm »
Thanks Unikron, got it!

Yes, the Max Chars was not enough for the entire 2nd row, and thus it did not show :)