private void MergeFolders(AssetFolderInfo from, ProjectItem to, int ordinal) { if (from.hasChildren) { for (int i = 0; i < from.children.Count; ++i) { AssetFolderInfo childFrom = (AssetFolderInfo)from.children[i]; if (to.Children == null) { to.Children = new List <ProjectItem>(); } ProjectItem childTo = to.Children.Where(item => item.Name == childFrom.name && !(item is AssetItem)).FirstOrDefault(); if (childTo == null) { childTo = new ProjectItem(); to.Children.Add(childTo); } childTo.Name = childFrom.name; childTo.ItemID = m_assetDB.ToStaticFolderID(ordinal, childFrom.id); childTo.Parent = to; MergeFolders(childFrom, childTo, ordinal); } } MergeAssets(from, to, ordinal); }