Example #1
0
    private static void SetGroupsSetting(AddressableAssetGroup group,
                                         bool UseAssetBundleCache,
                                         bool UseAssetBundleCrc,
                                         BundledAssetGroupSchema.BundleNamingStyle BundleNaming,
                                         string BuildPath,
                                         string LoadPath,
                                         bool StaticContent)
    {
        BundledAssetGroupSchema bundledAssetGroupSchema = group.GetSchema <BundledAssetGroupSchema>();

        if (bundledAssetGroupSchema == null)
        {
            bundledAssetGroupSchema = group.AddSchema <BundledAssetGroupSchema>();
        }
        //bundledAssetGroupSchema.IncludeInBuild = true;
        bundledAssetGroupSchema.UseAssetBundleCache = UseAssetBundleCache;
        bundledAssetGroupSchema.UseAssetBundleCrc   = UseAssetBundleCrc;
        bundledAssetGroupSchema.BundleNaming        = BundleNaming;
        bundledAssetGroupSchema.BuildPath.SetVariableByName(group.Settings, BuildPath);
        bundledAssetGroupSchema.LoadPath.SetVariableByName(group.Settings, LoadPath);
        bundledAssetGroupSchema.SetAssetBundleProviderType(typeof(AssetBundleEncryptProvider));
        EditorUtility.SetDirty(bundledAssetGroupSchema);


        ContentUpdateGroupSchema contentUpdateGroupSchema = group.GetSchema <ContentUpdateGroupSchema>();

        if (contentUpdateGroupSchema == null)
        {
            contentUpdateGroupSchema = group.AddSchema <ContentUpdateGroupSchema>();
        }
        contentUpdateGroupSchema.StaticContent = StaticContent;
        EditorUtility.SetDirty(contentUpdateGroupSchema);
    }
Example #2
0
    private static void SetAllGroupsToAssetBundleEncryptProvider()
    {
        AddressableAssetSettings settings = AASUtility.GetSettings();

        foreach (var group in settings.groups)
        {
            BundledAssetGroupSchema bundledAssetGroupSchema = group.GetSchema <BundledAssetGroupSchema>();
            if (bundledAssetGroupSchema == null)
            {
                bundledAssetGroupSchema = group.AddSchema <BundledAssetGroupSchema>();
            }
            bundledAssetGroupSchema.SetAssetBundleProviderType(typeof(AssetBundleEncryptProvider));
            EditorUtility.SetDirty(bundledAssetGroupSchema);
        }
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }