public void RecountTypes()
        {
            var treeElements = new List <AssetTreeElement>();

            TreeElementUtility.TreeToList <AssetTreeElement>(treeView.treeModel.root, treeElements);

            List <AssetTreeElement> Types = new List <AssetTreeElement>();

            foreach (TreeElement t in treeView.treeModel.root.children)
            {
                AssetTreeElement ate = t as AssetTreeElement;
                ate.IsResourceCount = 0;
                ate.IsAddrCount     = 0;
                ate.Keepcount       = 0;
                if (t.hasChildren)
                {
                    foreach (TreeElement c in t.children)
                    {
                        AssetItem ai = (c as AssetTreeElement).ai;
                        if (ai.IsResource)
                        {
                            ate.IsResourceCount++;
                        }
                        if (ai.IsAlwaysLoaded)
                        {
                            ate.Keepcount++;
                        }
                        if (ai.IsAddressable)
                        {
                            ate.IsAddrCount++;
                        }
                    }
                }
            }
        }
        IList <AssetTreeElement> GetData()
        {
            LoadedLabels = new HashSet <string>();

            eLoaded    itemstoload  = (eLoaded)LoadedItems;
            eShowTypes typesToShow  = (eShowTypes)ShowIndex;
            int        totalitems   = 0;
            var        treeElements = new List <AssetTreeElement>();

            var root = new AssetTreeElement("Root", -1, totalitems);

            treeElements.Add(root);

            System.Type[] Types = UAI.GetTypes();


            // Preprocess to get labels (we need to filter on them later).
            foreach (System.Type t in Types)
            {
                if (t != typeof(AnimatorController) && t != typeof(AnimatorOverrideController))                 // Somewhere, a kitten died because I typed that.
                {
                    Dictionary <string, AssetItem> TypeDic = UAI.GetAssetDictionary(t);
                    AssetItem[] items = new AssetItem[TypeDic.Values.Count];
                    TypeDic.Values.CopyTo(items, 0);

                    List <AssetTreeElement> ElementsToLoad = new List <AssetTreeElement>();
                    for (int i = 0; i < TypeDic.Values.Count; i++)
                    {
                        AssetItem ai = items[i];
                        AddLabels(ai);
                    }
                }
            }



            foreach (System.Type t in Types)
            {
                if (t != typeof(AnimatorController) && t != typeof(AnimatorOverrideController))                 // Somewhere, a kitten died because I typed that.
                {
                    Dictionary <string, AssetItem> TypeDic = UAI.GetAssetDictionary(t);

                    AssetTreeElement ate = new AssetTreeElement(t.Name, 0, ++totalitems);
                    ate.type = t;
                    AssetItem[] items = new AssetItem[TypeDic.Values.Count];
                    TypeDic.Values.CopyTo(items, 0);

                    List <AssetTreeElement> ElementsToLoad = new List <AssetTreeElement>();
                    for (int i = 0; i < TypeDic.Values.Count; i++)
                    {
                        AssetItem ai = items[i];
                        if (ShouldLoad(itemstoload, ai))
                        {
                            AssetTreeElement atai = new AssetTreeElement(ai._Name, 1, ++totalitems);
                            atai.ai    = ai;
                            atai.index = i;
                            atai.type  = t;
                            ElementsToLoad.Add(atai);

                            if (ai.IsResource)
                            {
                                ate.IsResourceCount++;
                            }
                            if (ai.IsAlwaysLoaded)
                            {
                                ate.Keepcount++;
                            }
                            if (ai.IsAddressable)
                            {
                                ate.IsAddrCount++;
                            }
                        }
                    }

                    if (ElementsToLoad.Count < 1)
                    {
                        if (typesToShow == eShowTypes.WithItems || itemstoload == eLoaded.SelectedOnly)
                        {
                            continue;
                        }
                    }

                    treeElements.Add(ate);
                    treeElements.AddRange(ElementsToLoad);
                }
            }
            LoadOnly.Clear();
            return(treeElements);
            // generate some test data
            //return MyTreeElementGenerator.GenerateRandomTree(130);
        }