Unity Editor: Vertical scrollbar in flexible Editor Window


I am trying to create a custom editor tool for our game.

(I myself have a large screen, but some of the team don’t) Since there will be alot of options in the Editor I am forced to use scrollbars.
As all options are based on the hierarchy it’s best to dock it right aside the hierarchy window to save mouse movement :slight_smile:

Therefor i am trying to build a panel that is scrollable on the vertical axis and thus shows a scrollbar when it’s needed.
Ideally I’d love to make my window as large as possible (as the available space vertically)
And show up the scrollbar if the content is larger than the available area.

As you can see in the screenshot, right now the height is 600 and my scrollbar is zet at 1000
But the vertical red line indicates the open space I still have left. based on my 600 height in the BeginArea.

Is there a way to fill it up? So that my custom Editor window takes up the height that is available?

Again, i could / and am setting up fixed values, but i am wondering if there is any “responsive” or flexible solution to my issue.

Is there any out of the box answer to this? Or any help in the right direction?
Many thanks for your insight/guidance

GUILayout.BeginArea(new Rect(0, 0, 256, 600));

scrollPos = GUILayout.BeginScrollView(scrollPos,false,true, GUILayout.Width(256),GUILayout.MinHeight(200),GUILayout.MaxHeight(1000),GUILayout.ExpandHeight(true));

//the code of the editor panel

GUILayout.EndScrollView ();

I removed all the GUILayout width and height from your code, and tried it in my project, it became flexible and adataptable to the window size, so you could try that.