2D Toolkit Forum

2D Toolkit => Support => Topic started by: aphexyuri on May 10, 2012, 07:37:53 pm

Title: Multiline TextMesh?
Post by: aphexyuri 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
Title: Re: Multiline TextMesh?
Post by: unikronsoftware 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?
Title: Re: Multiline TextMesh?
Post by: aphexyuri 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 :)