static void PackAndroidApp() { Debug.LogError("android package ----- 1"); var start = DateTime.Now; Debug.LogError("android package ----- 2"); BuildTarget buildTarget = BuildTarget.Android; ChannelType channelType = ChannelType.Test; Debug.LogError("android package ----- 3"); AssetBundleDispatcherInspector.hasAnythingModified = true; BuildPlayer.BuildAssetBundles(buildTarget, channelType.ToString()); AssetBundleDispatcherInspector.hasAnythingModified = false; Debug.LogError("android package ----- 4"); AssetBundleMenuItems.ToolsCopyAssetbundlesAndScripts(); Debug.LogError("android package ----- 5"); PackageTool.BuildAndroidPlayerForCurrentChannel(); Debug.LogError("android package ----- 6"); var folder = PackageUtils.GetChannelOutputPath(buildTarget, channelType.ToString()); EditorUtils.ExplorerFolder(folder); Debug.LogError("android package ----- 7"); Debug.LogError($"Android Package Success!!! Use Time {(DateTime.Now - start).TotalSeconds}"); }
public static void BuildAssetBundlesForCurrentChannel() { var start = DateTime.Now; BuildPlayer.BuildAssetBundles(buildTarget, channelType.ToString()); var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Success", string.Format("Build AssetBundles for : \n\nplatform : {0} \nchannel : {1} \n\ndone! use {2}s", buildTargetName, channelType, (DateTime.Now - start).TotalSeconds), "Confirm"); }
void DrawAssetBundlesGUI() { GUILayout.Space(3); GUILayout.Label("-------------[Build AssetBundles]-------------"); GUILayout.BeginHorizontal(); // if (buildTarget == BuildTarget.Android) // { // GUILayout.Label("Android Lua打包成Ab : ", GUILayout.Width(150)); // AssetBundleConfig.IsPackLuaAb = EditorGUILayout.Toggle(AssetBundleConfig.IsPackLuaAb, GUILayout.Width(50)); // } GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.Space(3); GUILayout.BeginHorizontal(); if (buildABSForPerChannel) { if (GUILayout.Button("Current Channel Only", GUILayout.Width(200))) { EditorApplication.delayCall += BuildAssetBundlesForCurrentChannel; } if (GUILayout.Button("For All Channels", GUILayout.Width(200))) { EditorApplication.delayCall += BuildAssetBundlesForAllChannels; } if (GUILayout.Button("Open Current Output", GUILayout.Width(200))) { AssetBundleMenuItems.ToolsOpenOutput(); } if (GUILayout.Button("Copy To StreamingAsset", GUILayout.Width(200))) { AssetBundleMenuItems.ToolsCopyAssetbundles(); AssetDatabase.Refresh(); } } else { if (GUILayout.Button("打包ab包并拷贝", GUILayout.Width(200))) { var start = DateTime.Now; EditorApplication.delayCall += BuildAssetBundlesForCurrentChannel; EditorApplication.delayCall += () => { AssetBundleMenuItems.ToolsCopyAssetbundles(); AssetDatabase.Refresh(); }; EditorApplication.delayCall += () => { EditorUtility.DisplayDialog("打包完成", $"RunAllCheckres; ExecuteBuild; CopyToStreamingAsset; 使用时长为:{(DateTime.Now - start).TotalSeconds}", "Confirm"); }; } if (GUILayout.Button("打开ab包目录", GUILayout.Width(200))) { AssetBundleMenuItems.ToolsOpenOutput(); } if (GUILayout.Button("生成引用计数大于1的资源目录", GUILayout.Width(200))) { EditorApplication.delayCall += () => { CheckAllDependenciesRes(); }; EditorApplication.delayCall += () => { CMDController.ExcuteCmdFile(CMDController.CMDHotUpdateFile); }; } } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("拷贝Lua的代码", GUILayout.Width(200))) { var start = DateTime.Now; AssetBundleMenuItems.ToolsCopyLuaScriptsToAssetbundles(); AssetDatabase.Refresh(); EditorApplication.delayCall += () => { EditorUtility.DisplayDialog("拷贝Lua代码完成", $" 使用时长为:{(DateTime.Now - start).TotalSeconds}", "Confirm"); }; } EditorGUILayout.Space(); if (GUILayout.Button("打包拷贝ab&拷贝lua", GUILayout.Width(200))) { var start = DateTime.Now; EditorApplication.delayCall += () => { AssetBundleDispatcherInspector.hasAnythingModified = true; BuildPlayer.BuildAssetBundles(buildTarget, channelType.ToString()); AssetBundleDispatcherInspector.hasAnythingModified = false; }; EditorApplication.delayCall += () => { CMDController.ExcuteCmdFile(); }; EditorApplication.delayCall += () => { AssetBundleMenuItems.ToolsCopyAssetbundlesAndScripts(); }; EditorApplication.delayCall += () => { EditorUtility.DisplayDialog("一键完成", $"RunAllCheckres; ExecuteBuild; CopyToStreamingAsset; Copy LuaSciptsToStreamingAsset; 使用时长为:{(DateTime.Now - start).TotalSeconds}", "Confirm"); }; } EditorGUILayout.Space(); if (GUILayout.Button("一键+打包", GUILayout.Width(200))) { var start = DateTime.Now; EditorApplication.delayCall += () => { AssetBundleDispatcherInspector.hasAnythingModified = true; BuildPlayer.BuildAssetBundles(buildTarget, channelType.ToString()); AssetBundleDispatcherInspector.hasAnythingModified = false; }; EditorApplication.delayCall += () => { AssetBundleMenuItems.ToolsCopyAssetbundlesAndScripts(); }; EditorApplication.delayCall += CheckAllDependenciesRes; EditorApplication.delayCall += BuildAndroidPlayerForCurrentChannel; EditorApplication.delayCall += () => { CMDController.ExcuteCmdFile(CMDController.CMDHotUpdateFile); }; EditorApplication.delayCall += () => { var folder = PackageUtils.GetChannelOutputPath(buildTarget, channelType.ToString()); EditorUtils.ExplorerFolder(folder); }; EditorApplication.delayCall += () => { EditorUtility.DisplayDialog("一键完成", $"RunAllCheckres; ExecuteBuild; CopyToStreamingAsset; Copy LuaSciptsToStreamingAsset; 使用时长为:{(DateTime.Now - start).TotalSeconds}", "Confirm"); }; } EditorGUILayout.Space(); if (GUILayout.Button("准备热更新资源", GUILayout.Width(200))) { CMDController.ExcuteCmdFile(CMDController.CMDHotUpdateFile); } GUILayout.Space(3); }