Ejemplo n.º 1
0
    void DoCleanup(AddressableAssetSettings settings)
    {
        List <string> directories = new List <string>();

        foreach (var group in m_GeneratedGroups.Values)
        {
            List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>(group.entries);
            foreach (var entry in entries)
            {
                var path = entry.AssetPath;
                AssetDatabase.DeleteAsset(path);
            }

            settings.RemoveGroup(group);
        }
        m_GeneratedGroups.Clear();

        foreach (var group in m_SourceGroupList)
        {
            var schema = group.GetSchema <TextureVariationSchema>();
            if (schema == null)
            {
                continue;
            }

            foreach (var entry in group.entries)
            {
                entry.labels.Remove(schema.BaselineLabel);
            }
        }

        m_SourceGroupList.Clear();
    }
        /// <summary>
        /// 处理移动
        /// </summary>
        /// <param name="assetPath"></param>
        /// <param name="moveFromPath"></param>
        private static void ProcessAssetGroup(string assetPath, string moveFromPath)
        {
            AssetImporter ai = AssetImporter.GetAtPath(assetPath);

            if (ai == null)
            {
                Log.e("Not Find Asset:" + assetPath);
                return;
            }

            string fullPath = EditorUtils.AssetsPath2ABSPath(assetPath);

            if (Directory.Exists(fullPath))
            {
                return;
            }

            if (CheckIsRes4Addresable(assetPath))//如果移动到了另一个资源文件夹
            {
                ProcessAssetGroup(assetPath);
            }
            else
            {
                var guid = AssetDatabase.AssetPathToGUID(assetPath);
                setting.RemoveAssetEntry(guid);
            }

            if (CheckIsRes4Addresable(moveFromPath))
            {
                //处理移动前的Group
                string removeFromGroupName = string.Empty;
                string dirName             = Path.GetDirectoryName(moveFromPath);
                string assetBundleName     = EditorUtils.AssetPath2ReltivePath(dirName).ToLower();
                assetBundleName = assetBundleName.Replace("addressableres/", "");

                if (moveFromPath.Contains("FolderMode"))
                {
                    removeFromGroupName = assetBundleName;
                }
                else
                {
                    removeFromGroupName = setting.DefaultGroup.name;
                }
                removeFromGroupName = removeFromGroupName.Replace("/", "-");
                //Debug.LogError("removeFromGroupName:" + removeFromGroupName);
                var group = setting.FindGroup(removeFromGroupName);
                if (group != null)
                {
                    if (group.entries.Count == 0)
                    {
                        setting.RemoveGroup(group);
                    }
                }
            }

            //EditorUtility.SetDirty(setting);
        }
Ejemplo n.º 3
0
    void RemoveGroup(string groupName)
    {
        string guid = AssetDatabase.FindAssets("t:AddressableAssetSettings").FirstOrDefault();
        string path = AssetDatabase.GUIDToAssetPath(guid);
        AddressableAssetSettings settings = AssetDatabase.LoadAssetAtPath <AddressableAssetSettings>(path);
        AddressableAssetGroup    target   = settings.groups.Find(c => c.name == groupName);

        settings.RemoveGroup(target);
    }
Ejemplo n.º 4
0
 private static void CleanGroup(AddressableAssetSettings settings)
 {
     foreach (AddressableAssetGroup group in settings.groups.ToArray())
     {
         if (group.name == "Built In Data" || group.name == "Default Local Group")
         {
             continue;
         }
         settings.RemoveGroup(group);
     }
 }
Ejemplo n.º 5
0
        public void RemoveGroup(string groupGuid)
        {
            var group = _settings.FindGroup(x => x.Guid.Equals(groupGuid));

            if (group == null)
            {
                throw new Exception(
                          $"Failed to get {nameof(AddressableAssetGroup)} (GUID:{groupGuid}) because it does not exists.");
            }

            _settings.RemoveGroup(group);
        }
