Hello Guest

Author Topic: tk2dTextMesh Max Char error  (Read 2184 times)

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
tk2dTextMesh Max Char error
« on: February 17, 2014, 02:02:43 pm »
Hi,
(currently using 2d toolkit v2.3)
Just to let you know that you your "Max Char" does not work when you programmatically set the myText.text = *something more than max char*;

it will throw out lots of
!IsFinite(outDistanceForSort)
!IsFinite(outDistanceAlongView)
errors.....

-----------

now what is the point of the Max Char if it can't do it's job... oh well... lolx
P.S.> i've tried .Commit(); after setting the text... doesn't help either...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dTextMesh Max Char error
« Reply #1 on: February 17, 2014, 02:37:41 pm »
Hi,
The max char thing doesn't limit your input, but rather tells tk2d the max chars to allocate for memory purposes. The whole idea with that is to not keep reallocating memory, which is really really slow.

I'm not familiar with that error though - the text mesh simply clips when it hits the max chars. If you want tk2d to reallocate regardless of what happens you could do
textMesh.MaxChars = Mathf.Max(textMesh.MaxChars, newString.Length);
then assign .text
then .Commit();