private bool ErrorsOnHierarchy(GameObject[] gameObjectsSelected) { // Verifies if there's at least one gameobject selected if (gameObjectsSelected.Length <= 0) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._00, FEEDBACKS.Button._00); return(true); } // Verifies if all selected gameobjects has the same parent else if (EzRR_ErrorCheckers.CheckForDifferentParents(gameObjectsSelected)) { if (EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.Rename._02, FEEDBACKS.Button._02, FEEDBACKS.Button._01)) { return(false); } else { return(true); } } else { return(false); } }
private bool ErrorsOnProjectFolder(Object[] objectsSelected) { // Verifies if there's at least one object selected if (objectsSelected.Length <= 0) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._01, FEEDBACKS.Button._00); return(true); } // Verifies if the insert value is empty or null else if (EzRR_ErrorCheckers.CheckForStringNullOrEmpty(stringToInsert)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.Insert._01, FEEDBACKS.Button._00); return(true); } // Verifies invalid characters else if (EzRR_ErrorCheckers.CheckForInvalidCharacters(stringToInsert)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._02, FEEDBACKS.Button._00); return(true); } else { return(false); } }
private void DoInserProjectFolder() { Object[] _objectsSelected = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); // Check for errors before continuing if (ErrorsOnProjectFolder(_objectsSelected)) { return; } // Keep the path of the current file string _path; // Calculate the amount that each file will increase in the progress bar float _result = (float)_objectsSelected.Length / 100f; for (int i = 0; i < _objectsSelected.Length; i++) { EditorUtility.DisplayProgressBar(FEEDBACKS.Title._02, FEEDBACKS.Replace._00, _result * i); _path = AssetDatabase.GetAssetPath(_objectsSelected[i]); insertNewName = _objectsSelected[i].name; if (insertOption == InsertOptions.beginning) { insertNewName = insertNewName.Insert(0, stringToInsert); } else if (insertOption == InsertOptions.end) { int _index = insertNewName.Length; insertNewName = insertNewName.Insert(_index, stringToInsert); } else { if (insertIndex > insertNewName.Length) { insertIndex = insertNewName.Length; } insertNewName = insertNewName.Insert(insertIndex, stringToInsert); } if (EzRR_ErrorCheckers.CheckForInvalidNameEndings(insertNewName)) { Debug.LogWarning("Skipping " + _objectsSelected[i].name + ":\n" + FEEDBACKS.General._03); } else { // If something happens during the replacing get the message and show it on console string _message = AssetDatabase.RenameAsset(_path, insertNewName); if (!string.IsNullOrEmpty(_message)) { Debug.LogWarning(_message); } } } EditorUtility.ClearProgressBar(); }
private bool ErrorsOnHierarchy(GameObject[] gameObjectsSelected) { // Verifies if there's at least one gameobject selected if (gameObjectsSelected.Length <= 0) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._00, FEEDBACKS.Button._00); { return(true); } } // Verifies if the insert value is empty or null else if (EzRR_ErrorCheckers.CheckForStringNullOrEmpty(stringToInsert)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.Insert._01, FEEDBACKS.Button._00); return(true); } else { return(false); } }
private bool ErrorsOnProjectFolder(Object[] objectsSelected) { // Verifies if there's at least one object selected if (objectsSelected.Length <= 0) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._01, FEEDBACKS.Button._00); return(true); } // Verifies if all the objects are the same type else if (EzRR_ErrorCheckers.CheckForDifferentTypes(objectsSelected)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.Rename._03, FEEDBACKS.Button._00); return(true); } // Verifies the objects extension else if (EzRR_ErrorCheckers.CheckForBlockedExtension(objectsSelected)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.Rename._04, FEEDBACKS.Button._00); return(true); } // Verifies invalid characters else if (EzRR_ErrorCheckers.CheckForInvalidCharacters(previewName)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._02, FEEDBACKS.Button._00); return(true); } // Verifies invalid name endings else if (EzRR_ErrorCheckers.CheckForInvalidNameEndings(previewName)) { EditorUtility.DisplayDialog(FEEDBACKS.Title._00, FEEDBACKS.General._03, FEEDBACKS.Button._00); return(true); } else { return(false); } }