Question by
TheDogePwner · Jan 03, 2016 at 02:21 AM ·
c#guiongui
Get Width/Height Of String Outside of OnGUI Method
Hi,
I need to find the width and height of a string. I have tried
Vector2 widthAndHeight = GUI.skin.label.CalcSize(new GUIContent("some string"));
But CalcSize is only callable from the OnGUI() method. I need a way to find the width/height outside of the OnGUI method.
Thanks for any help in advance!
Comment
Answer by hexagonius · Jan 03, 2016 at 10:25 PM
can't you just save to variables the info whenever the shown text is changed? I mean OnGUI is called anyway.
Your answer
Follow this Question
Related Questions
re historic GUI system 1 Answer
Toggle Button: hope it toggle once but it toggle many times 1 Answer
Locate _MainTex from a public shader and assign to instantiated prefab for GUI 1 Answer
Update and Get PlayerPrefs during runtime? 0 Answers
Transform search function only sporadically works?! 1 Answer