1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

TextMesh Pro Text not being updated when using SetCharArray

Discussion in 'Unity UI & TextMesh Pro' started by xellfish, Jul 17, 2017 at 3:38 PM.

  1. xellfish


    May 25, 2014
    I already posted a similar question in the text mesh thread, but I figured it might be better to open a thread here.

    There seems to be a small bug in TMP_Text.SetCharArray(char[]). Setting the text using that method doesn't seem to update the component. Quick glance into the assembly reveals that this method is not calling SetVerticesDirty and SetLayoutDirty like all of it's brethren do, and calling those two methods manually after setting the array will indeed update the component correctly.

    I would also like to ask if it would be possible to add a method with the signature SetCharArray(char[], int start, int length). This would be very helpful when working with custom char buffers (which in turn help avoid the garbage inherhent to using strings or StringBuilders). There already exists SetCharArray(int[], int start, int length), but it only accepts int arrays, and to my knowledge it's not possible to cast char arrays to int arrays without allocating a new array. Should only be a minor variation of the existing methods, so that would be great.

    Using version and Unity 2017.1.0f3

  2. Stephan_B


    Unity Technologies

    Feb 26, 2017
    Let me take a look at the update issue as well as the addition of an overload for SetCharArray()

    I fixed the issue you reported as well as added the new overload to SetCharArray(char[] array, int start, int length);

    These changes will be in the next release.
    Last edited: Jul 18, 2017 at 8:01 AM