Legacy Documentation: Version 2018.1 (Go to current version)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



public static method MinWidth(minWidth: float): GUILayoutOption;
public static GUILayoutOption MinWidth(float minWidth);


Option passed to a control to specify a minimum width.

Note: This option will override the Automatic width Layout parameter

Minimum allowed width for a Window.

    // Draws a window you can resize between 80px and 200px width
    // Just click the box inside the window and move your mouse
    private var windowRect : Rect = Rect (10, 10, 100, 100);
    private var scaling : boolean = false;

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

function ScalingWindow (windowID : int) { GUILayout.Box("", GUILayout.Width(20), GUILayout.Height(20)); if (Event.current.type == EventType.MouseUp) { scaling = false; } else if (Event.current.type == EventType.MouseDown && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { scaling = true; }

if (scaling) { windowRect = Rect (windowRect.x, windowRect.y, windowRect.width + Event.current.delta.x, windowRect.height + Event.current.delta.y); } }
no example available in C#

Did you find this page useful? Please give it a rating: