Is there a problem with textInfo when using tags in the text?

Hello,

I am trying to manipulate a big amount of text and I need to be able to get specific information about the characters in the text used in TextMesh Pro.
I use textInfo and from there I need to know at which page the character is positioned (using page overflow).
I keep my original text for reference and update the TextMesh Pro object accordingly.
If I use the index of my original text with characterInfo[index_of_my_original_text] I will get the correct letter with a classic text, but if I introduce tags in the text I get really confusing results that I can’t make sense of (it’s just not the same letters anymore). Also with tags if I just search for the first character of the page and the last it doesn’t give me the correct characters (otherwise it works with basic text).
So my question would be, is there a good way that I don’t know about that would allow me to get the correct index with TextMesh Pro or is it just not possible when tags are involved?

Thank you for any answer.

The index of the characterInfo[index] is the index of the character that was rendered which includes spaces although they do not have geometry. As such characterInfo excludes the rich text.

Having said that, characterInfo[index].index is the index of the character in the source string.

Given the following source test “A<color=“red”>B”

characterInfo[0].index would equal 0 which is the index of “A” in the source string.
characterInfo[1].index would equal 14 which is the index of “B” in the source string.

1 Like