static IEnumerable GetAssetFiles(string baseDir, SerializedAssetDatabaseBlacklist blacklist) { string[] fileNames = Directory.GetFiles(baseDir); for (int i = 0; i < fileNames.Length; i++) { if (fileNames[i].EndsWith(".meta")) { continue; } if (blacklist.CheckFile(fileNames[i])) { continue; } yield return(fileNames[i]); } string[] directoryNames = Directory.GetDirectories(baseDir); for (int i = 0; i < directoryNames.Length; i++) { if (blacklist.CheckDirectory(directoryNames[i])) { continue; } foreach (string file in GetAssetFiles(directoryNames[i], blacklist)) { yield return(file); } } }
public void RegenerateProjectAssets(SerializedAssetDatabaseBlacklist blacklist = null) { #if UNITY_EDITOR if (blacklist == null) { blacklist = SerializedAssetDatabaseBlacklist.Default; } serializedAssets = new SerializedAssetDictionary(); foreach (string file in GetAssetFiles(@"Assets/", blacklist)) { serializedAssets.Add(file, AssetDatabase.LoadAssetAtPath(file, typeof(Object))); } #endif }