예제 #1
0
        public static void BuildAssetBundles(BuildTarget buildTarget, string inputProjectTag)
        {
            if (string.IsNullOrEmpty(inputProjectTag))
            {
                projectTag = "putaogame";
            }
            else
            {
                projectTag = inputProjectTag;
            }
            SetProjectTag();

            // Choose the output path according to the build target.
            string outputPath = Path.Combine(QResSystemMark.AssetBundlesOutputPath, GetPlatformName());

            outputPath = outputPath + "/" + projectTag;

            IOUtils.CreateDirIfNotExists(outputPath);

            BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.ChunkBasedCompression, buildTarget);

            List <string> finalzips  = PackZips(outputPath);
            List <string> finalFiles = PackQFiles(outputPath);

            GenerateVersionConfig(outputPath, finalzips, finalFiles);

            string finalDir = Application.streamingAssetsPath + "/AssetBundles/" + GetPlatformName() + "/" + projectTag;

            IOUtils.DeleteDirIfExists(finalDir);

            IOUtils.CreateDirIfNotExists(finalDir);

            FileUtil.ReplaceDirectory(outputPath, finalDir);

            AssetBundleExporter.BuildDataTable();

            AssetDatabase.Refresh();
        }