/// <summary> /// 打一个单独的场景包,包的依赖项已经在之前的逻辑中打出来了 /// </summary> /// <param name="scene"></param> /// <returns></returns> static bool BuildScene(SceneInfo scene, BuildTarget buildTarget) { string strOutputPath = scene.GetBundlePath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + scene.sceneName + BUNDLE_EXT; BuildPipeline.BuildStreamedSceneAssetBundle(new string[] { scene.scenePath }, strOutputPath, buildTarget); //生成信息文件 string strPackageInfoFilePath = scene.GetInfoPath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + scene.sceneName + PACKAGE_INFO_EXT; WritePackageInfoFile(strPackageInfoFilePath, scene.ltDepPackages); //生成版本信息文件,依赖项信息要做为md5的一部分 string strVersionFilePath = scene.GetVersionPath(buildTarget); string[] arrVerifyAssests = new string[scene.ltUnpackageAsset.Count + 1]; System.Array.Copy(scene.ltUnpackageAsset.ToArray(), arrVerifyAssests, scene.ltUnpackageAsset.Count); arrVerifyAssests[arrVerifyAssests.Length - 1] = strPackageInfoFilePath; // for (int i = 0; i < scene.ltUnpackageAsset.Count; ++i) // { // arrVerifyAssests[i] = scene.ltUnpackageAsset[i]; // } string strVersion = BuilderTools.GetVerifyString(arrVerifyAssests, null); File.WriteAllText(strVersionFilePath, strVersion); //写入统一的dat文件 string strDataFilePath = scene.GetDataPath(buildTarget);// BuilderTools.GetOutputPath(buildTarget) + scene.sceneName + DATA_EXT; CombineFinalPackage(strPackageInfoFilePath, strOutputPath, strDataFilePath); Debug.Log("writed output file: " + strDataFilePath); return true; }