// public static void CreateScreenRecordingControl(string displayName, string tooltip, Rect pos, SerializedProperty outputFolder, SerializedProperty rate, string defaultFolderName) // { // // float labelWidth = MyRoutines.GetEditorGUILabelWidth(); // float padding = MyRoutines.GetEditorGUIControlSpacing(); // float lineHeight = MyRoutines.GetEditorGUIStandardLineHeight (); // int folderButtonWidth = 25; // // //create the label field // EditorGUI.LabelField (new Rect (pos.x, pos.y, labelWidth, lineHeight), new GUIContent (displayName, tooltip)); // //reset the indent level // int indentLevel = EditorGUI.indentLevel; // EditorGUI.indentLevel = 0; // //disable the GUI // GUI.enabled = false; // if (string.IsNullOrEmpty(outputFolder.stringValue)) // outputFolder.stringValue = System.IO.Path.Combine(Application.dataPath, defaultFolderName); // float outputFolderWidth = pos.width - labelWidth - folderButtonWidth - padding; // //create the outputfolder field // EditorGUI.TextField (new Rect (pos.x + labelWidth, pos.y, outputFolderWidth, lineHeight), outputFolder.stringValue); // //renable the GUI // GUI.enabled = true; // float buttonXPos = pos.x + labelWidth + outputFolderWidth + padding; // if (GUI.Button(new Rect(buttonXPos, pos.y, folderButtonWidth, lineHeight), "...")) { // string value = EditorUtility.OpenFolderPanel ("Select Output Folder", "", ""); // if (string.IsNullOrEmpty (value) == false) // outputFolder.stringValue = value; // } // EditorGUI.indentLevel = indentLevel; // //get the vertical position of the next control // float ypos = MyRoutines.GetEditorGUINextControlYPos(pos.y); // EditorGUI.PropertyField(new Rect(pos.x, ypos, pos.width, lineHeight), rate); // } public static void CreateOutputPathControl(string displayName, string tooltip, Rect pos, SerializedProperty outputPath, bool isFile, string fileExtension, string defaultFileName) { float labelWidth = MyRoutines.GetEditorGUILabelWidth(); float padding = MyRoutines.GetEditorGUIControlSpacing(); float lineHeight = MyRoutines.GetEditorGUIStandardLineHeight(); int folderButtonWidth = 25; //create the label field EditorGUI.LabelField(new Rect(pos.x, pos.y, labelWidth, lineHeight), new GUIContent(displayName, tooltip)); //reset the indent level int indentLevel = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; //disable the GUI GUI.enabled = false; // if (string.IsNullOrEmpty(outputPath.stringValue)) // outputPath.stringValue = Application.dataPath; float outputFolderWidth = pos.width - labelWidth - folderButtonWidth - padding; //create the outputfolder field EditorGUI.TextField(new Rect(pos.x + labelWidth, pos.y, outputFolderWidth, lineHeight), outputPath.stringValue); //renable the GUI GUI.enabled = true; float buttonXPos = pos.x + labelWidth + outputFolderWidth + padding; if (GUI.Button(new Rect(buttonXPos, pos.y, folderButtonWidth, lineHeight), "...")) { string value = string.Empty; if (isFile == false) { //folder value = EditorUtility.OpenFolderPanel("Select Output Folder", outputPath.stringValue, ""); } else { //file value = EditorUtility.SaveFilePanel("Save File", outputPath.stringValue, defaultFileName + "." + fileExtension, fileExtension); } if (string.IsNullOrEmpty(value) == false) { outputPath.stringValue = value; } } EditorGUI.indentLevel = indentLevel; }