public static void Draw(ref Vector2 settingsSectionScrollPosition) { // ---------------------------------------------------------------------------- // filtering settings // ---------------------------------------------------------------------------- if (UIHelpers.ImageButton("Manage Filters...", CSIcons.Gear)) { IssuesFiltersWindow.Create(); } GUILayout.Space(5); DrawWhereSection(ref settingsSectionScrollPosition); GUILayout.Space(5); DrawWhatSection(ref settingsSectionScrollPosition); if (UIHelpers.ImageButton("Reset", "Resets settings to defaults.", CSIcons.Restore)) { MaintainerSettings.Issues.Reset(); } }
private static void DrawWhereSection(/*ref Vector2 settingsSectionScrollPosition*/) { // ----------------------------------------------------------------------------- // where to look // ----------------------------------------------------------------------------- using (new GUILayout.VerticalScope(/*UIHelpers.panelWithBackground*/)) { using (new GUILayout.HorizontalScope()) { GUILayout.Space(10); using (new GUILayout.VerticalScope()) { GUILayout.Label("<b><size=16>Where</size></b>", UIHelpers.richLabel); UIHelpers.Separator(); } GUILayout.Space(10); } using (new GUILayout.HorizontalScope()) { GUILayout.Space(10); using (new GUILayout.VerticalScope()) { GUILayout.Space(10); if (UIHelpers.ImageButton("Filters (" + ProjectSettings.Issues.GetFiltersCount() + ")", CSIcons.Filter)) { IssuesFiltersWindow.Create(); } GUILayout.Space(10); using (new GUILayout.HorizontalScope()) { ProjectSettings.Issues.lookInScenes = EditorGUILayout.ToggleLeft(new GUIContent("Scenes", "Uncheck to exclude all scenes from search or select filtering level:\n\n" + "All Scenes: all project scenes with respect to configured filters.\n" + "Included Scenes: scenes included via Manage Filters > Scene Includes.\n" + "Current Scene: currently opened scene including any additional loaded scenes."), ProjectSettings.Issues.lookInScenes, GUILayout.Width(70)); GUI.enabled = ProjectSettings.Issues.lookInScenes; ProjectSettings.Issues.scenesSelection = (IssuesFinderSettings.ScenesSelection)EditorGUILayout.EnumPopup(ProjectSettings.Issues.scenesSelection); GUI.enabled = true; } ProjectSettings.Issues.lookInAssets = EditorGUILayout.ToggleLeft(new GUIContent("File assets", "Uncheck to exclude all file assets like prefabs, ScriptableObjects and such from the search. Check readme for additional details."), ProjectSettings.Issues.lookInAssets); ProjectSettings.Issues.lookInProjectSettings = EditorGUILayout.ToggleLeft(new GUIContent("Project Settings", "Uncheck to exclude all file assets like prefabs, ScriptableObjects and such from the search. Check readme for additional details."), ProjectSettings.Issues.lookInProjectSettings); UIHelpers.Separator(5); var canScanGamObjects = ProjectSettings.Issues.lookInScenes || ProjectSettings.Issues.lookInAssets; GUI.enabled = canScanGamObjects; var scanGameObjects = UIHelpers.ToggleFoldout(ref ProjectSettings.Issues.scanGameObjects, ref UserSettings.Issues.scanGameObjectsFoldout, new GUIContent("Game Objects", "Specify if you wish to look for GameObjects issues."), GUILayout.Width(110)); GUI.enabled = scanGameObjects && canScanGamObjects; if (UserSettings.Issues.scanGameObjectsFoldout) { UIHelpers.IndentLevel(); ProjectSettings.Issues.touchInactiveGameObjects = EditorGUILayout.ToggleLeft(new GUIContent("Inactive Game Objects", "Uncheck to exclude all inactive Game Objects from the search."), ProjectSettings.Issues.touchInactiveGameObjects); ProjectSettings.Issues.touchDisabledComponents = EditorGUILayout.ToggleLeft(new GUIContent("Disabled Components", "Uncheck to exclude all disabled Components from the search."), ProjectSettings.Issues.touchDisabledComponents); UIHelpers.UnIndentLevel(); } GUI.enabled = true; } GUILayout.Space(10); } GUILayout.Space(10); } }
protected override void DrawSettingsBody() { // ---------------------------------------------------------------------------- // filtering settings // ---------------------------------------------------------------------------- using (layout.Vertical(UIHelpers.panelWithBackground)) { GUILayout.Space(5); if (UIHelpers.ImageButton("Manage Filters...", CSIcons.Gear)) { IssuesFiltersWindow.Create(); } GUILayout.Space(5); /* Game Object Issues filtering */ GUILayout.Label("<b><size=12>Game Object Issues filtering</size></b>", UIHelpers.richLabel); UIHelpers.Separator(); GUILayout.Space(5); using (layout.Horizontal()) { MaintainerSettings.Issues.lookInScenes = EditorGUILayout.ToggleLeft(new GUIContent("Scenes", "Uncheck to exclude all scenes from search or select filtering level:\n\n" + "All Scenes: all project scenes with respect to configured filters.\n" + "Included Scenes: scenes included via Manage Filters > Scene Includes.\n" + "Current Scene: currently opened scene including any additional loaded scenes."), MaintainerSettings.Issues.lookInScenes, GUILayout.Width(70)); GUI.enabled = MaintainerSettings.Issues.lookInScenes; MaintainerSettings.Issues.scenesSelection = (IssuesFinderSettings.ScenesSelection)EditorGUILayout.EnumPopup(MaintainerSettings.Issues.scenesSelection); GUI.enabled = true; } MaintainerSettings.Issues.lookInAssets = EditorGUILayout.ToggleLeft(new GUIContent("Prefab assets", "Uncheck to exclude all prefab assets files from the search. Check readme for additional details."), MaintainerSettings.Issues.lookInAssets); MaintainerSettings.Issues.touchInactiveGameObjects = EditorGUILayout.ToggleLeft(new GUIContent("Inactive GameObjects", "Uncheck to exclude all inactive Game Objects from the search."), MaintainerSettings.Issues.touchInactiveGameObjects); MaintainerSettings.Issues.touchDisabledComponents = EditorGUILayout.ToggleLeft(new GUIContent("Disabled Components", "Uncheck to exclude all disabled Components from the search."), MaintainerSettings.Issues.touchDisabledComponents); GUILayout.Space(2); } using (layout.Vertical(UIHelpers.panelWithBackground, GUILayout.ExpandHeight(true))) { GUILayout.Space(5); GUILayout.Label("<b><size=12>Search for:</size></b>", UIHelpers.richLabel); settingsSectionScrollPosition = GUILayout.BeginScrollView(settingsSectionScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar); // ---------------------------------------------------------------------------- // Game Object Issues // ---------------------------------------------------------------------------- GUI.enabled = UIHelpers.ToggleFoldout(ref MaintainerSettings.Issues.scanGameObjects, ref MaintainerSettings.Issues.gameObjectsFoldout, new GUIContent("<b>Game Object Issues</b>", "Group of issues related to the Game Objects.")); if (MaintainerSettings.Issues.gameObjectsFoldout) { GUILayout.Space(-2); UIHelpers.Indent(); if (DrawSettingsSearchSectionHeader(SettingsSearchSection.Common, ref MaintainerSettings.Issues.commonFoldout)) { MaintainerSettings.Issues.missingComponents = EditorGUILayout.ToggleLeft(new GUIContent("Missing components", "Search for the missing components on the Game Objects."), MaintainerSettings.Issues.missingComponents); MaintainerSettings.Issues.duplicateComponents = EditorGUILayout.ToggleLeft(new GUIContent("Duplicate components", "Search for the multiple instances of the same component with same values on the same object."), MaintainerSettings.Issues.duplicateComponents); bool show = MaintainerSettings.Issues.duplicateComponents; if (show) { EditorGUI.indentLevel++; MaintainerSettings.Issues.duplicateComponentsPrecise = EditorGUILayout.ToggleLeft(new GUIContent("Precise mode", "Uncheck to ignore component's values."), MaintainerSettings.Issues.duplicateComponentsPrecise); EditorGUI.indentLevel--; } MaintainerSettings.Issues.missingReferences = EditorGUILayout.ToggleLeft(new GUIContent("Missing references", "Search for any missing references in the serialized fields of the components."), MaintainerSettings.Issues.missingReferences); MaintainerSettings.Issues.undefinedTags = EditorGUILayout.ToggleLeft(new GUIContent("Objects with undefined tags", "Search for GameObjects without any tag."), MaintainerSettings.Issues.undefinedTags); MaintainerSettings.Issues.inconsistentTerrainData = EditorGUILayout.ToggleLeft(new GUIContent("Inconsistent Terrain Data", "Search for Game Objects where Terrain and TerrainCollider have different Terrain Data."), MaintainerSettings.Issues.inconsistentTerrainData); } if (DrawSettingsSearchSectionHeader(SettingsSearchSection.PrefabsSpecific, ref MaintainerSettings.Issues.prefabsFoldout)) { MaintainerSettings.Issues.missingPrefabs = EditorGUILayout.ToggleLeft(new GUIContent("Missing prefabs", "Search for instances of prefabs which were removed from project."), MaintainerSettings.Issues.missingPrefabs); MaintainerSettings.Issues.disconnectedPrefabs = EditorGUILayout.ToggleLeft(new GUIContent("Disconnected prefabs", "Search for disconnected prefabs instances."), MaintainerSettings.Issues.disconnectedPrefabs); } if (DrawSettingsSearchSectionHeader(SettingsSearchSection.UnusedComponents, ref MaintainerSettings.Issues.unusedFoldout)) { MaintainerSettings.Issues.emptyMeshColliders = EditorGUILayout.ToggleLeft("MeshColliders w/o meshes", MaintainerSettings.Issues.emptyMeshColliders); MaintainerSettings.Issues.emptyMeshFilters = EditorGUILayout.ToggleLeft("MeshFilters w/o meshes", MaintainerSettings.Issues.emptyMeshFilters); MaintainerSettings.Issues.emptyAnimations = EditorGUILayout.ToggleLeft("Animations w/o clips", MaintainerSettings.Issues.emptyAnimations); MaintainerSettings.Issues.emptyRenderers = EditorGUILayout.ToggleLeft("Renders w/o materials", MaintainerSettings.Issues.emptyRenderers); MaintainerSettings.Issues.emptySpriteRenderers = EditorGUILayout.ToggleLeft("SpriteRenders w/o sprites", MaintainerSettings.Issues.emptySpriteRenderers); MaintainerSettings.Issues.emptyTerrainCollider = EditorGUILayout.ToggleLeft("TerrainColliders w/o Terrain Data", MaintainerSettings.Issues.emptyTerrainCollider); MaintainerSettings.Issues.emptyAudioSource = EditorGUILayout.ToggleLeft("AudioSources w/o AudioClips", MaintainerSettings.Issues.emptyAudioSource); } if (DrawSettingsSearchSectionHeader(SettingsSearchSection.Neatness, ref MaintainerSettings.Issues.neatnessFoldout)) { MaintainerSettings.Issues.emptyArrayItems = EditorGUILayout.ToggleLeft(new GUIContent("Empty array items", "Look for any unused items in arrays."), MaintainerSettings.Issues.emptyArrayItems); bool show = MaintainerSettings.Issues.emptyArrayItems; if (show) { EditorGUI.indentLevel++; MaintainerSettings.Issues.skipEmptyArrayItemsOnPrefabs = EditorGUILayout.ToggleLeft(new GUIContent("Skip prefab files", "Ignore empty array items in prefab files."), MaintainerSettings.Issues.skipEmptyArrayItemsOnPrefabs); EditorGUI.indentLevel--; } MaintainerSettings.Issues.unnamedLayers = EditorGUILayout.ToggleLeft(new GUIContent("Objects with unnamed layers", "Search for GameObjects with unnamed layers."), MaintainerSettings.Issues.unnamedLayers); MaintainerSettings.Issues.hugePositions = EditorGUILayout.ToggleLeft(new GUIContent("Objects with huge positions", "Search for GameObjects with huge world positions (> |100 000| on any axis)."), MaintainerSettings.Issues.hugePositions); } UIHelpers.UnIndent(); } GUI.enabled = true; // ---------------------------------------------------------------------------- // Project Settings Issues // ---------------------------------------------------------------------------- GUI.enabled = UIHelpers.ToggleFoldout(ref MaintainerSettings.Issues.scanProjectSettings, ref MaintainerSettings.Issues.projectSettingsFoldout, new GUIContent("<b>Project Settings Issues</b>", "Group of issues related to the settings of the current project.")); if (MaintainerSettings.Issues.projectSettingsFoldout) { UIHelpers.Indent(); MaintainerSettings.Issues.duplicateScenesInBuild = EditorGUILayout.ToggleLeft(new GUIContent("Duplicate scenes in build", "Search for the duplicates at the 'Scenes In Build' section of the Build Settings."), MaintainerSettings.Issues.duplicateScenesInBuild); MaintainerSettings.Issues.duplicateTagsAndLayers = EditorGUILayout.ToggleLeft(new GUIContent("Duplicates in Tags and Layers", "Search for the duplicate items at the 'Tags and Layers' Project Settings."), MaintainerSettings.Issues.duplicateTagsAndLayers); UIHelpers.UnIndent(); } GUI.enabled = true; GUILayout.EndScrollView(); UIHelpers.Separator(); using (layout.Horizontal()) { if (UIHelpers.ImageButton("Check all", CSIcons.SelectAll)) { MaintainerSettings.Issues.SwitchAll(true); } if (UIHelpers.ImageButton("Uncheck all", CSIcons.SelectNone)) { MaintainerSettings.Issues.SwitchAll(false); } } } if (UIHelpers.ImageButton("Reset", "Resets settings to defaults.", CSIcons.Restore)) { MaintainerSettings.Issues.Reset(); } }