Ejemplo n.º 6
0
    void DoCleanup(AddressableAssetSettings settings)
    {
        List <string> directories = new List <string>();

        foreach (var group in m_GeneratedGroups.Values)
        {
            if (group.HasSchema <TextureVariationSchema>())
            {
                List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>(group.entries);
                foreach (var entry in entries)
                {
                    var path = entry.AssetPath;
                    AssetDatabase.DeleteAsset(path);
                }
            }

            settings.RemoveGroup(group);
            if (Directory.Exists(m_BaseDirectory) && group.HasSchema <PrefabTextureVariantSchema>())
            {
                foreach (var directory in Directory.EnumerateDirectories(m_BaseDirectory, "*", SearchOption.AllDirectories))
                {
                    string formattedDirectory = directory.Replace('\\', '/');
                    if (m_DirectoriesInUse.Contains(formattedDirectory))
                    {
                        continue;
                    }
                    Directory.Delete(formattedDirectory, true);
                }
            }
        }

        m_DirectoriesInUse.Clear();
        m_GeneratedGroups.Clear();

        foreach (AddressableAssetGroup group in m_SourceGroupList)
        {
            group.GetSchema <BundledAssetGroupSchema>().IncludeInBuild = true;

            var schema = group.GetSchema <TextureVariationSchema>();
            if (schema == null)
            {
                continue;
            }

            foreach (var entry in group.entries)
            {
                entry.labels.Remove(schema.BaselineLabel);
            }
        }

        m_SourceGroupList.Clear();
    }
Ejemplo n.º 7
0
        public static void RemoveAllGroup()
        {
            AddressableAssetSettings     settings = GetSettings();
            List <AddressableAssetGroup> groups   = settings.groups;

            for (int i = groups.Count - 1; i >= 0; i--)
            {
                if (groups[i].IsDefaultGroup())
                {
                    continue;
                }
                settings.RemoveGroup(groups[i]);
            }
        }
Ejemplo n.º 8
0
        public static List <AddressableAssetEntry> GetResourcesEntries(AddressableAssetSettings settings,
                                                                       bool recurseAll, Func <AddressableAssetEntry, bool> filter = null)
        {
            var group = settings.CreateGroup("FindResources", false, false, false,
                                             new List <AddressableAssetGroupSchema>(), typeof(PlayerDataGroupSchema));

            group.GetSchema <PlayerDataGroupSchema>().IncludeResourcesFolders = true;
            var entry = settings.CreateEntry("empty", "empty", group, false);
            List <AddressableAssetEntry> entries = new List <AddressableAssetEntry>();

            entry.GatherResourcesEntries(entries, recurseAll, filter);
            group.RemoveAssetEntry(entry);
            settings.RemoveGroup(group);
            return(entries);
        }
Ejemplo n.º 9
0
    internal static void UpdateWordLibrary()
    {
        string groupName = "WordLibrary";

        UnityEditor.EditorUtility.DisplayCancelableProgressBar("更新词库...", "", 0);
        AddressableAssetSettings aaSettings = AddressableAssetSettingsDefaultObject.GetSettings(false);
        AddressableAssetGroup    group      = null;

        group = aaSettings.groups.Find(x => x.Name == groupName);
        if (group != null)
        {
            aaSettings.RemoveGroup(group);
            group = null;
        }

        group = aaSettings.CreateGroup(groupName, false, false, false, null);
        group.AddSchema <BundledAssetGroupSchema>();

        string levelDir = string.Format("{0}/AssetsPackage/AnsycLoad/CodyLevel", Application.dataPath);

        if (!Directory.Exists(levelDir))
        {
            Debug.LogError("路径不存在 " + levelDir);
            Directory.CreateDirectory(levelDir);
        }
        else
        {
            var files = Directory.GetFiles(levelDir);
            var index = 0;
            foreach (var item in files)
            {
                index++;
                UnityEditor.EditorUtility.DisplayCancelableProgressBar("更新词库...", Path.GetFileName(item), index / (float)files.Length);
                var extention = Path.GetExtension(item);
                if (extention.Equals(".txt"))
                {
                    string guid = AssetDatabase.AssetPathToGUID(string.Format("Assets/AssetsPackage/AnsycLoad/CodyLevel/{0}",
                                                                              Path.GetFileName(item)));
                    AddressableAssetEntry entity = aaSettings.CreateOrMoveEntry(guid, group);
                    entity.SetAddress(Path.GetFileName(item));
                    bool result = entity.SetLabel("WordLibrary", true);
                    Debug.Log("set label result " + result);
                }
            }
        }

        UnityEditor.EditorUtility.ClearProgressBar();
    }
