void BuildAnimatorController(AssetObjectPack animationPack)
        {
            InitializeUsedLists();



            float t = Time.realtimeSinceStartup;

            // Dictionary<int, string> id2File;
            // string[] allPaths = AssetObjectsEditor.GetAllAssetObjectPaths(animationPack.dir, animationPack.extensions, true, out id2File);

            //filter out unused file paths
            // IEnumerable<int> used_ids;
            IEnumerable <AssetObject> usedAOs = GetAllUsedAssetObjects(PacksManager.Name2ID(animationsPackName));//, out used_ids);

            // if (used_ids.Count() == 0) return;
            // allPaths = allPaths.Where(f => used_ids.Contains(AssetObjectsEditor.GetObjectIDFromPath(f))).ToArray();



            Debug.Log("Time getting paths: " + (Time.realtimeSinceStartup - t));
            //t = Time.realtimeSinceStartup;


            HashSet <ClipIDPair> clipIDPairs = BuildClipIDPairs(usedAOs);//, id2File);


            // int c = allPaths.Length;
            ControllerBuild(clipIDPairs);//, c);

            Debug.Log("Controller built at: " + saveDirectory + "AnimationsController.controller");
        }
        void OnWizardCreate()
        {
            PacksManager packs = PacksManager.instance;// AssetObjectsEditor.packManager;

            if (packs == null)
            {
                Debug.LogError("Couldnt find pack manager");
                return;
            }

            if (!saveDirectory.EndsWith("/"))
            {
                saveDirectory += "/";
            }

            bool foundPack = false;

            for (int i = 0; i < packs.packs.Length; i++)
            {
                if (packs.packs[i].name == animationsPackName)
                {
                    BuildAnimatorController(packs.packs[i]);
                    foundPack = true;
                    break;
                }
            }
            if (!foundPack)
            {
                Debug.LogError("Couldnt find pack named: " + animationsPackName);
            }
        }
        IEnumerable <AssetObject> GetAllUsedAssetObjects(int packID)
        {
            List <AssetObject> used = new List <AssetObject>();

            IEnumerable <Event> allEvents = EditorUtils.GetAllAssetsOfType <Event>();

            foreach (var e in allEvents)
            {
                if (e.mainPackID == packID)
                {
                    for (int i = 0; i < e.allStates.Length; i++)
                    {
                        GetAOs(e.allStates[i], used);//, packID);
                    }
                }
            }
            if (used.Count == 0)
            {
                Debug.LogWarning("no IDs used for " + PacksManager.ID2Name(packID) + " pack!");
            }
            return(used);
        }