- Home /
How to tell how many lines of text are in my GUI Box when I use wordWrap
I'm trying to set the GUI box's height depending on how many lines of text there are inside the box, the only problem is that I don't know how to find out how many lines of text there are inside the box since the GUI box's width and height vary upon the Screen.width & Screen.height. I use wordWrap to wrap the text inside the GUI Box, is there any way to obtain how many lines are inside the box?
Answer by gfoot · Apr 21, 2014 at 10:09 PM
I'm not sure about the number of lines, but you should be able to get the required height in pixels using GUIStyle.CalcHeight:
http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle.CalcHeight.html
Thank you so much, this was bugging me for such a long time.
Great! You should accept the answer in that case, so the question is marked as answered.