- Home /
GUILayoutUtilities.GetRect
I have the follow code: GUIContent content = new GUIContent(label); Rect rect = GUILayoutUtility.GetRect(content, GUIStyle.none);
where label isn't null or empty. Yet I get this weird behavior where rect would alternate between width/height of 1/1 and then the correct width, height on alternate calls to OnGUI. I'm really stumped as to why this is happening.
Comment
Answer by Bunny83 · Dec 19, 2012 at 11:36 AM
That's quite simple. During the layout event Unity can't determine the size / position of the rect. In all other events it will be correct. The layout event is the first one each frame.
Your answer