public static void SaveVersionFile(BuildTarget target, ChannelType channel) { string rootPath = PackageUtils.GetBuildPlatformOutputPath(target, channel.ToString()); GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.ResVersionFileName), resVersion); GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.NoticeVersionFileName), resVersion); GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.AppVersionFileName), PlayerSettings.bundleVersion); }
private static void InnerBuildAssetBundles(BuildTarget buildTarget, string channelName, bool writeConfig) { BuildAssetBundleOptions buildOption = BuildAssetBundleOptions.IgnoreTypeTreeChanges | BuildAssetBundleOptions.DeterministicAssetBundle; var outputPath = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName); AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget); if (manifest != null && writeConfig) { AssetsPathMappingEditor.BuildPathMapping(manifest); VariantMappingEditor.BuildVariantMapping(manifest); BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget); } WritePackageNameFile(buildTarget, channelName); WriteAssetBundleSize(buildTarget, channelName); AssetDatabase.Refresh(); }
public static void WriteAssetBundleSize(BuildTarget buildTarget, string channelName) { var outputPath = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName); var allAssetbundles = GameUtility.GetSpecifyFilesInFolder(outputPath, new string[] { ".assetbundle" }); StringBuilder sb = new StringBuilder(); if (allAssetbundles != null && allAssetbundles.Length > 0) { foreach (var assetbundle in allAssetbundles) { FileInfo fileInfo = new FileInfo(assetbundle); int size = (int)(fileInfo.Length / 1024) + 1; var path = assetbundle.Substring(outputPath.Length + 1); sb.AppendFormat("{0}{1}{2}\n", GameUtility.FormatToUnityPath(path), AssetBundleConfig.CommonMapPattren, size); } } string content = sb.ToString().Trim(); GameUtility.SafeWriteAllText(Path.Combine(outputPath, BuildUtils.AssetBundlesSizeFileName), content); }
public static string ReadVersionFile(BuildTarget target, ChannelType channel) { string rootPath = PackageUtils.GetBuildPlatformOutputPath(target, channel.ToString()); return(GameUtility.SafeReadAllText(Path.Combine(rootPath, BuildUtils.ResVersionFileName))); }
public static void WritePackageNameFile(BuildTarget buildTarget, string channelName) { var outputPath = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName); GameUtility.SafeWriteAllText(Path.Combine(outputPath, BuildUtils.PackageNameFileName), channelName); }