static void HandleColorPreferences(string searchContext) { EditorGUI.BeginChangeCheck(); s_UseUnityColors.value = SettingsGUILayout.SettingsToggle("Use Unity Colors", s_UseUnityColors, searchContext); if (!s_UseUnityColors.value) { using (new SettingsGUILayout.IndentedGroup()) { s_DitherFaceHandle.value = SettingsGUILayout.SettingsToggle("Dither Face Overlay", s_DitherFaceHandle, searchContext); s_WireframeColorPref.value = SettingsGUILayout.SettingsColorField("Wireframe", s_WireframeColorPref, searchContext); s_PreselectionColorPref.value = SettingsGUILayout.SettingsColorField("Preselection", s_PreselectionColorPref, searchContext); s_SelectedFaceColorPref.value = SettingsGUILayout.SettingsColorField("Selected Face Color", s_SelectedFaceColorPref, searchContext); s_UnselectedEdgeColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Edge Color", s_UnselectedEdgeColorPref, searchContext); s_SelectedEdgeColorPref.value = SettingsGUILayout.SettingsColorField("Selected Edge Color", s_SelectedEdgeColorPref, searchContext); s_UnselectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Vertex Color", s_UnselectedVertexColorPref, searchContext); s_SelectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Selected Vertex Color", s_SelectedVertexColorPref, searchContext); } } s_DepthTestHandles.value = SettingsGUILayout.SettingsToggle("Depth Test", s_DepthTestHandles, searchContext); s_VertexPointSize.value = SettingsGUILayout.SettingsSlider("Vertex Size", s_VertexPointSize, 1f, 10f, searchContext); s_EdgeLineSize.value = SettingsGUILayout.SettingsSlider("Line Size", s_EdgeLineSize, 0f, 10f, searchContext); s_WireframeLineSize.value = SettingsGUILayout.SettingsSlider("Wireframe Size", s_WireframeLineSize, 0f, 10f, searchContext); if (EditorGUI.EndChangeCheck()) { ProBuilderEditor.UpdateMeshHandles(true); } }
private static void DrawGeneralBlock(string searchContext) { if (BuildManagerUtility.TryMatchSearch(searchContext, ShowUserPreferencesLabel.text)) { if (GUILayout.Button(ShowUserPreferencesLabel)) { SettingsService.OpenUserPreferences(BuildManagerUtility.UserPreferencesPath); } EditorGUILayout.Separator(); } if (ShowSplashScreenSetting != BoolState.Null) { PlayerSettings.SplashScreen.show = ShowSplashScreen; } if (ShowUnityLogoSetting != BoolState.Null) { PlayerSettings.SplashScreen.showUnityLogo = ShowUnityLogo; } using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { UseProjectFolderAsBuildNameSetting.value = SettingsGUILayout.SettingsToggle(UseProjectFolderAsBuildNameLabel, UseProjectFolderAsBuildNameSetting, searchContext); BuildManagerUtility.DrawBoolStateField(searchContext, ShowSplashScreenLabel, ShowSplashScreenSetting, PlayerSettings.SplashScreen.show, delegate { PlayerSettings.SplashScreen.show = ShowSplashScreen; }); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!ShowSplashScreen)) { BuildManagerUtility.DrawBoolStateField(searchContext, ShowUnityLogoLabel, ShowUnityLogoSetting, PlayerSettings.SplashScreen.showUnityLogo, delegate { PlayerSettings.SplashScreen.showUnityLogo = ShowUnityLogo; }); } } UseUtcNowAsIosBuildNumberSetting.value = SettingsGUILayout.SettingsToggle(UseUtcNowAsIosBuildNumberLabel, UseUtcNowAsIosBuildNumberSetting, searchContext); UseUtcNowAsMacBuildNumberSetting.value = SettingsGUILayout.SettingsToggle(UseUtcNowAsMacBuildNumberLabel, UseUtcNowAsMacBuildNumberSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } }
private static void XamlC(string search) { EditorGUI.BeginChangeCheck(); using (new SettingsGUILayout.IndentedGroup("XamlC")) { OptimizeIL.value = SettingsGUILayout.SettingsToggle("Optimize IL", OptimizeIL, search); DebugSymbols.value = SettingsGUILayout.SettingsToggle("Debug Symbols", DebugSymbols, search); } if (EditorGUI.EndChangeCheck()) { Backend.Save(); } }
static void ExperimentalFeaturesSettings(string searchContext) { s_ExperimentalFeatures.value = SettingsGUILayout.SettingsToggle("Experimental Features Enabled", s_ExperimentalFeatures, searchContext); if (s_ExperimentalFeatures.value) { using (new SettingsGUILayout.IndentedGroup()) { s_MeshesAreAssets.value = SettingsGUILayout.SettingsToggle("Store Mesh as Asset", s_MeshesAreAssets, searchContext); if (s_MeshesAreAssets.value) { EditorGUILayout.HelpBox("Please note that this feature is untested, and may result in instabilities or lost work. Proceed with caution!", MessageType.Warning); } } } }
private static void DrawCloudBuildsBlock(string searchContext) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { AppendBuildNumberToVersionSetting.value = SettingsGUILayout.SettingsToggle(AppendBuildNumberToVersionLabel, AppendBuildNumberToVersionSetting, searchContext); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!AppendBuildNumberToVersionSetting)) { if (BuildManagerUtility.TryMatchSearch(searchContext, BuildNumberExpressionLabel.text)) { BuildNumberExpressionSetting.value = EditorGUILayout.TextField(BuildNumberExpressionLabel, BuildNumberExpressionSetting); SettingsGUILayout.DoResetContextMenuForLastRect(BuildNumberExpressionSetting); Rect position = EditorGUILayout.GetControlRect(true); position.xMin += EditorGUIUtility.labelWidth; if (GUI.Button(position, "Validate")) { string buildNumber = Random.Range(1, 100).ToString(); string original = BuildNumberExpressionSetting; string replaced = original.Replace(BuildNumberPlaceholder, buildNumber); if (ExpressionEvaluator.Evaluate(replaced, out int result)) { Debug.Log($"Expression ({original}) is valid! Validated with Build Number {buildNumber}: ({replaced})={result}"); } else { Debug.LogError($"({original}) is not a valid expression!"); } } } } } UseBuildStartTimeAsUtcNowSetting.value = SettingsGUILayout.SettingsToggle(UseBuildStartTimeAsUtcNowLabel, UseBuildStartTimeAsUtcNowSetting, searchContext); SumBuildNumberToBundleVersionCodeSetting.value = SettingsGUILayout.SettingsToggle(SumBuildNumberToBundleVersionCodeLabel, SumBuildNumberToBundleVersionCodeSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } }
private static void DrawLocalBuildsBlock(string searchContext) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { AllowFallbackToMonoSetting.value = SettingsGUILayout.SettingsToggle(AllowFallbackToMonoLabel, AllowFallbackToMonoSetting, searchContext); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!AllowFallbackToMonoSetting)) { BuildManagerUtility.DrawEnumField(searchContext, PreferredLinuxScriptingBackendLabel, PreferredLinuxScriptingBackendSetting, null); BuildManagerUtility.DrawEnumField(searchContext, PreferredMacScriptingBackendLabel, PreferredMacScriptingBackendSetting, null); BuildManagerUtility.DrawEnumField(searchContext, PreferredWindowsScriptingBackendLabel, PreferredWindowsScriptingBackendSetting, null); } } if (changeCheckScope.changed) { Settings.Save(); } } }
static void HandleColorPreferences(string searchContext) { s_UseUnityColors.value = SettingsGUILayout.SettingsToggle("Use Unity Colors", s_UseUnityColors, searchContext); if (!s_UseUnityColors.value) { using (new SettingsGUILayout.IndentedGroup()) { s_DitherFaceHandle.value = SettingsGUILayout.SettingsToggle("Dither Face Overlay", s_DitherFaceHandle, searchContext); s_WireframeColorPref.value = SettingsGUILayout.SettingsColorField("Wireframe", s_WireframeColorPref, searchContext); s_PreselectionColorPref.value = SettingsGUILayout.SettingsColorField("Preselection", s_PreselectionColorPref, searchContext); s_SelectedFaceColorPref.value = SettingsGUILayout.SettingsColorField("Selected Face Color", s_SelectedFaceColorPref, searchContext); s_UnselectedEdgeColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Edge Color", s_UnselectedEdgeColorPref, searchContext); s_SelectedEdgeColorPref.value = SettingsGUILayout.SettingsColorField("Selected Edge Color", s_SelectedEdgeColorPref, searchContext); s_UnselectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Vertex Color", s_UnselectedVertexColorPref, searchContext); s_SelectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Selected Vertex Color", s_SelectedVertexColorPref, searchContext); } } s_DepthTestHandles.value = SettingsGUILayout.SettingsToggle("Depth Test", s_DepthTestHandles, searchContext); s_VertexPointSize.value = SettingsGUILayout.SettingsSlider("Vertex Size", s_VertexPointSize, 1f, 10f, searchContext); bool geoLine = BuiltinMaterials.geometryShadersSupported; if (geoLine) { s_EdgeLineSize.value = SettingsGUILayout.SettingsSlider("Line Size", s_EdgeLineSize, 0f, 3f, searchContext); s_WireframeLineSize.value = SettingsGUILayout.SettingsSlider("Wireframe Size", s_WireframeLineSize, 0f, 3f, searchContext); } else { GUI.enabled = false; SettingsGUILayout.SearchableSlider("Line Size", 0f, 0f, 3f, searchContext); SettingsGUILayout.SearchableSlider("Wireframe Size", 0f, 0f, 3f, searchContext); GUI.enabled = true; } }
private static void OnGUI(string searchContext) { var style = new GUIStyle(EditorStyles.helpBox); style.fontSize = 13; style.richText = true; EditorGUI.BeginChangeCheck(); _EnableCustomTitle.value = SettingsGUILayout.SettingsToggle("Enable Custom Window Title", _EnableCustomTitle, searchContext); using (new EditorGUI.DisabledScope(!_EnableCustomTitle.value)) { _FormatString.value = SettingsGUILayout.SettingsTextField("Window Title Format String", _FormatString, searchContext); _RepositoryPath.value = SettingsGUILayout.SettingsTextField( new GUIContent("Git Repository Path", "Git repository root directory"), _RepositoryPath, searchContext); var parametersInfoBox = $@"Available title parameters: • <Branch> {_DisabledTextColorTag}{TitleFormatter.Format("<Branch>")}</color> • <SceneName> {_DisabledTextColorTag}{TitleFormatter.Format("<SceneName>")}</color> • <ProjectName> {_DisabledTextColorTag}{TitleFormatter.Format("<ProjectName>")}</color> • <RepoDirName> {_DisabledTextColorTag}{TitleFormatter.Format("<RepoDirName>")}</color> • <ProjectPath> {_DisabledTextColorTag}{TitleFormatter.Format("<ProjectPath>")}</color> • <RepoPath> {_DisabledTextColorTag}{TitleFormatter.Format("<RepoPath>")}</color> • <EditorVersion> {_DisabledTextColorTag}{TitleFormatter.Format("<EditorVersion>")}</color> • <TargetPlatform> {_DisabledTextColorTag}{TitleFormatter.Format("<TargetPlatform>")}</color>"; GUILayout.Label(parametersInfoBox, style); } if (EditorGUI.EndChangeCheck()) { Instance.Save(); UpdateWindowTitle(); } }
static bool DrawToggle(BaseSetting <bool> value, string searchContext) { return(SettingsGUILayout.SettingsToggle(value.GetGuiContent(), value, searchContext)); }
private static void DrawHeaderBlock(string searchContext) { if (BuildManagerUtility.TryMatchSearch(searchContext, ShowProjectSettingsLabel.text)) { if (GUILayout.Button(ShowProjectSettingsLabel)) { SettingsService.OpenProjectSettings(BuildManagerUtility.ProjectSettingsPath); } EditorGUILayout.Separator(); } using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { if (BuildManagerUtility.TryMatchSearch(searchContext, OpenBuiltPlayerOptionsLabel.text)) { OpenBuiltPlayerOptionsSetting.value = (OpenBuiltPlayerOptions)EditorGUILayout.EnumFlagsField(OpenBuiltPlayerOptionsLabel, OpenBuiltPlayerOptionsSetting); SettingsGUILayout.DoResetContextMenuForLastRect(OpenBuiltPlayerOptionsSetting); } CreateStandardizedBuildOutputSetting.value = SettingsGUILayout.SettingsToggle(CreateStandardizedBuildOutputLabel, CreateStandardizedBuildOutputSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } using (new EditorGUI.DisabledScope(!CreateStandardizedBuildOutputSetting)) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { using (new EditorGUI.IndentLevelScope()) { GroupByBuildNameSetting.value = SettingsGUILayout.SettingsToggle(GroupByBuildNameLabel, GroupByBuildNameSetting, searchContext); GroupByBuildTargetSetting.value = SettingsGUILayout.SettingsToggle(GroupByBuildTargetLabel, GroupByBuildTargetSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } if (!BuildManagerUtility.TryMatchSearch(searchContext, StandardizedBuildOutputPathLabel.text) && !BuildManagerUtility.TryMatchSearch(searchContext, ChangeButtonLabel.text)) { return; } Rect position = EditorGUILayout.GetControlRect(); position = EditorGUI.PrefixLabel(position, StandardizedBuildOutputPathLabel); if (GUI.Button(position, ChangeButtonLabel, EditorStyles.miniButton)) { string value = EditorUtility.OpenFolderPanel("Builds folder location", Path.GetDirectoryName(StandardizedBuildOutputPath), Path.GetFileName(StandardizedBuildOutputPath)); if (string.IsNullOrEmpty(value) == false) { StandardizedBuildOutputPathSetting.SetValue(value, true); } } SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting); position = EditorGUILayout.GetControlRect(); if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && position.Contains(Event.current.mousePosition)) { string path = Directory.Exists(StandardizedBuildOutputPath) ? StandardizedBuildOutputPath : Path.GetDirectoryName(Application.dataPath); Assert.IsFalse(string.IsNullOrWhiteSpace(path)); Process.Start(path); } string outputLabel = StandardizedBuildOutputPathSetting == DefaultStandardizedBuildOutputPath ? $"./{DefaultStandardizedBuildOutputPath}" : StandardizedBuildOutputPath; EditorGUI.LabelField(position, outputLabel, EditorStyles.miniLabel); SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting); } } } }