Namespace: | Sirenix.Utilities |
Assembly: | Sirenix.Utilities |
public static class GUILayoutOptions
GUILayoutOptions is a handy utility that provides cached GUILayoutOpion arrays based on the wanted parameters.
Most GUILayout and EditorGUILayout methods takes an optional "params GUILayoutOption[]" parameter. Each time you call this, an array is allocated generating garbage.
// Generates garbage:
GUILayout.Label(label, GUILayout.Label(label, GUILayout.Width(20), GUILayout.ExpandHeight(), GUILayout.MaxWidth(300)));
// Does not generate garbage:
GUILayout.Label(label, GUILayout.Label(label, GUILayoutOptions.Width(20).ExpandHeight().MaxWidth(300)));
public static readonly GUILayoutOption[] EmptyGUIOptions
public static GUILayoutOptions.GUILayoutOptionsInstance ExpandHeight(bool expand = true)
System.Boolean | expand |
public static GUILayoutOptions.GUILayoutOptionsInstance ExpandWidth(bool expand = true)
System.Boolean | expand |
public static GUILayoutOptions.GUILayoutOptionsInstance Height(float height)
System.Single | height |
public static GUILayoutOptions.GUILayoutOptionsInstance MaxHeight(float height)
System.Single | height |
public static GUILayoutOptions.GUILayoutOptionsInstance MaxWidth(float width)
System.Single | width |
public static GUILayoutOptions.GUILayoutOptionsInstance MinHeight(float height)
System.Single | height |
public static GUILayoutOptions.GUILayoutOptionsInstance MinWidth(float width)
System.Single | width |
public static GUILayoutOptions.GUILayoutOptionsInstance Width(float width)
System.Single | width |