Finding the available space in a GUILayout.

Let’s say that we’ve set up a GUILayout area that’s 200 by 20 in size and put two horizontal areas within it so that each is (roughly) 200 by 100 in size (but not exact). How can I find out how much space is actually available within each of those horizontal draw areas?

I’ve tried using GetLastRect but it doesn’t seem to do what I want…

GUILayout is designed so that you don’t need to know those things! During the repaint phase the GetLastRect immediately after the EndHorizontal will contain the rectangle, but it will be empty during the layout phase - which is where things are positioned.

If you want to distribute the size of an area of a layouted GUI manually, you can use the “normal” GUI. Just use GUILayoutUtility.GetRect to register the whole area and then just use normal GUI elements and arrange them in the Rect as you like.