private void GenerateCode() { if (!allParametersValid) { Debug.LogError("Not all parameters valid, cannot create"); return; } string validPath = AssetDatabaseExtensions.GetValidAssetPath(outputPath, ".cs"); if (string.IsNullOrEmpty(validPath)) { return; } Debug.Log(validPath); // Create any required folders System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(validPath)); if (System.IO.File.Exists(validPath)) { if (!EditorUtility.DisplayDialog("File Exists!", "File Exists. Do you want to overwrite it?", "Yes", "No")) { return; } } // Create the file System.IO.File.WriteAllText(validPath, replacedString); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); }
private static void DeleteSubAssetMenuAction() { AssetDatabaseExtensions.DeleteSubAsset(Selection.activeObject); }