Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro GetParsedText() gives a string of empty characters.

Discussion in 'UGUI & TextMesh Pro' started by Ganosal, Apr 24, 2017.

  1. Ganosal

    Ganosal

    Joined:
    Sep 25, 2015
    Posts:
    4
    I have been trying to use TMP_Text.GetParsedText(), but the string I get exists out of empty characters (while the length of the string is correct).
    So by example when I have the text "<#ffffff>Test" the resulting string will just be "" and has a length of 4.

    Am I doing something wrong or is this a bug?

    The version of Unity I use is: 5.5.0.f3 and TextMesh Pro is version: 1.0.55.0b8.


    Edit: I just found out that you have to wait a frame or use ForceMeshUpdate() to make the text work. So consider this problem solved.
     
    Last edited: Apr 24, 2017
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,625
    Since the text is processed / generated just before the frame is rendered (when a change has occurred), the resulting change won't be reflected or the textInfo data structure updated until this has happened. Most of the time this is fine but for those times when you need to text to be processed right away, you can use the ForceMeshUpdate() function as you have stated in your edit :)
     
unityunity