public static void Window <T>(Rect windowRect, string title, Action <T> contentFunction, T argument) { int controlId = GUIUtility.GetControlID(FocusType.Passive); Event currentEvent = Event.current; if (currentEvent.type == EventType.MouseDown && windowRect.Contains(currentEvent.mousePosition)) { GUIUtility.hotControl = controlId; } Color guiColor = GUI.color; Handles.BeginGUI(); GUILayout.BeginArea(windowRect); GUI.backgroundColor = Palette.GuiBackground; EditorGUILayout.BeginVertical("Window"); CustomGUI.SetLabelColors(); EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins); CustomGUI.DrawTitle(title, CustomGUI.HeaderStyle); CustomGUI.DrawSplitter(10, 15, 1.0f); contentFunction(argument); EditorGUILayout.EndVertical(); CustomGUI.UnsetLabelColors(); EditorGUILayout.EndVertical(); GUILayout.EndArea(); Handles.EndGUI(); GUI.color = guiColor; }