public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); DateTime start = DateTime.Now; if (buildForPerChannel) { start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); } start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); //转换wwise xml为txt //ConvertXml2Json(Application.dataPath + "/StreamingAssets/SoundbanksInfo.xml", Application.dataPath + "/Wwise/Resources/SoundbanksInfo.txt"); //拷贝所有的音效资源到下载目录 转换xml为json 计算所有资源的md5值并生成尺寸文件 PackageUtils.BuildAudioData(buildTarget, channelName); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static void BuildAssetBundlesForAllChannels(BuildTarget buildTarget) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Assert(buildForPerChannel == true); // XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); int index = 0; double switchChannel = 0; double buildAssetbundles = 0; var start = DateTime.Now; foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType))) { var channelName = current.ToString(); start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); switchChannel = (DateTime.Now - start).TotalSeconds; start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, index == 0); buildAssetbundles = (DateTime.Now - start).TotalSeconds; index++; Debug.Log(string.Format("{0}.Build assetbundles for platform : {1} and channel : {2} done! use time : switchChannel = {3}s , build assetbundls = {4} s", index, targetName, channelName, switchChannel, buildAssetbundles)); } Debug.Log(string.Format("Build assetbundles for platform : {0} for all {1} channels done!", targetName, index)); }
public static void BuildAssetBundlesForAllChannels(BuildTarget buildTarget) { var targetName = PackageUtils.GetPlatformName(buildTarget); var start = DateTime.Now; CheckAssetBundles.Run(); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); int index = 0; double switchChannel = 0; double buildAssetbundles = 0; foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType))) { start = DateTime.Now; var channelName = current.ToString(); CheckAssetBundles.SwitchChannel(channelName); switchChannel = (DateTime.Now - start).TotalSeconds; start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, index == 0); buildAssetbundles = (DateTime.Now - start).TotalSeconds; index++; Debug.Log(string.Format("{0}.Build assetbundles for platform : {1} and channel : {2} done! use time : switchChannel = {3}s , build assetbundls = {4} s", index, targetName, channelName, switchChannel, buildAssetbundles)); } Debug.Log(string.Format("Build assetbundles for platform : {0} for all {1} channels done!", targetName, index)); }
public static void CheckAndRunAllCheckers(bool buildForPerChannel, bool forceRun) { // 这东西有点浪费时间,没必要的时候不跑它 SetName if (AssetBundleDispatcherInspector.hasAnythingModified || forceRun) { AssetBundleDispatcherInspector.hasAnythingModified = false; var start = DateTime.Now; CheckAssetBundles.Run(buildForPerChannel); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); } }
public static string assetsPath = Path.Combine(Application.dataPath, Assets_Package); //资源目录 public static void RunCheckAssetBundle(bool _is_atlas_model = true) { EditorUserSettings.SetConfigValue(is_atlas_model, _is_atlas_model ? "1" : "0"); //先把之前的config删除 clear(assetspackageConfigPath); AddressableAssetSettings settings = AASUtility.GetSettings(); foreach (var group in settings.groups) { if (group == null) { Debug.LogError("addressable坏了"); } } //动态增加 addressables groups addAddressablesGroups(); //动态增加 config refreshConfig(); CheckAssetBundles.Run(); string assetFolder = Path.Combine(Application.dataPath, AssetBundleConfig.AssetsFolderName); //特殊文件 string app_version = Path.Combine(assetFolder, BuildUtils.AppVersionFileName); string assets_map = Path.Combine(assetFolder, AssetBundleConfig.AssetsPathMapFileName); string channel_name = Path.Combine(assetFolder, BuildUtils.ChannelNameFileName); string notice_version = Path.Combine(assetFolder, BuildUtils.NoticeVersionFileName); string res_version = Path.Combine(assetFolder, BuildUtils.ResVersionFileName); string ifix_map = Path.Combine(assetFolder, BuildUtils.IfixMapFileName); string config = Path.Combine(assetFolder, BuildUtils.ConfigFileName); SingleFileAddress("global", app_version); SingleFileAddress("global", assets_map); SingleFileAddress("global", channel_name); SingleFileAddress("global", notice_version); SingleFileAddress("global", res_version); SingleFileAddress("global", ifix_map); SingleFileAddress("global", config); //设置AssetBundle Provider SetAllGroupsToAssetBundleEncryptProvider(); //设置Asset Address SetAssetAddressAndLabel(); //将资源全部打成远程模式 SetAllGroupsToRemoteNoStatic(); }
static public void ToolRunAllCheckers() { var buildTargetName = PackageUtils.GetCurPlatformName(); var channelName = PackageUtils.GetCurSelectedChannel().ToString(); bool checkCopy = EditorUtility.DisplayDialog("Run Checkers Warning", string.Format("Run Checkers for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkCopy) { return; } CheckAssetBundles.Run(); }
public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { var start = DateTime.Now; CheckAssetBundles.Run(); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName.ToString()); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); // XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); DateTime start = DateTime.Now; if (buildForPerChannel) { start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); } start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static void RunCheckAssetBundle() { var start = DateTime.Now; CheckAssetBundles.Run(); //更新assetmap List <AddressableAssetEntry> assets = new List <AddressableAssetEntry>(); AASUtility.GetSettings().GetAllAssets(assets, false, (g) => { return(g.name.Equals("lua")); }); string[] address = assets.Select(e => e.address).ToArray(); string assetPathMap = Path.Combine(Application.dataPath, AssetBundleConfig.AssetsFolderName); assetPathMap = Path.Combine(assetPathMap, AssetBundleConfig.AssetsPathMapFileName); GameUtility.SafeWriteAllLines(assetPathMap, address); AssetDatabase.Refresh(); //特殊文件 string app_version = Path.Combine(assetPathMap, "app_version.bytes"); string assets_map = Path.Combine(assetPathMap, "AssetsMap.bytes"); string channel_name = Path.Combine(assetPathMap, "channel_name.bytes"); string notice_version = Path.Combine(assetPathMap, "notice_version.bytes"); string res_version = Path.Combine(assetPathMap, "res_version.bytes"); SingleFileAddress("global", app_version); SingleFileAddress("global", assets_map); SingleFileAddress("global", channel_name); SingleFileAddress("global", notice_version); SingleFileAddress("global", res_version); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); }