Getting the current x and y values from GUILayout?

Hi all,
I was wondering:

is there any way to get the current x and y values out of GUILayout? As in ‘where am I up to’ on the screen?

This need arises from trying to overlap certain items on purpose in OnGUI. Overall I’m using GUILayout, but using GUI to overlap things, as obviously, GUILayout isn’t designed for this.

For example, I’ve got a GUILayout.BeginVertical(); group containing 3 Labels. I want to know ‘where the last label is’ on the screen, so I can use this position to accurately place another element onto it using plain old GUI.

Any ideas? :slight_smile:

Try GUILayoutUtility.GetRect and GetAspectRect. They basically return the rect that the next layouted gui element would occupy (they also “use it up”, so the next GUILayout call will be laid out after the rect returned in GetRect.)

Thanks! Got it working.

GetRect was what I was looking for - I didn’t know it ‘uses up’ the space - thanks so much for that tip!