If I am doing something like
GUI.Label(Rect(50,50,50,50),"MyString")
Is there anyway to find out the size “MyString” will be on the screen?
Cheers,
Grant
If I am doing something like
GUI.Label(Rect(50,50,50,50),"MyString")
Is there anyway to find out the size “MyString” will be on the screen?
Cheers,
Grant
Yup,
Try this:
stringSize = MyStyle.CalcSize( new GUIContent(MyString) );
Debug.Log( "width: " + stringSize.x + " height: " + stringSize.y );
Where MyStyle is your current GUIStyle.
Thanks
Now off to read GUIStyle refernces pages.