Ejemplo n.º 10
0
        private static void BuildGroup(string groupFolder, AddressableAssetSettings settings, List <AddressableAssetGroupSchema> schemas)
        {
            List <string> assetPaths = Directory.EnumerateFiles(groupFolder, "*.*", SearchOption.AllDirectories)
                                       .Where(p => Path.GetExtension(p) != ".meta")
                                       .Select(p => p.Substring(UnityEngine.Application.dataPath.Length - 6))
                                       .ToList();

            if (assetPaths.Count < 1)
            {
                return;
            }
            string groupName = groupFolder.Substring(groupFolder.LastIndexOf('/') + 1);

            if (groupName.StartsWith("~") || groupName == "Resources")
            {
                return;
            }
            AddressableAssetGroup group = settings.FindGroup(groupName);

            if (group != null)
            {
                settings.RemoveGroup(group);
            }
            group = settings.CreateGroup(groupName, false, false, true, schemas);
            foreach (string path in assetPaths)
            {
                string address = Path.GetFileNameWithoutExtension(path);
                if (address.StartsWith("~"))
                {
                    continue;
                }
                if (address == tempAddress)
                {
                    Log.Info($"Address重复->{address}");
                }
                var enity = settings.CreateOrMoveEntry(AssetDatabase.AssetPathToGUID(path), group);
                enity.SetAddress(address);
                enity.SetLabel("default", true);


                tempAddress = address;
            }

            if (groupName == "Default Local Group")
            {
                settings.DefaultGroup = group;
            }
        }
        /// <summary>
        /// Updates the group the asset should belong to.
        /// Assets will be stored in groups for the Locale they are used by unless they are used
        /// by more than 1 <see cref="Locale"/>, then they will be moved to the shared group.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="assetEntry"></param>
        /// <param name="createUndo">Used to indicate if an Undo operation should be created.</param>
        protected virtual void UpdateAssetGroup(AddressableAssetSettings settings, AddressableAssetEntry assetEntry, bool createUndo)
        {
            if (settings == null || assetEntry == null)
            {
                return;
            }

            // Find all the locales that are using the asset using the Addressable labels.
            var localesUsingAsset = ListPool <LocaleIdentifier> .Get();

            foreach (var label in assetEntry.labels)
            {
                if (AddressHelper.TryGetLocaleLabelToId(label, out var id))
                {
                    localesUsingAsset.Add(id);
                }
            }

            // If no Locales depend on this asset then we can just remove it
            if (localesUsingAsset.Count == 0)
            {
                var oldGroup = assetEntry.parentGroup;
                settings.RemoveAssetEntry(assetEntry.guid);
                if (oldGroup.entries.Count == 0)
                {
                    if (createUndo)
                    {
                        // We cant use undo asset deletion so we will leave an empty group instead of deleting it.
                        Undo.RecordObject(oldGroup, "Remove group");
                    }
                    else
                    {
                        settings.RemoveGroup(oldGroup);
                    }
                }

                ListPool <LocaleIdentifier> .Release(localesUsingAsset);

                return;
            }

            AddressableGroupRules.AddAssetToGroup(assetEntry.MainAsset, localesUsingAsset, settings, createUndo);
        }
Ejemplo n.º 12
0
    private static void GenerateWithGroupRule(AddressableAssetSettings settings, GenerateSetting generateSetting, GroupRule groupRule)
    {
        AddressableAssetGroup oldGroup = settings.FindGroup(groupRule.GroupName);
        AddressableAssetGroup group;

        if (generateSetting.RecreateGroup)
        {
            if (oldGroup)
            {
                settings.RemoveGroup(oldGroup);
                oldGroup = null;
            }
            group = settings.CreateGroup(groupRule.GroupName, false, false, true, groupRule.SchemasToCopy);
        }
        else
        {
            if (oldGroup)
            {
                group = oldGroup;
            }
            else
            {
                group = settings.CreateGroup(groupRule.GroupName, false, false, true, groupRule.SchemasToCopy);
            }
        }

        if (generateSetting.ApplyAssetRule)
        {
            for (int iAssetRule = 0; iAssetRule < groupRule.AssetRules.Length; iAssetRule++)
            {
                AssetRule iterAssetRule = groupRule.AssetRules[iAssetRule];
                GenerateWithAssetRule(settings, generateSetting, group, groupRule, iterAssetRule);
            }
        }

        if (generateSetting.RemoveInvalidAsset)
        {
            RemoveInvalidAsset(group);
        }
    }
