What is a GUILayoutOption[]

I am trying to write an editor script but I don’t know what a GUILayoutOption is, and what to feed the parameter.

The optional “options” array of all GUILayout controls allows you to override certain aspects of the layout behaviour. It is a “params” array which always has to be the last parameter of a method. Possible “values” you can feed to a control are generated by those methods:

You can either setup an array yourself, add any of the above mentioned “values” and pass the array to the control, or, which is the actual intended usage, just pass the desired options as “additional parameters” like this:

 if (GUILayout.Button("Button Text", GUILayout.MinWidth(100),GUILayout.Width(30)))

The “params” keyword allows to pass the array members as optional parameters. That’s why it has to be the last parameter. All additional parameters become an item in the options array. If you don’t need / want to override the GUIStyles behaviour, don’t pass anything:

 if (GUILayout.Button("Button Text"))

You can create your own layout options in a stored variable if you want to use the same ones repeatedly.
eg:

private GUILayoutOption[] textAreaOptions;

    public void OnEnable()
    {
        textAreaOptions = new GUILayoutOption[]
        {
            GUILayout.Height(48),
            //add more layout options
        };
    }

It is an array of objects of type GUILayoutOption.

for instance:

windowRect = GUILayout.Window(0, windowRect, ScalingWindow, "resizeable", GUILayout.MinWidth(80), GUILayout.MaxWidth(200));

GUILayout.MinWidth(…) and GUILayout.MaxWdth(…) are the GUILayoutOptions