public static void Draw(this GUIStyle current, string key, bool compact = false, bool grouped = false, bool headers = false) { EditorGUILayout.BeginVertical(); var styleKey = key + "." + current.name; var styleFoldout = current.name.ToLabel().DrawFoldout(styleKey); if (styleFoldout) { var labelWidth = compact ? 140 : 0; EditorGUI.indentLevel += 1; EditorUI.SetFieldSize(-1, labelWidth, false); current.name = current.name.Draw("Name".ToLabel()); Utility.SetPref <bool>(key + "." + current.name, true); if (compact && headers) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(140); EditorUI.SetLayout(120); "Text".ToLabel().DrawLabel(EditorStyles.boldLabel, false); "Background".ToLabel().DrawLabel(EditorStyles.boldLabel, false); EditorGUILayout.EndHorizontal(); } foreach (var state in current.GetNamedStates()) { state.Value.Draw(state.Key, compact, styleKey + "." + state.Key); } current.border.Draw("Border", compact, key + ".Border"); current.margin.Draw("Margin", compact, key + ".Margin"); current.padding.Draw("Padding", compact, key + ".Padding"); current.overflow.Draw("Overflow", compact, key + ".Overflow"); if (!grouped || "Text".ToTitleCase().ToLabel().DrawFoldout(key + "Text")) { current.DrawTextSettings(compact); } if (!grouped || "Position & Size".ToTitleCase().ToLabel().DrawFoldout(key + "Area")) { current.imagePosition = current.imagePosition.Draw("Image Position").As <ImagePosition>(); current.contentOffset = current.contentOffset.DrawVector2("Content Offset"); current.fixedWidth = current.fixedWidth.Draw("Fixed Width"); current.fixedHeight = current.fixedHeight.Draw("Fixed Height"); current.stretchWidth = current.stretchWidth.Draw("Stretch Width"); current.stretchHeight = current.stretchHeight.Draw("Stretch Height"); } EditorUI.ResetFieldSize(); EditorGUI.indentLevel -= 1; } EditorGUILayout.EndVertical(); }