Quantcast
Channel: UGUI & TextMesh Pro
Viewing all articles
Browse latest Browse all 23263

Determine Text Line Count and Characters Per Line

$
0
0
When using the Unity UI Text component, is there a way to determine the number of lines of text, and the number of characters per line of text?

The Text.cachedTextGeneratorForLayout seems really promising - it returns a list of UILineInfo objects, which each tell you the start and end char index for the line.

However, the info I get from Text.cachedTextGeneratorForLayout is always 1 line...even if, visually, I can see that the text wraps to 3-4 lines. It seems like it only returns multiple...

Determine Text Line Count and Characters Per Line

Viewing all articles
Browse latest Browse all 23263

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>