Get a length of text from "paragraph"

Hello,
Lets say i have e UI text and few words written within it.

Is it possible to get the length of one word from the paragraph without having this word as separated text object? (get it using UI EventSystem / some other way)

1 Answer

1

I assume you are asking about getting the size of a word on the display, not the length in characters.

If so, you can access information about the positions of rendered glyphs using the cachedTextGenerator property on the Text component. Use the vector difference between the position of the first character in the work and the position of the space following the word.

thanks! I'll give it a go!