public static void DisableLibstAtPath(string path) { List <string> files = SA_AssetDatabase.FindAssetsWithExtentions(path); for (int i = 0; i < files.Count; i++) { var filePath = files[i]; //Make sure this is not a folder if (SA_AssetDatabase.IsValidFolder(filePath)) { continue; } //Already disabled if (SA_AssetDatabase.GetExtension(filePath).Equals(DISABLED_LIB_EXTENSION)) { continue; } string newFilePath; newFilePath = filePath + DISABLED_LIB_EXTENSION; float progress = (float)(i + 1) / (float)files.Count; string fileName = SA_AssetDatabase.GetFileName(newFilePath); EditorUtility.DisplayProgressBar("Stan's Assets.", "Packing: " + fileName, progress); SA_AssetDatabase.MoveAsset(filePath, newFilePath); SA_AssetDatabase.ImportAsset(newFilePath); } EditorUtility.ClearProgressBar(); }
public static void EnableLibsAtPath(string path) { List <string> files = SA_AssetDatabase.FindAssetsWithExtentions(path); for (int i = 0; i < files.Count; i++) { var file = files[i]; //Make sure this is not a folder if (SA_AssetDatabase.IsValidFolder(file)) { continue; } if (SA_AssetDatabase.GetExtension(file).Equals(DISABLED_LIB_EXTENSION)) { string newFileName = file.Replace(DISABLED_LIB_EXTENSION, string.Empty); string fileName = SA_AssetDatabase.GetFileName(newFileName); float progress = (float)(i + 1) / (float)files.Count; EditorUtility.DisplayProgressBar("Stan's Assets.", "Installing: " + fileName, progress); SA_AssetDatabase.MoveAsset(file, newFileName); SA_AssetDatabase.ImportAsset(newFileName); } } EditorUtility.ClearProgressBar(); }