void OnGUI() { gradient = EditorGUILayout.GradientField(gradient); int width = EditorGUILayout.IntField("Width", resolution.x); int height = EditorGUILayout.IntField("Height", resolution.y); resolution = Int2.Max(Int2.one, new Int2(width, height)); if (GUILayout.Button("Generate")) { string path = EditorUtility.SaveFilePanelInProject("Save Gradient as PNG", "Gradient.png", "png", ""); if (!string.IsNullOrEmpty(path) && !string.IsNullOrWhiteSpace(path)) { SaveGradient(path); } } }