- Home /
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)
Answer by pfreese · Jan 05, 2017 at 12:18 AM
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.
Your answer
Follow this Question
Related Questions
Problems about GUI fontsize 1 Answer
Help with making a triggered gui message 1 Answer
Break the limits on text area 0 Answers
Unity crashes at writing TextMesh? 0 Answers
The variable m_Font of 'GUISkin' doesn't exist anymore 1 Answer