private void ReadAssetDatabase(string assetFolderRootPath, TreeViewItem parent, int baseDepth)
{
// Read from Assets directory
IHierarchyProperty property = new HierarchyProperty(assetFolderRootPath);
property.Reset();
Texture2D folderIcon = EditorGUIUtility.FindTexture(EditorResources.folderIconName);
Texture2D emptyFolderIcon = EditorGUIUtility.FindTexture(EditorResources.emptyFolderIconName);
List <TreeViewItem> allFolders = new List <TreeViewItem>();
while (property.Next(null))
{
if (property.isFolder)
{
TreeViewItem folderItem = new TreeViewItem(property.instanceID, baseDepth + property.depth, null, property.name);
folderItem.icon = property.hasChildren ? folderIcon : emptyFolderIcon;
allFolders.Add(folderItem);
}
}
// Fix references
TreeViewUtility.SetChildParentReferences(allFolders, parent);
}