GetParsedText() gives a string of empty characters.

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.

1 Like

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 :slight_smile:

1 Like

Hello, I noticed GetParsedText() would always include a zero-width white space character as the last character, is this by design?

When working with the input field, you should not be accessing the text of the child text component. This component is used to display the text. Instead you should be accessing the parent input field .text property.

As for the reason, imaging an input field set for password. The text of the child component would be “*****” whereas the text of the parent input field would contain the actual password.

I needed to access the displayed text without rich text tags, is there another way to properly access it?

1 Like

https://discussions.unity.com/t/700870