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?

I’m not sure about the number of lines, but you should be able to get the required height in pixels using GUIStyle.CalcHeight: