Esempio n. 1
0
        static void BuildAssetBundleInternal(CompressType type)
        {
            var outputPath = SamplePathUtility.GetAssetBundleDirectory(type);

            if (!Directory.Exists(outputPath))
            {
                Directory.CreateDirectory(outputPath);
            }

            var options = BuildAssetBundleOptions.None;

            switch (type)
            {
            case CompressType.Uncompressed:
                options |= BuildAssetBundleOptions.UncompressedAssetBundle;
                break;

            case CompressType.LZ4:
                options |= BuildAssetBundleOptions.ChunkBasedCompression;
                break;
            }

            BuildPipeline.BuildAssetBundles(outputPath, options, EditorUserBuildSettings.activeBuildTarget);
            AssetDatabase.Refresh();
            Debug.Log($"Complete BuildAssetBundleInternal({type})");
        }
Esempio n. 2
0
        static void EncryptAssetBundleInternal(CompressType type)
        {
            // 非暗号化AssetBundleをbyte[]化 → 暗号化を掛けていく
            var path  = SamplePathUtility.GetAssetBundlePath(type, false);
            var bytes = File.ReadAllBytes(path);

            var exportDir      = SamplePathUtility.GetAssetBundleDirectory(type);
            var exportFileName = SamplePathUtility.EncryptedPrefix + SamplePathUtility.SampleAssetBundleName;

            EncryptHelper.ExportEncryptBinary(bytes, exportDir + exportFileName);
            AssetDatabase.Refresh();
            Debug.Log($"Complete EncryptAssetBundleInternal({type})");
        }