private void SearchInFolders(string filter, string[] folder) { var property = new HierarchyProperty(HierarchyType.Assets); var searchFilter = typeof(EditorWindow).Assembly.CreateInstance("UnityEditor.SearchFilter"); ParseSearchString(filter, searchFilter); searchBuf.Clear(); foreach (string folderPath in folder) { // Set empty filter to ensure we search all assets to find folder SetSearchFilter(property, typeof(EditorWindow).Assembly.CreateInstance("UnityEditor.SearchFilter")); int folderInstanceID = GetMainAssetInstanceID(folderPath); if (property.Find(folderInstanceID, null)) { // Set filter after we found the folder SetSearchFilter(property, searchFilter); int folderDepth = property.depth; int[] expanded = null; // enter all children of folder while (property.NextWithDepthCheck(expanded, folderDepth + 1)) { searchBuf.Add(new SearchBuf { name = property.name, instanceID = property.instanceID }); } } else { L12Debug.EditorLogError("AssetDatabase.FindAssets: Folder not found: '" + folderPath + "'"); } } }