Hello Guest

Author Topic: How do I manually WordWrap my text in a Text Mesh?  (Read 7718 times)

Tiarny

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
How do I manually WordWrap my text in a Text Mesh?
« on: August 09, 2012, 05:17:24 pm »
I have a feeling I'll kick myself when I get the answer to this. I'm currently trying to load in strings from a script and I want to add line breaks to format the text correctly when a single line is too big to fit within the given area. I can easily create multi-line text for the tk2dTextMesh using the Unity editor, but I can't seem to find the correct return character to do it when creating text in my scripts. What would be the best way to implement this?

I was reviewing the documentation on the site before posting my query and I noticed that there were some properties (formatting & wordWrapWidth) on there that I can't currently seem to access in my own scripts. I'm running 1.76 final + Patch 1, so I was wondering if that is something coming in a future update or if I was just overlooking something.

Thanks for your help! It's a great toolkit, and has really sped up development here.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do I manually WordWrap my text in a Text Mesh?
« Reply #1 on: August 09, 2012, 07:23:58 pm »
The word wrap stuff got into 1.76 + patch1? That wasn't intended. You can get a patch for all of this in the private support forum though -
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,131.msg2220.html#msg2220

Its not fully complete yet, which is why it isn't (shouldn't be) in the current version, but is perfectly usable. Let me know how you get on with it.

p.s. I don't think you can change the size in code just yet, but there is a decent interface for it.

nikolic

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: How do I manually WordWrap my text in a Text Mesh?
« Reply #2 on: August 09, 2012, 10:34:41 pm »
p.s. I don't think you can change the size in code just yet, but there is a decent interface for it.

Yes, it works. I use it in code.

Tiarny

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How do I manually WordWrap my text in a Text Mesh?
« Reply #3 on: August 09, 2012, 10:57:56 pm »
The word wrap stuff got into 1.76 + patch1? That wasn't intended. You can get a patch for all of this in the private support forum though -
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,131.msg2220.html#msg2220

Its not fully complete yet, which is why it isn't (shouldn't be) in the current version, but is perfectly usable. Let me know how you get on with it.

p.s. I don't think you can change the size in code just yet, but there is a decent interface for it.

Sorry for the confusion, but the word wrap stuff doesn't appear to be in 1.76. However it does appear on the documentation for the tk2dTextMesh class on the site: http://unikronsoftware.com/2dtoolkit/doc/html/classtk2d_text_mesh.html

That's why I wasn't sure if it was implemented or not, as I couldn't find the corresponding properties in my scripts, so I thought it best to ask here first.

That patch seems to be exactly what I'm looking for too, so problem solved!  ;D