public static string[] FindFoldersFiltered(string filter, string[] ignores = null) { string[] files = Directory.GetDirectories("Assets", filter, SearchOption.AllDirectories); int count = files.Length; List <string> paths = new List <string>(count); for (int i = 0; i < count; i++) { string path = files[i]; bool skip = false; if (ignores != null) { skip = CSArrayTools.IsItemContainsAnyStringFromArray(path, ignores); } if (!skip) { paths.Add(path); } } return(paths.ToArray()); }
public static string[] FindAssetsFiltered(string filter, string[] ignores) { string[] allAssetsGUIDs = AssetDatabase.FindAssets(filter); int count = allAssetsGUIDs.Length; List <string> paths = new List <string>(count); for (int i = 0; i < count; i++) { string path = AssetDatabase.GUIDToAssetPath(allAssetsGUIDs[i]); bool skip = false; if (ignores != null) { skip = CSArrayTools.IsItemContainsAnyStringFromArray(path, ignores); } if (!skip) { paths.Add(path); } } return(paths.ToArray()); }