Ejemplo n.º 13
0
    public static void AddFileToAddressables()
    {
        AddressablesRules rules = new AddressablesRules();
        Dictionary <string, BuildAddressablesData> bundles = rules.GetBuilds();
        AddressableAssetSettings aaSettings = AddressableAssetSettingsDefaultObject.GetSettings(false);
        AddressableAssetGroup    group      = null;

        //清理错误group
        for (int i = aaSettings.groups.Count - 1; i >= 0; i--)
        {
            var g = aaSettings.groups[i];
            if (g == null || g.entries.Count == 0)
            {
                aaSettings.RemoveGroup(g);
                g = null;
                continue;
            }
            //
            // if (g != null)
            // {
            //     g.Name = $"{g.Name}_delete";
            // }
        }

        foreach (string key in bundles.Keys)
        {
            group = aaSettings.groups.Find(x => x.Name == bundles[key].GroupName);
            if (group == null)
            {
                group = aaSettings.CreateGroup(bundles[key].GroupName, false, false, false, null);
            }

            BundledAssetGroupSchema schema = group.GetSchema <BundledAssetGroupSchema>();
            if (schema == null)
            {
                schema = group.AddSchema <BundledAssetGroupSchema>();
            }

            ContentUpdateGroupSchema contentUpdateGroupSchema = group.GetSchema <ContentUpdateGroupSchema>();
            if (contentUpdateGroupSchema == null)
            {
                contentUpdateGroupSchema = group.AddSchema <ContentUpdateGroupSchema>();
            }

            schema.Compression = BundledAssetGroupSchema.BundleCompressionMode.LZ4;
            if (bundles[key].packageType == "PackSeparately")
            {
                schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackSeparately;
            }
            else if (bundles[key].packageType == "PackTogether")
            {
                schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogether;
            }
            else if (bundles[key].packageType == "PackTogetherByLabel")
            {
                schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogetherByLabel;
            }

            schema.IncludeInBuild      = true;
            schema.UseAssetBundleCache = true;
            schema.UseAssetBundleCrc   = false;
            schema.UseAssetBundleCrcForCachedBundles = false;

            if (bundles[key].ResType == "online")
            {
                schema.BuildPath.SetVariableByName(group.Settings, AddressableAssetSettings.kRemoteBuildPath);
                schema.LoadPath.SetVariableByName(group.Settings, AddressableAssetSettings.kRemoteLoadPath);
                schema.BundleNaming      = BundledAssetGroupSchema.BundleNamingStyle.AppendHash;
                schema.UseAssetBundleCrc = true;
                contentUpdateGroupSchema.StaticContent = false;
            }
            else
            {
                schema.BuildPath.SetVariableByName(group.Settings, AddressableAssetSettings.kLocalBuildPath);
                schema.LoadPath.SetVariableByName(group.Settings, AddressableAssetSettings.kLocalLoadPath);
                schema.BundleNaming = BundledAssetGroupSchema.BundleNamingStyle.NoHash;
                contentUpdateGroupSchema.StaticContent = true;
            }
        }

        foreach (string key in bundles.Keys)
        {
            int count    = 0;
            int MaxCount = bundles[key].entitys.Count;
            group = aaSettings.groups.Find(x => x.Name == bundles[key].GroupName);
            foreach (string entitysKey in bundles[key].entitys.Keys)
            {
                count++;
                if (count % 3 == 0)
                {
                    if (UnityEditor.EditorUtility.DisplayCancelableProgressBar(string.Format("Collecting... [{0}/{1}]", count, MaxCount), entitysKey,
                                                                               count * 1f / MaxCount))
                    {
                        break;
                    }
                }

                string guid = AssetDatabase.AssetPathToGUID(bundles[key].entitys[entitysKey].filestring);
                AddressableAssetEntry entity = aaSettings.CreateOrMoveEntry(guid, group);
                entity.SetAddress(entitysKey);
                for (int i = 0; i < bundles[key].Lable.Length; i++)
                {
                    if (bundles[key].Lable[i].Contains("#"))
                    {
                        if (!string.IsNullOrEmpty(bundles[key].entitys[entitysKey].folderlabel))
                        {
                            aaSettings.AddLabel(bundles[key].entitys[entitysKey].folderlabel);
                            entity.SetLabel(bundles[key].entitys[entitysKey].folderlabel, true);
                        }
                    }
                    else
                    {
                        aaSettings.AddLabel(bundles[key].Lable[i]);
                        entity.SetLabel(bundles[key].Lable[i], true);
                    }
                }
            }
        }
        // for (int i = aaSettings.groups.Count - 1; i >= 0; i--)
        // {
        //     var g = aaSettings.groups[i];
        //     if (g == null || g.entries.Count == 0)
        //     {
        //         aaSettings.RemoveGroup(g);
        //         g = null;
        //         continue;
        //     }
        //
        //     if (g != null)
        //     {
        //         if (g.Name.Contains("_delete"))
        //         {
        //             aaSettings.RemoveGroup(g);
        //             g = null;
        //         }
        //     }
        // }
        UnityEditor.EditorUtility.ClearProgressBar();
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Updates the group the asset should belong to.
        /// Assets will be stored in groups for the Locale they are used by unless they are used
        /// by more than 1 <see cref="Locale"/>, then they will be moved to the shared group.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="assetEntry"></param>
        /// <param name="createUndo">Used to indicate if an Undo operation should be created.</param>
        protected virtual void UpdateAssetGroup(AddressableAssetSettings settings, AddressableAssetEntry assetEntry, bool createUndo)
        {
            if (settings == null || assetEntry == null)
            {
                return;
            }

            // Find all the locales that are using the asset using the Addressable labels.
            var localesUsingAsset = assetEntry.labels.Where(AddressHelper.IsLocaleLabel);

            if (localesUsingAsset.Count() == 0)
            {
                var oldGroup = assetEntry.parentGroup;
                settings.RemoveAssetEntry(assetEntry.guid);
                if (oldGroup.entries.Count == 0)
                {
                    if (createUndo)
                    {
                        // We cant use undo asset deletion so we will leave an empty group instead of deleting it.
                        Undo.RecordObject(oldGroup, "Remove group");
                    }
                    else
                    {
                        settings.RemoveGroup(oldGroup);
                    }
                }

                return;
            }

            AddressableAssetGroup newGroup;

            if (localesUsingAsset.Count() == 1)
            {
                // If only 1 locale is using the asset then we will add it to a locale specific group.
                var localeId = AddressHelper.LocaleLabelToId(localesUsingAsset.First());
                newGroup = LocalizationEditorSettings.Instance.GetGroup(settings, FormatAssetTableCollectionName(localeId), true, createUndo);
            }
            else
            {
                // More than one locale uses the asset so it goes to the shared assets group.
                newGroup = LocalizationEditorSettings.Instance.GetGroup(settings, LocalizationEditorSettings.SharedAssetGroupName, true, createUndo);
            }

            // Do we need to change the asset's group?
            if (newGroup != assetEntry.parentGroup)
            {
                if (createUndo)
                {
                    Undo.RecordObject(newGroup, "Update asset group");
                    Undo.RecordObject(assetEntry.parentGroup, "Update asset group");
                }

                var oldGroup = assetEntry.parentGroup;
                settings.MoveEntry(assetEntry, newGroup, true);
                if (oldGroup.entries.Count == 0)
                {
                    // We only delete the asset when not creating an undo as we can not undo asset deletion.
                    if (!createUndo)
                    {
                        settings.RemoveGroup(oldGroup);
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public override void FixIssues(AddressableAssetSettings settings)
        {
            // Load template used for creating new groups

            var groupTemplates = settings.GroupTemplateObjects;
            AddressableAssetGroupTemplate foundTemplate = null;

            foreach (var template in groupTemplates)
            {
                if (template.name == templateToUse)
                {
                    foundTemplate = template as AddressableAssetGroupTemplate;
                    break;
                }
            }

            if (foundTemplate == null)
            {
                Debug.Log("Group template \"" + templateToUse + "\" not found. Aborting!");
                return;
            }

            // Create groups

            foreach (var groupName in groupsToCreate)
            {
                // I don't know enough about schemas, so schemasToCopy is set to null here.
                AddressableAssetGroup newGroup = settings.CreateGroup(groupName, false, false, true, null, foundTemplate.GetTypes());
                foundTemplate.ApplyToAddressableAssetGroup(newGroup);
            }

            // Remove groups

            foreach (var groupName in groupsToRemove)
            {
                foreach (var group in settings.groups)
                {
                    if (group.name == groupName)
                    {
                        settings.RemoveGroup(group);
                        break;
                    }
                }
            }

            // Collect current group names

            Dictionary <string, AddressableAssetGroup> groups = new Dictionary <string, AddressableAssetGroup>();

            foreach (var group in settings.groups)
            {
                groups.Add(group.name, group);
            }

            // Create and remove assets

            foreach (var action in assetActions)
            {
                if (!groups.ContainsKey(action.inGroup))
                {
                    continue;
                }

                if (action.create)
                {
                    AddressableAssetEntry entry = settings.CreateOrMoveEntry(action.assetGuid, groups[action.inGroup]);
                    entry.SetAddress(action.addressablePath);
                }
                else
                {
                    AddressableAssetEntry entry = settings.FindAssetEntry(action.assetGuid);
                    if (entry != null)
                    {
                        settings.RemoveAssetEntry(action.assetGuid);
                    }
                    else
                    {
                        Debug.Log("Asset guid didn't produce an entry: " + action.assetGuid);
                    }
                }
            }

            ClearAnalysis();
            ClearOurData();
        }
        public static void AddFileToAddressables()
        {
            AddressablesRules rules = new AddressablesRules();
            Dictionary <string, BuildAddressablesData> bundles = rules.GetBuilds();
            AddressableAssetSettings aaSettings = AddressableAssetSettingsDefaultObject.GetSettings(false);
            AddressableAssetGroup    group      = null;

            //清理重名group
            foreach (string key in bundles.Keys)
            {
                group = aaSettings.groups.Find(x => x.Name == bundles[key].GroupName);
                if (group != null)
                {
                    aaSettings.RemoveGroup(group);
                    group = null;
                }
            }

            foreach (string key in bundles.Keys)
            {
                group = aaSettings.groups.Find(x => x.Name == bundles[key].GroupName);
                if (group == null)
                {
                    if (bundles[key].ResType == "online")
                    {
                        group = aaSettings.CreateGroup(bundles[key].GroupName, false, false, false, null);
                        BundledAssetGroupSchema schema = group.AddSchema <BundledAssetGroupSchema>();
                        schema.Compression = BundledAssetGroupSchema.BundleCompressionMode.LZ4;
                        if (bundles[key].packageType == "PackSeparately")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackSeparately;
                        }
                        else if (bundles[key].packageType == "PackTogether")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogether;
                        }
                        else if (bundles[key].packageType == "PackTogetherByLabel")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogetherByLabel;
                        }
                        schema.BuildPath.SetVariableByName(group.Settings, AddressableAssetSettings.kRemoteBuildPath);
                        schema.LoadPath.SetVariableByName(group.Settings, AddressableAssetSettings.kRemoteLoadPath);
                        schema.UseAssetBundleCache = true;
                        schema.UseAssetBundleCrc   = true;
                        ContentUpdateGroupSchema contentUpdateGroupSchema = group.AddSchema <ContentUpdateGroupSchema>();
                        contentUpdateGroupSchema.StaticContent = false;
                        group = null;
                    }
                    else
                    {
                        group = aaSettings.CreateGroup(bundles[key].GroupName, false, false, false, null);
                        BundledAssetGroupSchema schema = group.AddSchema <BundledAssetGroupSchema>();
                        schema.Compression = BundledAssetGroupSchema.BundleCompressionMode.Uncompressed;
                        if (bundles[key].packageType == "PackSeparately")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackSeparately;
                        }
                        else if (bundles[key].packageType == "PackTogether")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogether;
                        }
                        else if (bundles[key].packageType == "PackTogetherByLabel")
                        {
                            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogetherByLabel;
                        }

                        if (bundles[key].canUpdate)
                        {
                            ContentUpdateGroupSchema contentUpdateGroupSchema = group.AddSchema <ContentUpdateGroupSchema>();
                            contentUpdateGroupSchema.StaticContent = false;
                        }

                        schema.UseAssetBundleCache = true;
                        schema.UseAssetBundleCrc   = true;
                        group = null;
                    }
                }
            }


            foreach (string key in bundles.Keys)
            {
                int count    = 0;
                int MaxCount = bundles[key].entitys.Count;
                group = aaSettings.groups.Find(x => x.Name == bundles[key].GroupName);
                foreach (string entitysKey in bundles[key].entitys.Keys)
                {
                    count++;
                    if (count % 3 == 0)
                    {
                        if (UnityEditor.EditorUtility.DisplayCancelableProgressBar(
                                string.Format("Collecting... [{0}/{1}]", count, MaxCount), entitysKey,
                                count * 1f / MaxCount))
                        {
                            break;
                        }
                    }

                    string guid = AssetDatabase.AssetPathToGUID(bundles[key].entitys[entitysKey]);
                    AddressableAssetEntry entity = aaSettings.CreateOrMoveEntry(guid, group);
                    entity.SetAddress(entitysKey);
                    for (int i = 0; i < bundles[key].Lable.Length; i++)
                    {
                        aaSettings.AddLabel(bundles[key].Lable[i]);
                        entity.SetLabel(bundles[key].Lable[i], true);
                    }
                }
            }

            UnityEditor.EditorUtility.ClearProgressBar();
        }