static void DrawContentPlatfom() { EditorGUI.BeginChangeCheck(); var targetGroupList = PlatformUtils.GetSupportList(); GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label(S._Selectplatformtouse); foreach (var t in targetGroupList) { EditorGUI.BeginChangeCheck(); var _b = HEditorGUILayout.ToggleLeft(P.GetPlatform(t).enable, t.Icon(), t.GetName()); if (EditorGUI.EndChangeCheck()) { P.GetPlatform(t).enable = _b; BuildAssistWindow.ChangeActiveTarget(); } } GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { s_changed = true; } }
/// <summary> /// /// </summary> static void DrawGUI() { P.Load(); PB.Load(); Styles.Init(); using (new PreferenceLayoutScope(ref m_scroll2)) { PB.i.selectTool = GUILayout.Toolbar(PB.i.selectTool, toolName); GUILayout.Space(8); if (PB.i.selectTool == 0) { DrawContentPlatfom(); } else { DrawContentConfig(); } } if (s_changed) { P.Save(); PB.Save(); BuildAssistWindow.Repaint(); } }
public void SelectItemUpdate() { if (m_currentPlatform != null && m_currentPlatform.buildTargetGroup != P.i.selectBuildTargetGroup) { m_currentPlatform = null; } if (m_currentPlatform == null) { m_currentPlatform = P.GetSelectPlatform(); //BMS.i.platformList.Add( m_currentPlatform ); } if (m_currentPlatform.parameters.Count == 0) { m_currentPlatform.AddParams("Debug"); m_currentPlatform.AddParams("Release"); m_currentPlatform.AddParams("Master"); s_changed = true; } if (P.i.selectParamsIndex < 0) { P.i.selectParamsIndex = 0; } else if (m_currentPlatform.parameters.Count <= P.i.selectParamsIndex) { P.i.selectParamsIndex = m_currentPlatform.parameters.Count - 1; } }
void DrawGUI() { s_changed = false; SelectItemUpdate(); var w = position.width; var h = position.height; var drawArea = new Rect(4, EditorGUIUtility.singleLineHeight + 1 + 4, w - 4 - 4, position.height - EditorGUIUtility.singleLineHeight - 12); using (new GUILayout.AreaScope(drawArea)) using (var sc = new GUILayout.ScrollViewScope(m_scroll)) { m_scroll = sc.scrollPosition; if (P.i.selectScene) { SceneSelectTabOnGUI(); return; } m_draw?.Draw(this); if (s_changed) { P.Save(); } } }
public BuildReport BuildPackage(string[] scenes) { var p = P.GetActiveTargetParams(); var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}"; try { B.development = p.development; B.compressionType = p.compression; B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration; B.WebGL_compressionFormat = p.WebGL_compressionFormat; B.WebGL_linkerTarget = p.WebGL_linkerTarget; B.WebGL_memorySize = p.WebGL_memorySize; B.WebGL_exceptionSupport = p.WebGL_exceptionSupport; #if UNITY_2019_1_OR_NEWER B.WebGL_threadsSupport = p.WebGL_threadsSupport; B.WebGL_wasmStreaming = p.WebGL_wasmStreaming; #endif Log($"path: {path}"); Log($"buildTarget: {p.buildTarget.ToString()}"); Log($"options: {p.options.ToString()}"); return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.WebGL, p.options)); } catch (Exception e) { Debug.LogException(e); } return(null); }
static void Batch() { Log("Batch"); P.Load(); Log($"{string.Join( "; ", EditorUserBuildSettings.activeScriptCompilationDefines )}"); Log($"activeBuildTargetGroup: {UnityEditorUserBuildSettings.activeBuildTargetGroup.ToString()}"); Log($"activeBuildTarget: {EditorUserBuildSettings.activeBuildTarget.ToString()}"); var currentParams = P.GetActiveTargetParams(); Log($"{currentParams.buildTarget}"); foreach (var arg in Environment.GetCommandLineArgs()) { if (arg.Contains("-buildIndex")) { int index = int.Parse(arg.Split(':')[1]); P.i.buildParamIndex = index; break; } } Build(0x01); }
public void Draw(BuildAssistWindow parent) { var currentParams = P.GetCurrentParams(); parent.DrawGUI_PackageName(); parent.DrawGUI_ConfigurationSelect(); parent.DrawGUI_AssetBundle(); parent.DrawGUI_BuildSettings(); parent.DrawGUI_PlayerSettings(); DrawGUI_WebGL(currentParams); parent.DrawGUI_OutputDirectory(); bool once = false; void errorLabel(string s, string icon = "") { var c = EditorStyles.label.normal.textColor; EditorStyles.label.normal.textColor = Color.red; EditorStyles.label.fontStyle = FontStyle.Bold; GUILayout.Label(EditorHelper.TempContent(s, Icon.Get(icon)), EditorStyles.label); EditorStyles.label.fontStyle = FontStyle.Normal; EditorStyles.label.normal.textColor = c; } void errorTitle() { if (once) { return; } errorLabel("PlayerSettings.Standalone settings are incomplete", "console.erroricon.sml"); once = true; } if (currentParams.development) { HEditorGUILayout.BoldLabel(SS._Info, EditorIcon.Info); HEditorGUILayout.BoldLabel(S._NotethatWebGLdevelopmentbuildsaremuchlargerthanreleasebuildsandshoundnotbepublicsed); } GUILayout.FlexibleSpace(); parent.DrawGUI_Bottom(); }
//public void Reinit() => Init(); public void Init() { s_window = this; P.Load(); m_currentPlatform = null; m_supportBuildTarget = PlatformUtils.GetSupportList(); _enableAssetBundle = EditorHelper.HasMenuItem(Window_AssetBundle_Browser); _enableBuildReport = EditorHelper.HasMenuItem(Window_Show_Build_Report); MakeDrawBuildTarget(); OnFocus(); }
void ExecuteBuildBundle() { EditorApplication.delayCall += BuildBundle; void BuildBundle() { P.SetBuildParamIndex(); try { BuildCommands.Build(0x02); } catch (Exception e) { UnityDebug.LogException(e); } EditorApplication.update -= BuildBundle; } }
public void MakeDefaultOutputDirectory() { var currentParams = P.GetCurrentParams(); if (!currentParams.outputDirectoryAuto) { return; } var s = $"{Environment.CurrentDirectory}/{currentParams.buildTarget.ToString()}"; if (currentParams.outputUseConfiguration) { s += $"/{currentParams.name}"; } currentParams.outputDirectory = DirectoryUtils.Prettyfy(s); }
static string BuildPackage() { var currentParams = P.GetActiveTargetParams(); IBuildPlatform builder = null; switch (UnityEditorUserBuildSettings.activeBuildTargetGroup) { case BuildTargetGroup.Standalone: builder = new BuildPlatformStandard(); break; case BuildTargetGroup.Android: builder = new BuildPlatformAndroid(); break; case BuildTargetGroup.WebGL: builder = new BuildPlatformWebGL(); break; } if (builder == null) { return(string.Empty); } Log($"{builder.GetType().Name}"); B.CallEvent(typeof(BuildAssistEventPackageBuildPreProcess)); //Debug.Log( string.Join( " ", PB.GetBuildSceneName( currentParams ) ) ); var report = builder.BuildPackage(PB.GetBuildSceneName(currentParams)); //var report = ( UnityEditor.Build.Reporting.BuildReport ) null; B.CallEvent(typeof(BuildAssistEventPackageBuildPostProcess)); if (report == null) { return(string.Empty); } Log($"# BuildPipeline Result: {report.summary.result.ToString()}"); return(report.summary.result.ToString()); }
public static void ChangeActiveTarget() { if (!P.GetPlatform(P.i.selectBuildTargetGroup).enable) { //int cur = (int)P.i.selectBuildTargetGroup; var lst = PlatformUtils.GetSupportList(); int cur = lst.IndexOf(P.i.selectBuildTargetGroup); bool finded = false; int idx = cur - 1; while (0 <= idx) { if (P.GetPlatform(lst[idx]).enable) { finded = true; goto find; } idx--; } idx = cur + 1; while (idx < lst.Count) { if (P.GetPlatform(lst[idx]).enable) { finded = true; goto find; } idx++; } find: if (finded) { P.i.selectBuildTargetGroup = lst[idx]; } else { P.i.selectBuildTargetGroup = BuildTargetGroup.Unknown; } P.Save(); } s_window.MakeDrawBuildTarget(); Repaint(); }
public BuildReport BuildPackage(string[] scenes) { var p = P.GetActiveTargetParams(); var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}"; //var scenes = BuildManagerCommand.GetBuildSceneName(); try { B.development = p.development; B.buildAppBundle = p.buildAppBundle; B.compressionType = p.compression; B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration; B.scriptingBackend = p.scriptingBackend; if (p.scriptingBackend == ScriptingImplementation.Mono2x) { B.targetArchitectures = AndroidArchitecture.ARMv7; } else { B.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64; } // どちらのMinifyが利用されるかの調査、下記コードで"Release"がセットされると、後の工程で"Release"の文字列判定でReleaseが選択される模様 // // string value2 = (!Unsupported.IsSourceBuild()) ? ((!development) ? "Release" : "Development") : EditorUserBuildSettings.androidBuildType.ToString(); // // Unsupported.IsSourceBuild()はエディタ上ではFalseが返ってくる // 過去バージョンとの兼ね合いかわからないがTrueの場合はEditorUserBuildSettings.androidBuildTypeが利用されることになる // 2018.4.12f1時点ではEditorUserBuildSettings.androidBuildTypeは封印されているため、エディタ上からの入力は不可能 // なのでUnsupported.IsSourceBuild()がTrueでもいいようにEditorUserBuildSettings.androidBuildTypeを書き換える B.androidBuildType = p.development ? AndroidBuildType.Development : AndroidBuildType.Release; //Log( $"path: {path}" ); Log($"buildTarget: {p.buildTarget.ToString()}"); return(BuildPipeline.BuildPlayer(scenes, path, BuildTarget.Android, p.options)); } catch (System.Exception e) { Debug.LogException(e); } return(null); }
public static string Build(int mode) { Log("Start Build:"); PB.Load(); B.CallEvent(typeof(BuildAssistEventPackageBuildStartProcess)); using (new ScopeBuildExclusionAssets(PB.i.enableExlusionAssets, PB.i.exclusionFileList)) using (new ScopeBuildSettings()) using (new ScopeScriptingDefineSymbols()) { var currentParams = P.GetActiveTargetParams(); if (!Application.isBatchMode) { if (EditorUserBuildSettings.activeBuildTarget != currentParams.buildTarget) { EditorUserBuildSettings.SwitchActiveBuildTarget(UnityEditorUserBuildSettings.activeBuildTargetGroup, currentParams.buildTarget); } } var activeBuildTargetGroup = UnityEditorUserBuildSettings.activeBuildTargetGroup; string symbol = PlayerSettings.GetScriptingDefineSymbolsForGroup(activeBuildTargetGroup); symbol = string.Join(";", symbol, currentParams.scriptingDefineSymbols); PlayerSettings.SetScriptingDefineSymbolsForGroup(activeBuildTargetGroup, symbol); Log($"ActiveBuildTargetGroup: {activeBuildTargetGroup.ToString()}"); Log($"ScriptingDefineSymbols: {symbol}"); if (mode.Has(0x02)) { BuildAssetBundle(); } if (mode.Has(0x01)) { BuildPackage(); } } Log("Exit Build:"); return(""); }
void ExecuteBuildPackage() { EditorApplication.delayCall += BuildPackage; void BuildPackage() { P.SetBuildParamIndex(); try { var flag = 0x01; if (P.GetCurrentParams().buildAssetBundlesTogether) { flag |= 0x02; } BuildCommands.Build(flag); } catch (Exception e) { UnityDebug.LogException(e); } }; }
public void Draw(BuildAssistWindow parent) { var currentParams = P.GetCurrentParams(); if (currentParams == null) { return; } parent.DrawGUI_PackageName(); parent.DrawGUI_ConfigurationSelect(); parent.DrawGUI_AssetBundle(); parent.DrawGUI_BuildSettings(); parent.DrawGUI_PlayerSettings(); parent.DrawGUI_OutputDirectory(); // PlayerS DrawGUI_Android(currentParams); GUILayout.FlexibleSpace(); parent.DrawGUI_Bottom(); }
public BuildReport BuildPackage(string[] scenes) { var p = P.GetActiveTargetParams(); var path = $"{p.outputDirectory}/{P.GetOutputPackageName( p )}"; //var scenes = BuildManagerCommand.GetBuildSceneName(); try { B.development = p.development; //B.buildAppBundle = p.buildAppBundle; B.compressionType = p.compression; B.il2CppCompilerConfiguration = p.il2CppCompilerConfiguration; B.scriptingBackend = p.scriptingBackend; Log($"path: {path}"); Log($"buildTarget: {p.buildTarget.ToString()}"); return(BuildPipeline.BuildPlayer(scenes, path, p.buildTarget, p.options)); } catch (System.Exception e) { Debug.LogException(e); } return(null); }
/// <summary> /// GUI Player Settingsの描画を行います /// </summary> public void DrawGUI_PlayerSettings() { var currentParams = P.GetCurrentParams(); int opt = currentParams.platformOption; bool fold; using (new GUILayout.VerticalScope(Styles.helpBox)) { using (new GUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldPlatform), "Player Settings"); E.i.fold.Toggle(E.FoldPlatform, fold); if (EditorGUI.EndChangeCheck()) { s_changed = true; } GUILayout.FlexibleSpace(); var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton); if (HEditorGUI.IconButton(r, Styles.iconSettings, 1)) { if (PB.i.enableOldStyleProjectSettings) { Selection.activeObject = AssetDatabase.LoadAssetAtPath <UnityObject>(AssetDatabase.GUIDToAssetPath("00000000000000004000000000000000")); EditorUtils.InspectorWindow().Focus(); } else { UnityEditorMenu.Edit_Project_Settings(); } } } EditorGUI.BeginChangeCheck(); if (fold) { EditorGUI.indentLevel++; if (P.i.selectBuildTargetGroup == BuildTargetGroup.Standalone || P.i.selectBuildTargetGroup == BuildTargetGroup.Android) { currentParams.scriptingBackend = (ScriptingImplementation)EditorGUILayout.Popup(S._ScriptingBackend, (int)currentParams.scriptingBackend, B.kScriptingBackendNames); } bool backend = false; if (P.i.selectBuildTargetGroup == BuildTargetGroup.WebGL) { } else if (currentParams.scriptingBackend == ScriptingImplementation.Mono2x) { backend = true; } using (new EditorGUI.DisabledGroupScope(backend)) { currentParams.il2CppCompilerConfiguration = (Il2CppCompilerConfiguration)EditorGUILayout.EnumPopup(S._C__CompilerConfiguration, currentParams.il2CppCompilerConfiguration); } EditorGUILayout.LabelField($"{S._ScriptingDefineSymbols} ({S._Applybuildonly})"); using (new GUILayout.HorizontalScope()) { currentParams.scriptingDefineSymbols = EditorGUILayout.TextField(currentParams.scriptingDefineSymbols); var mm = R.Method("GetSymbolList", "Hananoki.SymbolSettings.SettingsProject", "Hananoki.SymbolSettings.Editor"); if (mm != null) { var tc = GUILayoutUtility.GetRect(EditorHelper.TempContent(Styles.iconPlus), HEditorStyles.iconButton, GUILayout.Width(16), GUILayout.Height(16)); if (HEditorGUI.IconButton(tc, Styles.iconPlus, 3)) { GUI.FocusControl(""); void add(object obj) { var s = obj as string; var ss = currentParams.scriptingDefineSymbols.Split(';'); ArrayUtility.Add(ref ss, s); currentParams.scriptingDefineSymbols = string.Join(";", ss.Where(x => !x.IsEmpty()).Distinct().ToArray()); } var hoge = (ValueTuple <string[], string[]>)mm.Invoke(null, null); var lst = new List <string>(); var m = new GenericMenu(); foreach (var s in hoge.Item1) { m.AddItem("Project/" + s, false, add, s); } foreach (var s in hoge.Item2) { m.AddItem("Editor/" + s, false, add, s); } m.DropDown(tc); } } } EditorGUILayout.LabelField($"{S._ScriptingDefineSymbols} ({S._Current})"); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.TextField(B.scriptingDefineSymbols); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; GUILayout.Space(4); } if (EditorGUI.EndChangeCheck()) { currentParams.platformOption = opt; s_changed = true; } } }
/// <summary> /// GUI 構成の描画を行います /// </summary> public void DrawGUI_ConfigurationSelect() { var currentParams = P.GetCurrentParams(); using (new GUILayout.HorizontalScope()) { void editBUto() { var lsss = EditorGUI.PrefixLabel(GUILayoutUtility.GetLastRect(), EditorHelper.TempContent(S._Configuration)); lsss.x -= Styles.iconEdit.width; lsss.x -= 2; lsss.width = Styles.iconEdit.width; if (HEditorGUI.IconButton(lsss, Styles.iconEdit, 2)) { editMode = !editMode; Repaint(); Event.current.Use(); } } var lst = m_currentPlatform.parameters.Select(x => x.name).ToArray(); if (editMode) { currentParams.name = EditorGUILayout.TextField(S._Configuration, currentParams.name); editBUto(); } else { EditorGUI.BeginChangeCheck(); P.i.selectParamsIndex = EditorGUILayout.Popup(S._Configuration, P.i.selectParamsIndex, lst); if (EditorGUI.EndChangeCheck()) { s_changed = true; } var ls = GUILayoutUtility.GetLastRect(); editBUto(); if (HEditorGUILayout.IconButton(Styles.iconPlus, 4)) { m_currentPlatform.AddParams($"New ({m_currentPlatform.parameters.Count})"); P.i.selectParamsIndex = m_currentPlatform.parameters.Count - 1; Event.current.Use(); s_changed = true; } if (HEditorGUILayout.IconButton(Styles.iconMinus, 4)) { m_currentPlatform.parameters.RemoveAt(P.i.selectParamsIndex); P.i.selectParamsIndex = m_currentPlatform.parameters.Count - 1; Event.current.Use(); s_changed = true; } } } EditorGUILayout.LabelField(S._BuildSceneSet, PB.i.GetSelectedPopupName(currentParams), EditorStyles.popup); var rrc = EditorGUI.PrefixLabel(GUILayoutUtility.GetLastRect(), S._BuildSceneSet.content()); if (EditorHelper.HasMouseClick(rrc)) { void OnSelect(object context) { currentParams.buildSceneSetIndex = context.ToInt(); P.Save(); } var m = new GenericMenu(); m.AddItem(S._UsethestandardBuildSettings, false, OnSelect, -1); m.AddSeparator(""); for (int idx = 0; idx < PB.i.profileList.Count; idx++) { var p = PB.i.profileList[idx]; m.AddItem(p.profileName, false, OnSelect, idx); } m.DropDown(rrc); Event.current.Use(); } }
static string BuildAssetBundle() { if (!PB.i.enableAssetBundleBuild) { return(string.Empty); } var currentParams = P.GetCurrentParams(); string result = ""; var outputPath = "AssetBundles/" + currentParams.buildTarget.ToString(); if (currentParams.assetBundleOption.Has(P.BUNDLE_OPTION_CLEAR_FILES)) { try { fs.rm(outputPath, true); } catch (Exception e) { Debug.LogException(e); } } try { string[] assetBundleNames = AssetDatabase.GetAllAssetBundleNames(); AssetBundleBuild[] builds = new AssetBundleBuild[assetBundleNames.Length]; for (int i = 0; i < builds.Length; i++) { builds[i].assetBundleName = assetBundleNames[i]; builds[i].assetNames = AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleNames[i]); } fs.mkdir(outputPath); Debug.Log("# Start BuildPipeline.BuildAssetBundles:"); var manifest = BuildPipeline.BuildAssetBundles( outputPath, builds, currentParams.assetBundleOptions, currentParams.buildTarget); if (currentParams.assetBundleOption.Has(P.BUNDLE_OPTION_COPY_STREAMINGASSETS)) { for (int i = 0; i < builds.Length; i++) { var p = builds[i].assetBundleName; fs.cp($"{outputPath}/{p}", $"{Application.streamingAssetsPath}/{p}", true); } } B.CallEvent(typeof(BuildAssistEventAssetBundleBuildPostProcess)); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } catch (Exception e) { Debug.LogException(e); throw; } return(result); }
/// <summary> /// ツールバーを描画します /// </summary> void DrawToolBar() { GUILayout.BeginHorizontal(Styles.toolbar); EditorGUI.BeginChangeCheck(); P.i.selectScene = HGUILayoutToolbar.Toggle(P.i.selectScene, EditorHelper.TempContent("Scenes in Build"), Styles.toolbarButtonBold); if (EditorGUI.EndChangeCheck()) { P.Save(); } var lst = m_supportBuildTarget.Where(x => P.GetPlatform(x).enable).ToArray(); var reo = Styles.toolbarbutton.padding; var active = UnityEditorUserBuildSettings.activeBuildTargetGroup; for (int i = 0; i < lst.Length; i++) { var s = lst[i]; EditorGUI.BeginChangeCheck(); var style = Styles.toolbarbutton; if (active == s) { style = Styles.toolbarbuttonActive; } var cont = EditorHelper.TempContent(s.GetShortName(), s.Icon()); var size = style.CalcSize(cont); size.x -= 8; EditorGUI.BeginChangeCheck(); HGUILayoutToolbar.Toggle(P.i.selectBuildTargetGroup == s && P.i.selectScene == false, cont, style, GUILayout.Width(size.x)); if (EditorGUI.EndChangeCheck()) { P.i.selectScene = false; } if (active == s) { var rc = GUILayoutUtility.GetLastRect(); rc.x -= 4; rc = rc.AlignCenterH(16); if (EditorHelper.IsDefine("UNITY_2019_3_OR_NEWER")) { rc.y += 1; } GUI.DrawTexture(rc.AlignR(16), EditorIcon.SceneAsset, ScaleMode.ScaleToFit); } if (EditorGUI.EndChangeCheck()) { P.i.selectBuildTargetGroup = s; P.Save(); ChangeActiveTarget(); } } GUILayout.FlexibleSpace(); if (_enableBuildReport) { if (HGUILayoutToolbar.Button("Build Report")) { EditorApplication.ExecuteMenuItem(Window_Show_Build_Report); } } if (HGUILayoutToolbar.Button(Styles.iconSettings)) { PreferenceWindow.Open(this); } GUILayout.EndHorizontal(); }
public void DrawGUI_AssetBundle() { if (!PB.i.enableAssetBundleBuild) { return; } var currentParams = P.GetCurrentParams(); int opt = currentParams.assetBundleOption; EditorGUI.BeginChangeCheck(); using (new GUILayout.VerticalScope(Styles.helpBox)) { bool fold; using (new GUILayout.HorizontalScope()) { fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldAssetBundle), "Asset Bundle"); E.i.fold.Toggle(E.FoldAssetBundle, fold); GUILayout.FlexibleSpace(); bool b7 = HEditorGUILayout.ToggleLeft(S._ClearFiles, opt.Has(P.BUNDLE_OPTION_CLEAR_FILES)); opt.Toggle(P.BUNDLE_OPTION_CLEAR_FILES, b7); var rc = EditorHelper.GetLayout(Styles.iconSettings, Styles.dropDownButton, GUILayout.Width(80), GUILayout.Height(16)); HEditorGUI.DropDown(rc, S._Build, Styles.dropDownButton, 18, () => { if (IsSwitchPlatformAbort()) { return; } ExecuteBuildBundle(); }, () => { var m = new GenericMenu(); if (Directory.Exists(P.i.outputAssetBundleDirectory)) { m.AddItem(new GUIContent(SS._OpenOutputFolder), false, () => { EditorUtils.ShellOpenDirectory(P.i.outputAssetBundleDirectory); }); } else { m.AddDisabledItem(new GUIContent($"{notDirectory}{P.i.outputAssetBundleDirectory.Replace( "/", "." )}")); } m.DropDown(HEditorGUI.lastRect.PopupRect()); }); if (_enableAssetBundle) { var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton); if (HEditorGUI.IconButton(r, Styles.iconSettings, 2)) { EditorApplication.ExecuteMenuItem(Window_AssetBundle_Browser); Event.current.Use(); } } rc = HEditorGUI.lastRect; GUI.Label(rc.AddH(-3), GUIContent.none, Styles.dopesheetBackground); } GUILayout.Space(2); if (fold) { EditorGUI.indentLevel++; bool bst = HEditorGUILayout.ToggleLeft(S._CopyingthebuildresultstoStreamingAssets, opt.Has(P.BUNDLE_OPTION_COPY_STREAMINGASSETS)); currentParams.assetBundleCompressionMode = EditorGUILayout.Popup(S._Compression, currentParams.assetBundleCompressionMode, s_CompressionMode, Styles.miniPopup); bool b1 = HEditorGUILayout.ToggleLeft(s_BundleOptions[0], opt.Has(P.BUNDLE_OPTION_EXCLUDETYPEINFORMATION)); bool b2 = HEditorGUILayout.ToggleLeft(s_BundleOptions[1], opt.Has(P.BUNDLE_OPTION_FORCEREBUILD)); bool b3 = HEditorGUILayout.ToggleLeft(s_BundleOptions[2], opt.Has(P.BUNDLE_OPTION_IGNORETYPETREECHANGES)); bool b4 = HEditorGUILayout.ToggleLeft(s_BundleOptions[3], opt.Has(P.BUNDLE_OPTION_APPENDHASH)); bool b5 = HEditorGUILayout.ToggleLeft(s_BundleOptions[4], opt.Has(P.BUNDLE_OPTION_STRICTMODE)); bool b6 = HEditorGUILayout.ToggleLeft(s_BundleOptions[5], opt.Has(P.BUNDLE_OPTION_DRYRUNBUILD)); opt.Toggle(P.BUNDLE_OPTION_COPY_STREAMINGASSETS, bst); opt.Toggle(P.BUNDLE_OPTION_EXCLUDETYPEINFORMATION, b1); opt.Toggle(P.BUNDLE_OPTION_FORCEREBUILD, b2); opt.Toggle(P.BUNDLE_OPTION_IGNORETYPETREECHANGES, b3); opt.Toggle(P.BUNDLE_OPTION_APPENDHASH, b4); opt.Toggle(P.BUNDLE_OPTION_STRICTMODE, b5); opt.Toggle(P.BUNDLE_OPTION_DRYRUNBUILD, b6); GUILayout.Space(2); EditorGUI.indentLevel--; } } if (EditorGUI.EndChangeCheck()) { currentParams.assetBundleOption = opt; s_changed = true; } }
/// <summary> /// GUI 下部のビルド開始ボタン等の描画を行います /// </summary> public void DrawGUI_Bottom() { var currentParams = P.GetCurrentParams(); using (new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); GUILayout.Label(P.currentOutputPackageFullName); } using (new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); using (new EditorGUI.DisabledGroupScope(!currentParams.development)) { bool b2 = HEditorGUILayout.SessionToggleLeft(S._ConnectProfiler, S._ProfilingisonlyenabledinaDevelopmentPlayer, E.connectProfiler.Value); E.connectProfiler.Value = b2; } bool b3 = HEditorGUILayout.SessionToggleLeft(S._AutoRunPlayer, E.autoRunPlayer.Value); E.autoRunPlayer.Value = b3; //GUILayout.Space( 16 ); var rc = GUILayoutUtility.GetRect(EditorHelper.TempContent(S._SwitchPlatform, EditorIcon.Warning), GUI.skin.button, GUILayout.Width(150)); void OnDropAction() { var m = new GenericMenu(); if (Directory.Exists(P.currentOutputPackageDirectory)) { m.AddItem(SS._OpenOutputFolder.content(), false, () => { EditorUtils.ShellOpenDirectory(P.currentOutputPackageDirectory); }); } else { m.AddDisabledItem($"{notDirectory}{P.currentOutputPackageDirectory.Replace( "/", "." )}]".content()); } m.AddSeparator(""); if (PB.i.enableAssetBundleBuild) { m.AddItem(S._BuildAssetBundletogether.content(), currentParams.buildAssetBundlesTogether, () => { currentParams.buildAssetBundlesTogether = !currentParams.buildAssetBundlesTogether; }); } if (UnitySymbol.Has("UNITY_EDITOR_WIN")) { m.AddItem(S._CreateabuildBATfile, false, () => { var tname = $"{UnityEditorUserBuildSettings.activeBuildTargetGroup.ToString()}_{currentParams.name}"; EditorHelper.WriteFile($"Build_{tname}.bat", b => { b.AppendLine($"@echo off"); b.AppendLine($"set PATH=%PATH%;{EditorApplication.applicationPath.GetDirectory()}"); b.AppendLine($"set OPT1=-batchmode -nographics"); b.AppendLine($"set BUILD=-buildTarget {B.BuildTargetToBatchName( currentParams.buildTarget )}"); b.AppendLine($"set PROJ=-projectPath {Environment.CurrentDirectory}"); b.AppendLine($"set LOG=-logFile \"Logs/Editor_{tname}.log\""); b.AppendLine($"set METHOD=-executeMethod Hananoki.{Package.name}.{nameof( BuildCommands )}.Batch -buildIndex:{P.i.selectParamsIndex}"); b.AppendLine($"Unity.exe %OPT1% %BUILD% %PROJ% %LOG% %METHOD% -quit"); b.AppendLine($"pause"); }, utf8bom: false); EditorUtility.DisplayDialog(SS._Confirm, $"{S._BuildBATcreated}\n{Environment.CurrentDirectory}/{$"Build_{tname}.bat"}", SS._OK); }); } m.DropDown(HEditorGUI.lastRect.PopupRect()); } if (UnityEditorUserBuildSettings.activeBuildTargetGroup != P.i.selectBuildTargetGroup) { HEditorGUI.DropDown(rc, EditorHelper.TempContent(S._SwitchPlatform, EditorIcon.Warning), Styles.dropDownButton, 20, () => PlatformUtils.SwitchActiveBuildTarget(P.i.selectBuildTargetGroup), OnDropAction ); } else { HEditorGUI.DropDown(rc, E.autoRunPlayer.Value ? S._BuildAndRun : S._Build, Styles.dropDownButton, 20, () => { if (IsSwitchPlatformAbort()) { return; } ExecuteBuildPackage(); }, OnDropAction); } rc = HEditorGUI.lastRect; GUI.Label(rc.AddH(-3), GUIContent.none, Styles.dopesheetBackground); if (UnitySymbol.Has("UNITY_EDITOR_WIN")) { if (P.GetSelectPlatform().buildTargetGroup == BuildTargetGroup.Standalone) { if (File.Exists(P.currentOutputPackageFullName)) { if (HEditorGUILayout.ImageButton(EditorIcon.PlayButton, GUILayout.Width(30))) { System.Diagnostics.Process.Start(P.currentOutputPackageFullName); } } } if (P.GetSelectPlatform().buildTargetGroup == BuildTargetGroup.WebGL) { if (File.Exists($"{P.currentOutputPackageFullName}/index.html")) { if (HEditorGUILayout.ImageButton(EditorIcon.PlayButton, GUILayout.Width(30))) { //System.Diagnostics.Process.Start( $"{P.currentOutputPackageFullName}/index.html" ); Application.OpenURL("http://localhost/"); } } } } } GUILayout.Space(10); }
/// <summary> /// /// </summary> public void DrawGUI_OutputDirectory() { var currentParams = P.GetCurrentParams(); bool fold; bool _outputDirectoryAuto = currentParams.outputDirectoryAuto; bool _outputUseConfiguration = currentParams.outputUseConfiguration; using (new GUILayout.VerticalScope(Styles.helpBox)) { using (new GUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldOutputDirectory), "Output Directory"); E.i.fold.Toggle(E.FoldOutputDirectory, fold); if (EditorGUI.EndChangeCheck()) { s_changed = true; } GUILayout.FlexibleSpace(); var r = GUILayoutUtility.GetRect(20, 18); } if (fold) { EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); using (new GUILayout.HorizontalScope()) { _outputDirectoryAuto = HEditorGUILayout.ToggleLeft(S._Autosetting, _outputDirectoryAuto); using (new EditorGUI.DisabledGroupScope(!_outputDirectoryAuto)) { _outputUseConfiguration = HEditorGUILayout.ToggleLeft(S._UseConfigurationName, _outputUseConfiguration); } GUILayout.FlexibleSpace(); } if (EditorGUI.EndChangeCheck()) { if (_outputDirectoryAuto) { currentParams.outputDirectoryAuto = _outputDirectoryAuto; currentParams.outputUseConfiguration = _outputUseConfiguration; MakeDefaultOutputDirectory(); } s_changed = true; } string _outputDirectory = currentParams.outputDirectory; var rect = GUILayoutUtility.GetRect(_outputDirectory.content(), EditorStyles.label, GUILayout.Height(16)); var r1 = rect; r1.width -= 16; EditorGUI.LabelField(r1, SS._Directory, _outputDirectory); if (!_outputDirectoryAuto) { var r2 = rect; r2.x = r1.xMax; r2.width = 16; if (HEditorGUI.IconButton(r2, Icon.Get("Folder Icon"))) { var _path = EditorUtility.OpenFolderPanel(S._SelectOutputDirectory, _outputDirectory, ""); if (!string.IsNullOrEmpty(_path)) { _outputDirectory = _path; s_changed = true; } } } EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck() || s_changed) { currentParams.outputDirectoryAuto = _outputDirectoryAuto; currentParams.outputUseConfiguration = _outputUseConfiguration; currentParams.outputDirectory = _outputDirectory; s_changed = true; } } } }
/// <summary> /// GUI Build Settingsの描画を行います /// </summary> public void DrawGUI_BuildSettings() { var currentParams = P.GetCurrentParams(); EditorGUI.BeginChangeCheck(); bool fold; using (new GUILayout.VerticalScope(Styles.helpBox)) { using (new GUILayout.HorizontalScope()) { fold = HEditorGUILayout.Foldout(E.i.fold.Has(E.FoldBuildSettings), "Build Settings"); E.i.fold.Toggle(E.FoldBuildSettings, fold); GUILayout.FlexibleSpace(); //EditorGUI.DrawRect( GUILayoutUtility.GetLastRect(), new Color( 0, 0, 1, 0.2f ) ); var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton); if (HEditorGUI.IconButton(r, Styles.iconSettings, B.kBuildSettings, 1)) { UnityEditorMenu.File_Build_Settings(); } } if (fold) { EditorGUI.indentLevel++; currentParams.development = EditorGUILayout.Toggle(S._DevelopmentBuild, currentParams.development); if (P.i.selectBuildTargetGroup == BuildTargetGroup.Android) { currentParams.buildAppBundle = EditorGUILayout.Toggle(S._BuildAppBundle_GooglePlay_, currentParams.buildAppBundle); } if (P.i.selectBuildTargetGroup == BuildTargetGroup.Standalone || P.i.selectBuildTargetGroup == BuildTargetGroup.Android) { string[] ss = { "Default", "LZ4", "LZ4HC" }; switch (EditorGUILayout.Popup(S._CompressionMethod, currentParams.compression.ToIndex(), ss, Styles.miniPopup)) { case 0: currentParams.compression = Compression.None; break; case 1: currentParams.compression = Compression.Lz4; break; case 2: currentParams.compression = Compression.Lz4HC; break; } } EditorGUI.indentLevel--; GUILayout.Space(2); } } if (EditorGUI.EndChangeCheck()) { s_changed = true; } }