From 830e212cf40cabf806fb7a15da6f2f3bc7008d37 Mon Sep 17 00:00:00 2001 From: Unity Technologies Date: Thu, 17 Sep 2026 12:15:56 +0000 Subject: [PATCH 1/8] Unity 6000.7.0b1 C# reference source code --- .../BeeBuildProgramCommon.Data.gen.csproj | 2 +- .../PlayerBuildProgramLibrary.Data/Data.cs | 2 + .../PlayerBuildProgramLibrary.Data.gen.csproj | 2 +- ...iptCompilationBuildProgram.Data.gen.csproj | 2 +- .../2D/Common/TexturePlatformSettingsView.cs | 28 +- .../SpriteAtlasImporterInspector.cs | 54 +- .../2D/SpriteAtlas/SpriteAtlasInspector.cs | 50 +- .../UserAccessibilitySettings.cs | 3 + .../AnimationEventWrapperInspector.cs | 10 +- .../Mono/Animation/CurveEditor/CurveEditor.cs | 6 +- .../CurveEditor/CurveEditorWindow.cs | 11 +- .../Animation/CurveEditor/CurveMenuManager.cs | 68 +- .../CurveEditor/MinMaxCurveEditorWindow.cs | 8 +- Editor/Mono/AnimatorController.bindings.cs | 2 +- Editor/Mono/Annotation/AnnotationWindow.cs | 31 +- .../Mono/Annotation/LayerVisibilityWindow.cs | 7 +- .../Mono/Annotation/SceneRenderModeWindow.cs | 2 +- .../Mono/Annotation/SceneViewCameraWindow.cs | 10 +- Editor/Mono/AssemblyInfo/AssemblyInfo.cs | 7 + Editor/Mono/AssemblyReloadEvents.cs | 6 + .../AssetDatabase/ImporterGlobalSettings.cs | 217 + Editor/Mono/AssetModificationProcessor.cs | 6 + .../AssetImportCallbackDispatch.cs | 423 + .../AssetImportContext.bindings.cs | 4 +- .../SpeedTree/SpeedTree9ImporterEditor.cs | 8 +- .../SpeedTree9ImporterMaterialEditor.cs | 18 +- .../SpeedTree9ImporterModelEditor.cs | 2 +- .../SpeedTree/SpeedTree9ImporterWindEditor.cs | 8 +- .../SpeedTree/SpeedTreeImporterCommon.cs | 64 +- .../AssetPipeline/TextureImporter.bindings.cs | 2 + Editor/Mono/AssetPostprocessor.cs | 353 +- Editor/Mono/AssetStore/AssetStoreWindow.cs | 6 - Editor/Mono/AttributeHelper.cs | 3 + .../AudioRandomContainerQuitAnalyticsEvent.cs | 2 - Editor/Mono/Audio/AudioContainerWindow.cs | 6 - .../Mono/Audio/AudioContainerWindowState.cs | 2 - .../Mono/Audio/Mixer/AudioMixerDescription.cs | 2 - .../Mixer/GUI/AudioMixerChannelStripView.cs | 12 +- .../Audio/Mixer/GUI/AudioMixerDrawUtils.cs | 24 +- .../Audio/Mixer/GUI/AudioMixerEffectGUI.cs | 18 +- .../Audio/Mixer/GUI/AudioMixerEffectView.cs | 30 +- .../GUI/AudioMixerExposedParameterView.cs | 4 +- .../GUI/AudioMixerExposedParametersPopup.cs | 4 +- .../Mixer/GUI/AudioMixerGroupTreeView.cs | 18 +- .../Mixer/GUI/AudioMixerGroupViewList.cs | 12 +- .../Audio/Mixer/GUI/AudioMixerSnapshotView.cs | 16 +- .../Mono/Audio/Mixer/GUI/AudioMixerWindow.cs | 48 +- .../Audio/Mixer/GUI/AudioMixersTreeView.cs | 12 +- Editor/Mono/Audio/StreamedAudioClipPreview.cs | 6 +- .../AudioContainerElementClipField.cs | 2 - .../UIElements/OnAudioFilterReadLevelMeter.cs | 2 - Editor/Mono/BuildPipeline/AssemblyStripper.cs | 28 +- Editor/Mono/BuildPipeline/BuildPlatform.cs | 4 +- Editor/Mono/BuildPipeline/BuildTarget.cs | 1 + .../BuildTargetDiscovery.bindings.cs | 145 +- Editor/Mono/BuildPipeline/BuildTargetGroup.cs | 1 + .../DesktopStandaloneBuildWindowExtension.cs | 12 +- .../DesktopStandalonePostProcessor.cs | 5 +- Editor/Mono/BuildPipeline/NamedBuildTarget.cs | 2 - .../BuildAssetBundlesParameters.bindings.cs | 1 - .../Settings/BuildPlayerOptions.bindings.cs | 1 - Editor/Mono/BuildPlayerSceneTreeView.cs | 2 +- Editor/Mono/BuildPlayerWindow.cs | 92 +- Editor/Mono/BuildProfile/BuildProfile.API.cs | 204 +- .../Mono/BuildProfile/BuildProfile.Create.cs | 6 +- .../Mono/BuildProfile/BuildProfileContext.cs | 20 +- .../BuildProfileEntitlementClaimInfo.cs | 402 + .../BuildProfileInitialization.cs | 70 +- .../BuildProfile/BuildProfileModuleUtil.cs | 54 +- .../BuildProfilePackageAddInfo.cs | 18 +- .../BuildProfilePlayerSettings.bindings.cs | 21 +- .../BuildProfilePlayerSettings.cs | 3 + .../BuildProfilePlayerSettingsEditor.cs | 13 + .../BuildProfileQualitySettingsEditor.cs | 2 +- .../IPackageServiceInfoProvider.cs | 32 + .../IMarketplaceWebRequestSender.cs | 71 + .../IServiceTokenProvider.cs | 22 + .../MarketplaceApiError.cs | 98 + .../MarketplaceEditorApiClient.cs | 100 + .../MarketplaceEditorApiModels.cs | 246 + .../MarketplaceEditorApi/MarketplaceJson.cs | 66 + .../PlatformPackageServiceInfoProvider.cs | 317 +- .../Mono/BuildProfile/ReferencedComponent.cs | 36 + .../BuildProfile/SharedPlatformSettings.cs | 2 +- Editor/Mono/Clipboard/Clipboard.cs | 4 + Editor/Mono/Clipboard/ClipboardContextMenu.cs | 28 +- .../CodeEditor/DefaultExternalCodeEditor.cs | 2 +- Editor/Mono/CompilationPipeline.bindings.cs | 1 + Editor/Mono/ConsoleWindow.cs | 32 +- Editor/Mono/ConsoleWindowUtility.cs | 3 + Editor/Mono/ContainerWindow.cs | 25 +- Editor/Mono/CutBoard.cs | 8 +- Editor/Mono/DragAndDrop.bindings.cs | 3 + Editor/Mono/DrivenRectTransformUndo.cs | 5 +- Editor/Mono/EditorApplication.cs | 47 + Editor/Mono/EditorGUI.cs | 77 +- Editor/Mono/EditorGUILayout.cs | 2 +- Editor/Mono/EditorGUIUtility.bindings.cs | 2 +- Editor/Mono/EditorGUIUtility.cs | 128 +- Editor/Mono/EditorMode/ModeService.cs | 6 + Editor/Mono/EditorPrefs.bindings.cs | 3 + Editor/Mono/EditorSceneManager.cs | 3 + Editor/Mono/EditorSettings.bindings.cs | 4 + .../EditorUserBuildSettingsQNX.bindings.cs | 25 + Editor/Mono/EditorUtility.cs | 3 + Editor/Mono/EditorWindow.cs | 11 +- .../ExternalPlayModeView.cs | 2 - Editor/Mono/FileUtil.cs | 77 + Editor/Mono/GUI/AboutWindow.cs | 6 - Editor/Mono/GUI/AppStatusBar.cs | 6 +- Editor/Mono/GUI/AssetPopupBackend.cs | 2 +- Editor/Mono/GUI/AssetSaveDialog.cs | 12 +- Editor/Mono/GUI/CacheServerToggle.cs | 17 +- Editor/Mono/GUI/CacheServerWindow.cs | 12 +- Editor/Mono/GUI/ColorPicker.cs | 29 +- Editor/Mono/GUI/DockArea.cs | 16 +- Editor/Mono/GUI/EditorGUIInternal.cs | 4 +- Editor/Mono/GUI/EditorStyles.cs | 39 + Editor/Mono/GUI/FallbackEditorWindow.cs | 4 +- Editor/Mono/GUI/FlexibleMenu/FlexibleMenu.cs | 6 +- Editor/Mono/GUI/GradientEditor.cs | 14 +- Editor/Mono/GUI/GradientPicker.cs | 5 +- Editor/Mono/GUI/ManagedDebuggerToggle.cs | 8 +- Editor/Mono/GUI/ManagedDebuggerWindow.cs | 12 +- Editor/Mono/GUI/MaskFieldGUI.cs | 3 + Editor/Mono/GUI/ObjectField.cs | 6 +- Editor/Mono/GUI/PopupWindow.cs | 2 - Editor/Mono/GUI/PopupWindowWithoutFocus.cs | 5 +- .../Dictionary/DictionaryDrawerIMGUI.cs | 98 +- .../Dictionary/DictionaryDrawerShared.cs | 39 +- .../Dictionary/DictionaryView.cs | 93 +- Editor/Mono/GUI/RenameOverlay.cs | 2 - Editor/Mono/GUI/ReorderableList.cs | 18 +- Editor/Mono/GUI/Toolbars/Toolbar.cs | 120 +- .../TreeView/GameObjectTreeViewDataSource.cs | 2 - .../GUI/TreeView/GameObjectTreeViewGUI.cs | 2 - Editor/Mono/GUI/TreeView/MultiColumnHeader.cs | 2 +- Editor/Mono/GUI/TreeView/SubSceneGUI.cs | 2 +- Editor/Mono/GUI/TreeView/ToggleTreeView.cs | 8 +- .../TreeViewTests/TreeViewTestWindow.cs | 8 +- Editor/Mono/GUI/WindowLayout.cs | 2 + Editor/Mono/GUIDebugger/BaseInspectView.cs | 4 +- .../Mono/GUIDebugger/GUIViewDebuggerWindow.cs | 17 +- Editor/Mono/GUIView.cs | 3 + Editor/Mono/GameObjectUtility.bindings.cs | 7 +- Editor/Mono/GameObjectUtility.deprecated.cs | 11 +- Editor/Mono/GameView/GameView.cs | 30 +- Editor/Mono/GameView/GameViewSizeMenu.cs | 2 +- .../GameView/GameViewSizesMenuModifyItemUI.cs | 16 +- .../Graphics/D3D12DeviceFilterListsEditor.cs | 24 +- .../Graphics/VulkanDeviceFilterListsEditor.cs | 20 +- .../Graphics/WebGPUDeviceFilterListsEditor.cs | 30 +- .../BoundsHandle/PrimitiveBoundsHandle.cs | 4 +- Editor/Mono/Handles/HandleUtility.cs | 2 + Editor/Mono/Handles/Handles.cs | 4 +- Editor/Mono/HierarchyPreferences.cs | 40 +- Editor/Mono/HostView.cs | 22 +- Editor/Mono/IconSelector.cs | 7 +- .../DesktopPluginImporterExtension.cs | 18 +- .../EditorPluginImporterExtension.cs | 8 +- .../ImportSettings/ExposeTransformEditor.cs | 4 +- .../IHVImageFormatImporterInspector.cs | 10 +- .../SpeedTreeImporterInspector.cs | 8 +- .../SpeedTreeImporterMaterialEditor.cs | 26 +- .../SpeedTreeImporterModelEditor.cs | 76 +- .../TextureImportPlatformSettings.cs | 4 +- .../TextureImporterInspector.cs | 219 +- Editor/Mono/Inspector/AimConstraintEditor.cs | 26 +- Editor/Mono/Inspector/AnimationClipEditor.cs | 102 +- Editor/Mono/Inspector/AnimatorInspector.cs | 8 +- .../AssemblyDefinitionImporterInspector.cs | 48 +- ...blyDefinitionReferenceImporterInspector.cs | 6 +- Editor/Mono/Inspector/AssetBundleNameGUI.cs | 2 +- .../Mono/Inspector/AudioChorusFilterEditor.cs | 14 +- Editor/Mono/Inspector/AudioClipInspector.cs | 6 +- .../AudioDistortionFilterInspector.cs | 2 +- .../Inspector/AudioEchoFilterInspector.cs | 8 +- .../Inspector/AudioHighPassFilterInspector.cs | 4 +- .../Inspector/AudioLowPassFilterInspector.cs | 4 +- .../Mono/Inspector/AudioManagerInspector.cs | 67 +- .../AudioMixerControllerInspector.cs | 6 +- .../Mono/Inspector/AudioReverbZoneEditor.cs | 32 +- Editor/Mono/Inspector/AudioSourceInspector.cs | 38 +- .../Inspector/AutodeskInteractiveShaderGUI.cs | 30 +- Editor/Mono/Inspector/Avatar/AvatarControl.cs | 2 - Editor/Mono/Inspector/Avatar/AvatarEditor.cs | 8 +- .../Inspector/Avatar/AvatarMappingEditor.cs | 50 +- .../Inspector/Avatar/AvatarMuscleEditor.cs | 50 +- .../Inspector/Avatar/AvatarSkeletonDrawer.cs | 2 +- Editor/Mono/Inspector/AvatarMaskInspector.cs | 26 +- Editor/Mono/Inspector/AvatarPreview.cs | 26 +- .../Mono/Inspector/BillboardAssetInspector.cs | 4 +- .../Inspector/BillboardRendererInspector.cs | 2 +- Editor/Mono/Inspector/BlendTreeInspector.cs | 12 +- Editor/Mono/Inspector/CameraEditor.cs | 90 +- Editor/Mono/Inspector/CameraOverlay.cs | 7 +- Editor/Mono/Inspector/CanvasEditor.cs | 22 +- Editor/Mono/Inspector/CanvasRendererEditor.cs | 2 +- .../ComputeShaderImporterInspector.cs | 2 +- .../Mono/Inspector/ComputeShaderInspector.cs | 8 +- .../ConstrainProportionsTransformScale.cs | 2 +- Editor/Mono/Inspector/ConstraintEditorBase.cs | 14 +- .../Core/AddComponent/AddComponentWindow.cs | 2 - .../AdvancedDropdown/AdvancedDropdownGUI.cs | 111 +- .../AdvancedDropdownWindow.cs | 9 +- .../EditorGUI/StatelessAdvancedDropdown.cs | 2 - Editor/Mono/Inspector/Core/InspectorWindow.cs | 16 +- Editor/Mono/Inspector/Core/PreviewWindow.cs | 10 +- Editor/Mono/Inspector/Core/PropertyEditor.cs | 55 +- Editor/Mono/Inspector/Core/RootEditor.cs | 8 +- .../Implementations/ExposedReferenceDrawer.cs | 8 +- .../ScriptAttributeGUI/PropertyHandler.cs | 6 + .../ScriptAttributeUtility.cs | 42 +- .../Core/Utils/InspectorWindowUtils.cs | 2 - .../Core/Utils/ObsoleteMessageHelper.cs | 3 + .../Mono/Inspector/CubemapArrayInspector.cs | 2 +- Editor/Mono/Inspector/CubemapInspector.cs | 2 +- Editor/Mono/Inspector/CubemapPreview.cs | 6 +- .../Inspector/CustomRenderTextureEditor.cs | 44 +- Editor/Mono/Inspector/DirectorEditor.cs | 18 +- Editor/Mono/Inspector/Editor.cs | 2 +- .../Mono/Inspector/EditorSettingsInspector.cs | 204 +- Editor/Mono/Inspector/GameObjectInspector.cs | 36 +- .../Inspector/GraphicsSettingsInspector.cs | 4 +- .../GraphicsSettingsInspectorTierSettings.cs | 52 +- ...rPipelineGraphicsSettingsPropertyDrawer.cs | 5 +- Editor/Mono/Inspector/LODGUI.cs | 66 +- Editor/Mono/Inspector/LODGroupEditor.cs | 80 +- Editor/Mono/Inspector/LayoutDropdownWindow.cs | 4 +- Editor/Mono/Inspector/LightEditor.cs | 112 +- .../Inspector/LightProbeGroupInspector.cs | 24 +- .../Inspector/LightProbeProxyVolumeEditor.cs | 47 +- .../Mono/Inspector/LightingSettingsEditor.cs | 239 +- .../Mono/Inspector/LineRendererCurveEditor.cs | 2 +- Editor/Mono/Inspector/LineRendererEditor.cs | 46 +- .../Mono/Inspector/LookAtConstraintEditor.cs | 10 +- Editor/Mono/Inspector/MaterialEditor.cs | 77 +- Editor/Mono/Inspector/MemorySettingsEditor.cs | 114 +- Editor/Mono/Inspector/MeshPreview.cs | 12 +- Editor/Mono/Inspector/MeshRendererEditor.cs | 4 +- .../Inspector/MinMaxCurvePropertyDrawer.cs | 8 +- .../Inspector/MinMaxGradientPropertyDrawer.cs | 10 +- Editor/Mono/Inspector/ModelInspector.cs | 4 +- .../Mono/Inspector/ParentConstraintEditor.cs | 16 +- .../ParticleSystemForceFieldInspector.cs | 56 +- .../PlayerSettingsEditor.cs | 658 +- .../PlayerSettingsIconsEditor.cs | 6 +- .../PlayerSettingsSplashScreenEditor.cs | 44 +- .../WebTemplateManagerBase.cs | 2 +- .../Inspector/PositionConstraintEditor.cs | 6 +- .../Mono/Inspector/QualitySettingsEditor.cs | 128 +- .../Inspector/RayTracingShaderInspector.cs | 20 +- Editor/Mono/Inspector/RectTransformEditor.cs | 32 +- .../Mono/Inspector/ReflectionProbeEditor.cs | 66 +- .../Inspector/RenderPipelineAssetSelector.cs | 2 +- .../Inspector/RenderPipelineEditorUtility.cs | 3 + Editor/Mono/Inspector/RenderTextureEditor.cs | 32 +- Editor/Mono/Inspector/RendererEditorBase.cs | 54 +- .../Inspector/RendererLightingSettings.cs | 120 +- .../Mono/Inspector/ReorderableListWrapper.cs | 2 - .../Inspector/RotationConstraintEditor.cs | 6 +- .../Mono/Inspector/ScaleConstraintEditor.cs | 6 +- .../ScriptExecutionOrderInspector.cs | 10 +- .../Mono/Inspector/ShaderImporterInspector.cs | 2 +- Editor/Mono/Inspector/ShaderInspector.cs | 24 +- .../ShaderVariantCollectionInspector.cs | 6 +- .../Inspector/SkinnedMeshRendererEditor.cs | 14 +- .../Inspector/SkyboxPanoramicShaderGUI.cs | 4 +- Editor/Mono/Inspector/SortingGroupEditor.cs | 4 +- .../Inspector/SortingLayerEditorUtility.cs | 4 +- Editor/Mono/Inspector/SpeedTree8ShaderGUI.cs | 42 +- Editor/Mono/Inspector/SpeedTree9ShaderGUI.cs | 54 +- Editor/Mono/Inspector/SpriteFrameInspector.cs | 16 +- Editor/Mono/Inspector/SpriteRendererEditor.cs | 36 +- .../Inspector/StandardParticlesShaderGUI.cs | 74 +- Editor/Mono/Inspector/StandardShaderGUI.cs | 40 +- Editor/Mono/Inspector/TagManagerInspector.cs | 10 +- .../Mono/Inspector/Texture2DArrayPreview.cs | 2 - Editor/Mono/Inspector/Texture3DPreview.cs | 22 +- Editor/Mono/Inspector/TextureInspector.cs | 34 +- Editor/Mono/Inspector/TimeControl.cs | 2 - Editor/Mono/Inspector/TimeManagerInspector.cs | 8 +- Editor/Mono/Inspector/TrailRendererEditor.cs | 46 +- Editor/Mono/Inspector/TransformInspector.cs | 6 +- Editor/Mono/Inspector/TransformRotationGUI.cs | 2 +- .../VisualElements/ObjectFieldWithPrompt.cs | 2 - .../ProjectSettings/BuiltInShaderElement.cs | 2 - .../VisualElements/RenderingLayerMaskField.cs | 2 - Editor/Mono/Inspector/WindInspector.cs | 12 +- Editor/Mono/InternalEditorUtility.bindings.cs | 8 +- .../Loadable/LoadableObjectIdEditorUtility.cs | 6 +- Editor/Mono/MaterialProperty.cs | 18 +- Editor/Mono/Menu.bindings.cs | 3 + Editor/Mono/Modules/BeeBuildPostprocessor.cs | 1 + .../Modules/DefaultBuildProfileExtension.cs | 36 +- .../Modules/DefaultBuildWindowExtension.cs | 6 +- .../DefaultPlayerSettingsEditorExtension.cs | 2 +- .../DefaultTextureImportSettingsExtension.cs | 30 +- Editor/Mono/Modules/ModuleManager.cs | 6 + ...onfigurableDerivedBuildTargetExtensions.cs | 2 +- .../ConfigurableSDKPlatformExtension.cs | 1 - .../PlatformSDK/ISDKPlatformExtension.cs | 1 - .../PlatformSDK/SDKPlatformProvider.cs | 26 - .../Mono/Modules/PlatformSDK/SDKPublicAPI.cs | 21 - .../PlayerConnection/AttachToPlayerGUI.cs | 16 +- .../PlayerConnection/ConnectionDropDown.cs | 15 +- Editor/Mono/ObjectListArea.cs | 4 +- Editor/Mono/ObjectSelector.cs | 13 +- .../Overlays/DynamicPanelOverlayContainer.cs | 2 - Editor/Mono/Overlays/MainToolbar.cs | 159 +- Editor/Mono/Overlays/MainToolbarAnalytics.cs | 2 - Editor/Mono/Overlays/MainToolbarElement.cs | 1 + .../Overlays/MainToolbarOverlayContainer.cs | 2 - Editor/Mono/Overlays/Overlay.cs | 2 + Editor/Mono/Overlays/OverlayCanvas.cs | 4 +- Editor/Mono/Overlays/OverlayDragger.cs | 2 - Editor/Mono/Overlays/OverlayMenuItem.cs | 2 - Editor/Mono/Overlays/OverlayPopup.cs | 2 - Editor/Mono/Overlays/OverlayPopupWindow.cs | 2 - Editor/Mono/Overlays/OverlayResizer.cs | 2 - Editor/Mono/Overlays/OverlayUtilities.cs | 6 + Editor/Mono/PerformanceTools/FrameDebugger.cs | 6 +- .../PerformanceTools/FrameDebuggerStyles.cs | 126 +- .../Mono/PlatformSupport/PlatformIconField.cs | 2 - .../PlatformSupport/ProvisioningProfileGUI.cs | 8 +- .../PlatformSupport/ReorderableTextureList.cs | 2 - Editor/Mono/PlayModeTintResolver.cs | 14 +- Editor/Mono/PlayModeView/PlayModeView.cs | 13 +- Editor/Mono/PlayerSettings.bindings.cs | 27 +- Editor/Mono/PlayerSettingsAndroid.bindings.cs | 9 + Editor/Mono/PlayerSettingsSwitch.bindings.cs | 135 + Editor/Mono/PostprocessScene.cs | 22 +- Editor/Mono/Prefabs/PrefabFamilyPopup.cs | 74 +- Editor/Mono/Prefabs/PrefabImporterEditor.cs | 12 +- .../Prefabs/PrefabInstanceChangedListener.cs | 2 - .../PrefabOverridesTreeView.cs | 16 +- .../PrefabOverrides/PrefabOverridesWindow.cs | 64 +- Editor/Mono/Prefabs/PrefabReplaceUtility.cs | 4 +- Editor/Mono/Prefabs/PrefabUtility.cs | 20 +- .../AssetPipelinePreferences.cs | 12 +- .../CollectionsPreferences.cs | 12 +- .../PreferencesSettingsProviders.cs | 179 +- .../PopupWindowContentForNewLibrary.cs | 8 +- .../PresetLibraries/PresetLibraryEditor.cs | 16 +- .../PresetLibraryEditorMenu.cs | 18 +- .../ProjectBrowser/CachedFilteredHierachy.cs | 2 - Editor/Mono/ProjectBrowser/ProjectBrowser.cs | 50 +- .../ProjectBrowser/SearchableEditorWindow.cs | 8 +- Editor/Mono/ProjectTemplateWindow.cs | 4 +- Editor/Mono/PromptWindow/PromptWindow.cs | 2 - Editor/Mono/PromptWindow/PromptWindowBase.cs | 2 - Editor/Mono/RemoveLegacyMenuItems.cs | 2 - Editor/Mono/RenderDoc/RenderDoc.bindings.cs | 2 +- Editor/Mono/RenderDoc/RenderDocUtil.cs | 4 +- ...nderPipelineGraphicsSettingsContextMenu.cs | 4 +- .../RenderPipelineResourcesEditorUtils.cs | 2 - Editor/Mono/SavedEditorGUIState.cs | 173 + Editor/Mono/SavedGUIState.bindings.cs | 21 +- Editor/Mono/SceneHierarchy.cs | 128 +- Editor/Mono/SceneHierarchySortingWindow.cs | 6 - Editor/Mono/SceneHierarchyWindow.cs | 6 - .../SceneManagement/EditorSceneManager.cs | 10 + .../StageManager/PrefabStage/PrefabStage.cs | 26 +- .../SceneManagement/StageManager/Stage.cs | 4 +- .../DefaultLightingExplorerExtension.cs | 72 +- .../SceneModeWindows/LightingExplorerTab.cs | 2 +- .../LightingExplorerWindow.cs | 4 +- .../Mono/SceneModeWindows/LightingWindow.cs | 58 +- .../LightingWindowEnvironmentTab.cs | 2 +- .../LightingWindowLightingTab.cs | 6 +- .../LightingWindowLightmapPreviewTab.cs | 8 +- .../SceneModeWindows/LightmapPreviewWindow.cs | 50 +- .../OcclusionCullingWindow.cs | 30 +- Editor/Mono/SceneView/GridSettings.cs | 3 + .../Mono/SceneView/SceneOrientationGizmo.cs | 18 +- Editor/Mono/SceneView/SceneView.cs | 45 +- Editor/Mono/SceneView/SceneViewOverlays.cs | 2 +- .../Mono/SceneView/SceneViewToolbarStyles.cs | 6 + Editor/Mono/SceneView/SceneViewToolbars.cs | 2 - .../SceneVisibilityHierarchyGUI.cs | 34 +- .../APIUpdater/APIUpdaterManager.bindings.cs | 10 +- .../Mono/Scripting/CLILeakDetectionSwapper.cs | 36 + .../Scripting/ManagedDebugger.bindings.cs | 4 + .../ScriptCompilation/CompilationPipeline.cs | 10 +- .../ScriptCompilation/CustomScriptAssembly.cs | 5 +- .../EditorCompilationInterface.cs | 3 + .../MsBuild/MsBuildCompilation.cs | 24 +- ...nityEditorMSBuildPropsTargetsGeneration.cs | 3 +- Editor/Mono/Search/ObjectSelectorSearch.cs | 5 +- Editor/Mono/Search/OpenSearchHelper.cs | 4 +- Editor/Mono/Search/ProjectSearch.cs | 5 +- Editor/Mono/Search/SceneSearch.cs | 5 +- Editor/Mono/Search/SearchService.cs | 7 +- Editor/Mono/Selection/Selection.cs | 3 + Editor/Mono/Selection/SelectionHistory.cs | 3 + .../SerializedPropertyTreeView.cs | 6 +- Editor/Mono/Settings.cs | 5 + Editor/Mono/Settings/SettingsWindow.cs | 14 +- Editor/Mono/SettingsWindow/FogEditor.cs | 14 +- Editor/Mono/SettingsWindow/LightingEditor.cs | 48 +- .../SettingsWindow/OtherRenderingEditor.cs | 10 +- Editor/Mono/Shaders/MaterialHierarchyPopup.cs | 24 +- Editor/Mono/Shaders/ShaderBuildSettings.cs | 65 +- Editor/Mono/Shaders/ShaderBuildSettingsUI.cs | 362 +- ...ShaderKeywordDeclarationOverrideFoldout.cs | 24 + Editor/Mono/SpeedTreeMaterialFixer.cs | 2 +- Editor/Mono/Sprites/SpriteUtility.cs | 12 +- Editor/Mono/Sprites/SpriteUtilityWindow.cs | 14 +- Editor/Mono/Text/EditorTextSettings.cs | 9 +- Editor/Mono/Tools/BuiltinTools.cs | 16 +- Editor/Mono/Tools/EditorActionTool.cs | 2 - Editor/Mono/Tools/EditorToolGUI.cs | 6 +- Editor/Mono/Tools/EditorToolManager.cs | 2 - .../Mono/Tools/EditorToolSettingsOverlay.cs | 2 - Editor/Mono/Tools/EditorToolUtility.cs | 26 +- Editor/Mono/Tools/ToolManager.cs | 12 + Editor/Mono/TooltipView/TooltipView.cs | 7 +- .../Bindings/BindingStyleHelpers.cs | 33 +- .../UIElements/Bindings/BindingsInterface.cs | 3 + .../UIElements/Controls/AnimationClipField.cs | 2 - .../UIElements/Controls/BackgroundField.cs | 3 + .../Mono/UIElements/Controls/CursorField.cs | 2 - .../Controls/FontDefinitionField.cs | 2 - Editor/Mono/UIElements/Controls/FontField.cs | 2 - .../Mono/UIElements/Controls/GradientField.cs | 21 +- .../GridTemplateEditor/GridRepeatField.cs | 6 +- .../GridTemplateEditor/GridTrackSizeField.cs | 7 +- Editor/Mono/UIElements/Controls/LayerField.cs | 8 + .../Controls/LoadableObjectIdField.cs | 2 - .../Controls/LoadableSceneIdField.cs | 2 - .../Mono/UIElements/Controls/ObjectField.cs | 2 - Editor/Mono/UIElements/Controls/TagField.cs | 8 + .../Internal/DropdownOptionListItem.cs | 2 - .../Drawers/Internal/UnityEventItem.cs | 2 - .../UIElements/Inspector/InspectorElement.cs | 78 +- .../StyleSheets/StyleSheetImporter.cs | 4 +- .../StyleSheets/StyleSheetImporterImpl.cs | 5 +- .../UIElements/UIElementsEditorUtility.cs | 10 +- Editor/Mono/Undo/EditorObjectChangeEvents.cs | 3 + Editor/Mono/Undo/Undo.bindings.cs | 11 + Editor/Mono/Undo/UndoHistoryWindow.cs | 8 +- Editor/Mono/Undo/UndoSerializationWindow.cs | 4 +- Editor/Mono/Undo/UndoWindow.cs | 4 +- .../UnityConnect/UnityConnect.bindings.cs | 4 +- Editor/Mono/Utils/MenuUtils.cs | 2 +- .../Utils/MetroCertificatePasswordWindow.cs | 10 +- .../Utils/MetroCreateTestCertificateWindow.cs | 22 +- Editor/Mono/Utils/Paths.cs | 2 +- .../Common/VersionControlManager.cs | 19 +- .../Mono/VersionControl/UI/VCListControl.cs | 2 - .../Mono/VersionControl/UI/VCProjectHooks.cs | 2 +- .../Mono/VersionControl/UI/VCWindowChange.cs | 8 +- .../UI/VCWindowCheckoutFailure.cs | 6 - .../Mono/VersionControl/UI/VCWindowPending.cs | 24 +- .../Mono/VersionControl/UI/VCWindowResolve.cs | 8 +- .../Mono/VersionControl/UI/VCWindowRevert.cs | 8 +- External/AMDUnityPlugin/Scripts/AMDDevice.cs | 4 +- .../acceleratorclientcore.dll | Bin 181760 -> 201216 bytes External/NVUnityPlugin/Scripts/NVCommands.cs | 6 +- External/NVUnityPlugin/Scripts/NVDevice.cs | 8 +- External/NiceIO/NiceIO.cs | 53 +- .../Unity.Scripting/AssemblyInfo.cs | 10 + .../Unity.Scripting/Diagnostics/Debug.cs | 2 + .../Diagnostics/IScriptingCoreDebug.cs | 1 + .../Unity.Scripting/Diagnostics/StackTrace.cs | 37 +- .../AssemblyLoadedScopeIl2Cpp.cs | 3 + .../LifecycleController.cs | 1 + .../SharedWithEditor.cs | 4 +- .../Inspector/NavMeshAgentInspector.cs | 34 +- .../Inspector/NavMeshObstacleInspector.cs | 12 +- .../OffMeshLinkInspector.deprecated.cs | 14 +- .../Utilities/NavMeshEditorHelpers.cs | 4 +- Modules/AcceleratorClient/IsExternalInit.cs | 9 - .../Managed/AcceleratorClientLoadToken.cs | 15 - ...AcceleratorClientNativeCacheOp.bindings.cs | 47 + ...leratorClientNativeLoadTokenOp.bindings.cs | 13 + .../Managed/Contracts/CacheError.cs | 78 - .../Managed/Contracts/CacheValues.cs | 21 - .../Managed/Contracts/ConnectError.cs | 32 - .../LowLevel/AcceleratorV2ClientOptions.cs | 40 - .../Managed/LowLevel/BatchGetRaw.cs | 39 - .../Managed/LowLevel/BufferPoolConfig.cs | 22 - .../Managed/LowLevel/ContentKeyStub.cs | 25 - .../LowLevel/DefaultKeyValueHandlerFactory.cs | 17 - .../Managed/LowLevel/DictionaryPool.cs | 47 - .../Managed/LowLevel/ExceptionTranslator.cs | 154 - .../LowLevel/IKeyValueHandlerFactory.cs | 18 - .../Managed/LowLevel/KeyValueClient.cs | 2232 --- .../Managed/LowLevel/SyncClientTestApi.cs | 61 - .../Managed/Models/Result.cs | 84 - .../Managed/Telemetry/ITelemetrySink.cs | 17 - .../Managed/Telemetry/NullSink.cs | 32 - .../Managed/Telemetry/TelemetryEnums.cs | 37 - .../Managed/Telemetry/TelemetryEvent.cs | 51 - .../AccessibilityHierarchyViewerWindow.cs | 6 - .../Core/AdaptivePerformanceManager.cs | 66 +- .../IAdaptivePerformance.cs | 1 - .../IDevicePerformanceControl.cs | 3 +- .../IEnergyUsageControl.cs | 439 + .../AdaptivePerformance/IPerformanceStatus.cs | 9 +- .../Indexer/AdaptivePerformanceIndexer.cs | 12 +- .../Scalers/AdaptiveBatching.cs | 2 - .../Scalers/AdaptiveDecals.cs | 2 - .../Scalers/AdaptiveFramerate.cs | 2 - .../Scalers/AdaptiveLOD.cs | 2 - .../Scalers/AdaptiveLayerCulling.cs | 2 - .../Scalers/AdaptiveLut.cs | 2 - .../Scalers/AdaptiveMSAA.cs | 2 - .../Scalers/AdaptiveOnDemandRendering.cs | 6 +- .../Scalers/AdaptivePhysics.cs | 2 - .../Scalers/AdaptiveResolution.cs | 2 - .../Scalers/AdaptiveShadowCascade.cs | 2 - .../Scalers/AdaptiveShadowDistance.cs | 2 - .../Scalers/AdaptiveShadowQuality.cs | 2 - .../Scalers/AdaptiveShadowmapResolution.cs | 2 - .../Scalers/AdaptiveSorting.cs | 2 - .../Scalers/AdaptiveTransparency.cs | 2 - .../Scalers/AdaptiveViewDistance.cs | 2 - .../Subsystem/AdaptivePerformanceSubsystem.cs | 134 +- .../AdaptivePerformanceUIExtension.cs | 83 + .../AdaptivePerformanceLoaderOrderUI.cs | 4 +- .../Management/EditorUtilities.cs | 2 - .../AdaptivePerformancePackageMetadata.cs | 8 + .../Management/ProviderSettingsEditor.cs | 84 +- .../SimulatorAdaptivePerformanceSubsystem.cs | 52 +- .../BuildProfileAdaptivePerformanceToggle.cs | 2 - .../ScriptBindings/HumanTrait.bindings.cs | 11 +- .../AnimationWindow/Editor/AddCurvesPopup.cs | 6 - .../Editor/AddCurvesPopupHierarchy.cs | 2 +- .../Editor/AddCurvesPopupHierarchyGUI.cs | 6 +- .../Editor/AnimationContextualPropertyMenu.cs | 26 +- .../AnimationWindow/Editor/AnimationWindow.cs | 4 - .../Editor/AnimationWindowHierarchyGUI.cs | 8 +- .../Editor/AnimationWindowSearchView.cs | 2 - .../Editor/AnimationWindowStyles.cs | 52 +- .../Editor/Builtin/AnimationEventTimeline.cs | 12 +- .../AnimationWindow/Editor/DopeSheetEditor.cs | 2 - .../Editor/Widgets/AnimationWindowElements.cs | 2 - .../AnimationWindow/Editor/Widgets/Layout.cs | 2 - .../ScriptBindings/AssetDatabase.bindings.cs | 2 + .../Editor/V2/Managed/ImportActivityWindow.cs | 12 +- .../Managed/SignatureService.cs | 2 +- .../Managed/PackageExport.cs | 18 +- .../Managed/PackageImport.cs | 22 +- .../Managed/PackageImportTreeView.cs | 14 +- .../ImportSettings/AssetImporterEditor.cs | 6 +- .../AssetImporterTabbedEditor.cs | 10 +- .../ImportSettings/AudioImporterInspector.cs | 18 +- .../ImportSettings/BaseAssetImporterTabUI.cs | 3 + .../ImportSettings/ModelImporterClipEditor.cs | 120 +- .../ImportSettings/ModelImporterEditor.cs | 1 + .../ModelImporterMaterialEditor.cs | 74 +- .../ModelImporterModelEditor.cs | 118 +- .../ImportSettings/ModelImporterRigEditor.cs | 54 +- .../ImportSettings/PluginImporterInspector.cs | 16 +- .../ModelImporting/ModelImporter.bindings.cs | 2 + .../Public/ScriptBindings/Audio.bindings.cs | 25 + .../ScriptBindings/ControlContext.cs | 78 + .../ScriptableEffect.bindings.cs | 572 + .../ScriptableProcessor.bindings.cs | 63 +- .../Data/Models/DependencyGraph.cs | 212 + .../Data/Models/IAssetReferenceProvider.cs | 46 + .../Services/BuildAnalysisAssembler.cs | 22 +- .../Services/BuildAnalysisService.cs | 44 + .../BuildAnalysis/Services/BuildAnalyzer.cs | 128 +- .../BuildAnalysis/Services/BuildEnumerator.cs | 13 +- .../Services/BuildHistoryProvider.cs | 7 + .../Services/DependencyGraphBuilder.cs | 582 + .../Services/DependencyGraphService.cs | 305 + .../Services/DependencyGraphStore.cs | 223 + .../Services/RootAssetStatsCalculator.cs | 51 +- .../BuildAnalysis/UI/BuildAnalysisWindow.cs | 62 +- Modules/BuildAnalysis/UI/BuildListPanel.cs | 21 +- .../BuildAnalysis/UI/Common/LoadingOverlay.cs | 2 - .../UI/External/ExternalBuildDrawer.cs | 49 + .../UI/External/ExternalBuildDrawers.cs | 78 + .../UI/External/ExternalDrawerView.cs | 126 + .../UI/External/ExternalViewRouter.cs | 88 + .../UI/Tabs/Assets/AssetInspector.cs | 40 +- .../UI/Tabs/Assets/AssetsTabView.cs | 76 +- .../UI/Tabs/Assets/ReferenceSection.cs | 457 + .../UI/Tabs/Overview/BuildStepsElement.cs | 20 +- .../UI/Tabs/Overview/MessagesConsole.cs | 33 +- .../Utils/BuildAnalysisConstants.cs | 10 +- .../BuildProfileEditor/BuildProfileEditor.cs | 10 +- .../BuildProfileSettingsProvider.cs | 21 +- .../Elements/BuildProfileBootstrapView.cs | 6 + .../Elements/BuildProfileSettingsFoldout.cs | 8 +- .../Elements/LinkedTextLabel.cs | 54 + .../Elements/PlatformPackageEntry.cs | 64 +- .../Elements/PlatformPackageItem.cs | 7 +- .../ReferenceComponentSettingsProvider.cs | 114 + .../ScriptableObjectSettingsProvider.cs | 15 +- .../Handlers/AddSettingsDataProvider.cs | 13 +- .../PlatformDiscoveryWindow.cs | 149 +- Modules/BuildProfileEditor/TrText.cs | 16 +- .../Managed/BuildHistory.bindings.cs | 115 + .../Managed/BuildHistoryState.cs | 31 +- .../Managed/BuildReportSummary.cs | 19 +- .../Managed/ContentLayout.cs | 54 +- .../Managed/ExternalBuildInfo.cs | 66 + .../Managed/BurstCompilerService.bindings.cs | 6 +- Modules/Burst/Managed/DiagnosticId.cs | 2 + .../BurstEditor/Managed/BurstAotCompiler.cs | 8 - .../BurstEditor/Managed/BurstInspectorGUI.cs | 8 +- .../Managed/BurstPlatformAotSettings.cs | 2 +- Modules/BurstEditor/Managed/LabeledPopup.cs | 2 +- .../Managed/Runtime/BurstLoader.cs | 148 +- Modules/ClothEditor/ClothInspector.cs | 88 +- .../Managed/BuildPipelineSettingsProvider.cs | 10 +- .../Managed/ContentBuildInterface.bindings.cs | 4 +- .../Editor/Managed/SinglePassBuildImporter.cs | 82 + Modules/ContentLoad/Managed/BuildManifest.cs | 18 +- .../DeviceSimulatorMain.cs | 2 - .../Input/InputManagerBackend.cs | 2 - .../Input/TouchEventManipulator.cs | 2 - .../SimulatorPlayerSettings.cs | 2 - .../DeviceSimulatorEditor/SimulatorWindow.cs | 5 - .../DiagnosticsPreferences.cs | 4 +- .../Controls/ComponentToolContextButton.cs | 2 - .../Controls/EditorToolbarSlider.cs | 2 - .../EditorToolbar/Controls/LoadingSpinner.cs | 2 - Modules/EditorToolbar/Controls/ToolButton.cs | 2 - .../MainToolbarData/MainToolbarButton.cs | 2 + .../MainToolbarCustomElement.cs | 2 + .../MainToolbarData/MainToolbarDropdown.cs | 1 + .../MainToolbarData/MainToolbarLabel.cs | 2 + .../MainToolbarMenuItemButton.cs | 3 + .../MainToolbarData/MainToolbarSlider.cs | 2 + .../MainToolbarData/MainToolbarToggle.cs | 4 +- .../ToolbarElements/AIDropdown.cs | 5 +- .../ToolbarElements/AccountDropdown.cs | 2 - .../ToolbarElements/BuiltinToolSettings.cs | 8 +- .../ToolbarElements/CloudButton.cs | 2 - .../ToolbarElements/EditorToolsToolbar.cs | 2 - .../ToolbarElements/LayersDropdown.cs | 2 - .../ToolbarElements/LayoutDropdown.cs | 5 +- .../ToolbarElements/ModesDropdown.cs | 2 - .../ToolbarElements/OverlayMenu.cs | 10 +- .../ToolbarElements/QualityDropdown.cs | 5 +- .../ToolbarElements/SearchButton.cs | 2 - .../SelectionHistoryButtons.cs | 2 - .../ToolbarElements/SnapSettings.cs | 2 - .../ToolbarElements/StoreButton.cs | 4 +- .../ToolbarElements/SubToolbarZone.cs | 2 - .../ToolbarElements/UndoButton.cs | 2 - .../TypeSystem/BuiltInTypeHandles.cs | 8 - .../TypeSystem/InternalTypeHelpers.cs | 3 + .../TypeSystem/TypeHandleHelpers.cs | 3 + .../BaseDataTypeStypeMapper.cs | 24 +- .../GraphVisualization/ConditionReference.cs | 138 + .../GraphVisualization/Context.cs | 170 +- .../GraphVisualization/DebugStyles.cs | 75 + .../GraphVisualization/GraphMotion.cs | 218 +- .../GraphVisualization/NodeReference.cs | 4 +- .../GraphVisualization/Registry.cs | 4 - .../GraphVisualization/StateReference.cs | 138 + .../GraphVisualization/TransitionReference.cs | 280 + .../GraphVisualization/WireReference.cs | 4 +- .../GraphToolkitCommonEditor/ICondition.cs | 10 + .../GraphToolkitCommonEditor/IPort.cs | 14 + .../GraphToolkitCommonEditor/IStateOption.cs | 75 + .../GraphToolkitCommonEditor/ITransition.cs | 76 + .../ITransitionRule.cs | 5 + .../CommandStateObserver/GraphTool.cs | 4 - .../ToolState/UndoStateRecorder.cs | 15 +- .../EditorCommon/Utility/AssemblyCache.cs | 3 + .../GraphTemplate/DefaultDatabaseProvider.cs | 4 +- ...{NodeAccentManager.cs => AccentManager.cs} | 134 +- ...{NodeAccentRequest.cs => AccentRequest.cs} | 26 +- .../GraphVisualization/AccentStore.cs | 51 + .../ConditionVisualManager.cs | 129 + .../ConditionVisualStore.cs | 45 + .../GraphVisualization/NodeAccentStore.cs | 85 - .../GraphVisualization/Session.cs | 28 + .../GraphVisualization/Store.cs | 5 +- .../TransitionVisualData.cs | 68 + .../TransitionVisualManager.cs | 258 + .../TransitionVisualStore.cs | 50 + .../GraphVisualization/WireVisualData.cs | 9 +- .../ItemLibrary/ItemLibraryLibrary.cs | 2 - .../ItemLibrary/ItemLibraryPreferences.cs | 5 +- .../ItemLibrary/UI/ItemLibraryControl.cs | 2 - .../ItemLibrary/UI/ItemLibraryWindow.cs | 4 - .../ItemLibrary/UI/LibraryTreeView.cs | 21 +- .../Model/BasicModel/AbstractNodeModel.cs | 5 +- .../Model/BasicModel/GraphModel.cs | 6 +- .../BasicModel/InputOutputPortsNodeModel.cs | 15 - .../ModelInspector/InspectorModel.cs | 39 +- .../Model/BasicModel/NodeModel.cs | 176 +- .../Model/BasicModel/NodeOption.cs | 24 +- .../BasicModel/PolymorphicPortHandler.cs | 133 - .../Model/BasicModel/PortModel.cs | 162 +- .../Model/BasicModel/PortNodeModel.cs | 103 +- .../StateMachine/Condition/ConditionModel.cs | 13 + .../BasicModel/StateMachine/StateModel.cs | 256 +- .../StateMachine/TransitionModel.cs | 13 + .../StateMachine/TransitionSupportModel.cs | 47 +- .../BasicModel/SubgraphNodeModelHelper.cs | 5 +- .../Model/Capabilities/IModelCapabilities.cs | 13 - .../Model/GraphObjectFactory.cs | 7 +- .../Interfaces/IPolymorphicPortHandler.cs | 66 - .../UI/Actions/DeleteAndReconnectAction.cs | 2 - .../Commands/ChangePortTypeCommand.cs | 11 +- .../CommandDispatch/Commands/NodeCommands.cs | 8 +- .../UI/Factory/ExtensionMethodCache.cs | 7 + .../UI/Factory/GraphViewFactoryExtensions.cs | 6 +- .../UI/Manipulators/TransitionConnector.cs | 134 +- .../Blackboard/ModelView/BlackboardField.cs | 75 +- .../ModelView/CollapsibleInOutNodeView.cs | 43 +- .../ModelView/ConstantCollectionNodeView.cs | 10 +- .../ModelView/Context/BlockNodeView.cs | 19 +- .../ModelView/Context/ContextNodeView.cs | 18 +- .../GraphView/ModelView/ErrorMarker.cs | 90 +- .../Markers/ErrorMarkerPopupContent.cs | 2 - .../GraphView/ModelView/Placemat/Placemat.cs | 34 + .../UI/ModelView/GraphView/ModelView/Port.cs | 15 +- .../GraphView/ModelView/PortPreview.cs | 46 +- .../ModelView/SetVariableNodeView.cs | 37 +- .../GraphView/ModelView/StateView.cs | 107 +- .../GraphView/ModelView/SubgraphNodeView.cs | 20 +- .../{Transition.cs => TransitionView.cs} | 107 +- .../ModelView/GraphView/ModelView/WireView.cs | 5 +- .../ModelViewParts/Node/NodeColorLinePart.cs | 109 +- .../ModelViewParts/Node/NodeTitlePart.cs | 38 +- .../ModelViewParts/Node/StateColorLinePart.cs | 42 + .../ModelViewParts/PortConnectorPart.cs | 8 + .../PortConnectorPolymorphicPart.cs | 75 +- .../PortConnectorWithIconPart.cs | 45 +- .../ModelViewParts/ProgressBarPart.cs | 140 - .../ModelViewParts/TransitionArrowPart.cs | 21 +- .../ModelViewParts/TransitionControlPart.cs | 21 +- .../UIElements/GradientFlowAnimator.cs | 108 + .../GraphView/UIElements/TransitionArrow.cs | 449 +- .../GraphView/UIElements/TransitionControl.cs | 246 +- .../GraphView/UIElements/WireControl.cs | 58 +- .../ConditionEditor/ConditionView.cs | 22 + .../ConditionEditor/RootGroupConditionView.cs | 9 +- .../Inspector/ExpandablePortPropertyField.cs | 2 - .../GraphElementTitlePropertyField.cs | 51 +- .../Inspector/NodeOptionsInspector.cs | 4 +- .../TransitionPropertiesEditor.cs | 4 + .../TransitionSupportEditor.cs | 31 +- .../Inspector/UIElements/ConstantField.cs | 2 - .../CustomizableModelPropertyField.cs | 3 + .../UIElements/ModelPropertyField.cs | 4 - .../UIElements/ModelSerializedFieldField.cs | 2 - .../OverrideModelSerializedFieldField.cs | 2 - .../Interfaces/IAccentAnimatableView.cs | 23 + .../UI/ModelView/UIElements/DynamicBorder.cs | 8 + .../UIElements/ExternalDynamicBorder.cs | 51 +- .../UI/ModelView/UIElements/StateBorder.cs | 168 +- .../UI/Shortcuts/ShortcutEvents.cs | 18 + .../UI/Shortcuts/ShortcutProviderProxy.cs | 4 +- .../UI/Toolbars/ErrorToolbar/ErrorToolbar.cs | 2 - .../Toolbars/ErrorToolbar/NextErrorButton.cs | 2 - .../ErrorToolbar/PreviousErrorButton.cs | 2 - .../UI/Toolbars/MainToolbar/BuildAllButton.cs | 2 - .../UI/Toolbars/MainToolbar/NewGraphButton.cs | 4 +- .../UI/Toolbars/MainToolbar/SaveButton.cs | 2 - .../MainToolbar/ShowInProjectWindowButton.cs | 2 - .../OptionsToolbar/OptionDropDownMenu.cs | 2 - .../PanelsToolbar/BlackboardPanelToggle.cs | 2 - .../PanelsToolbar/InspectorPanelToggle.cs | 2 - .../PanelsToolbar/MiniMapPanelToggle.cs | 2 - .../UI/Utils/DataTypeIconHelper.cs | 95 + .../GraphToolkitEditor/UI/Utils/RectUtils.cs | 8 + .../UI/Views/Blackboard/BlackboardOverlay.cs | 2 - .../Blackboard/BlackboardRootViewModel.cs | 2 - .../UI/Views/Blackboard/BlackboardView.cs | 2 - .../ContextualMenuHelpers.cs | 2 + .../ContextualMenuUserEntries.cs | 3 +- .../UI/Views/GraphView/GraphView.cs | 30 +- .../UI/Views/Minimap/MiniMapOverlay.cs | 2 - .../InterfaceGetterExtension.cs | 3 + .../ModelInspector/ModelInspectorOverlay.cs | 2 - .../ModelInspector/ModelInspectorView.cs | 65 +- .../UI/Views/ViewSelection.cs | 4 +- .../UI/Windows/GraphViewEditorWindow.cs | 21 +- .../UI/Windows/GraphViewSettings.cs | 8 +- .../Attribute/ConditionMenuAttribute.cs | 7 +- .../ConditionMenuContext.cs | 4 +- .../GraphToolkitPublic/DataTypeStyleMapper.cs | 40 +- .../Implementation/GraphModelImp.cs | 23 +- .../Implementation/GraphTemplateImp.cs | 2 - .../GraphViewEditorWindowImp.cs | 2 - .../Implementation/GraphViewImp.cs | 2 - .../Nodes/UserNodes/IUserNodeModelImp.cs | 15 + .../Nodes/UserNodes/UserConditionView.cs | 17 + .../Nodes/UserNodes/UserNodeModelImp.gen.cs | 24 + .../UserNodes/UserSelfTransitionModelImp.cs | 17 + .../Nodes/UserNodes/UserStateModelImp.cs | 17 + .../Implementation/PreviewGraphViewImp.cs | 2 - .../Implementation/PublicGraphFactory.cs | 7 +- .../GraphToolkitPublic/Node/Condition.cs | 22 + .../GraphToolkitPublic/Node/ConditionView.cs | 21 + .../Node/IOptionBuilders.cs | 8 +- .../GraphToolkitPublic/Node/IPortBuilders.cs | 42 +- .../GraphToolkitPublic/Node/IState.cs | 47 + .../Node/IStateOptionBuilders.cs | 191 + .../Node/IUserConditionView.cs | 8 + .../Node/Internal/Node_Internal.cs | 173 +- .../Node/Internal/State_Internal.cs | 19 + .../GraphToolkitPublic/Node/Node.cs | 12 + .../GraphToolkitPublic/Node/NodeExtensions.cs | 7 +- .../GraphToolkitPublic/Node/SelfTransition.cs | 41 +- .../GraphToolkitPublic/Node/State.cs | 187 + .../Editor/ToolShortcutDiscoveryProvider.cs | 4 - .../TimerEventSchedulerWrapperForTests.cs | 2 - .../NodeSearch/SearchWindow.cs | 8 +- .../Utils/GraphViewTemplateDescriptor.cs | 5 + .../Windows/GraphViewBlackboardWindow.cs | 5 - .../Windows/GraphViewEditorWindow.cs | 5 - .../Windows/GraphViewMinimapWindow.cs | 5 - .../Windows/GraphViewTemplateCustomIndexer.cs | 87 +- .../Windows/GraphViewTemplateWindow.cs | 22 +- .../Windows/GraphViewToolWindow.cs | 5 - .../Windows/TemplateQueryMatcher.cs | 203 + .../Windows/TemplateSearchProvider.cs | 103 +- .../Windows/TemplateSearchViewModel.cs | 2 - .../GridAndSnap/GridVisualSettingsWindow.cs | 4 +- Modules/GridAndSnap/SnapSettingsWindow.cs | 4 +- .../Managed/HierarchyNodeTypeHandler.cs | 2 - Modules/Hierarchy/Managed/HierarchyView.cs | 76 +- .../Hierarchy/Managed/HierarchyViewCell.cs | 2 - .../Managed/HierarchyViewColumnNavigate.cs | 2 - .../Hierarchy/Managed/HierarchyViewItem.cs | 24 +- .../Managed/HierarchyViewItemName.cs | 8 +- .../IHierarchyEditorNodeTypeHandler.cs | 3 + .../Managed/HierarchyNodeTypeHandlerBase.cs | 72 +- ...IHierarchyNodeTypeHandlerViewModelState.cs | 20 + .../ScriptBindings/Hierarchy.bindings.cs | 27 + .../HierarchyCommandList.bindings.cs | 29 +- .../HierarchyViewModel.bindings.cs | 66 +- .../Managed/GameObjectIconUtility.cs | 21 +- .../Managed/HierarchyAnalytics.cs | 2 - .../Managed/HierarchyColumnMenuInitializer.cs | 2 - .../HierarchyGlobalSelectionHandler.cs | 2 - .../Managed/HierarchySearchProvider.cs | 2 - .../Managed/HierarchySearchView.cs | 2 - .../Managed/HierarchyStageStack.cs | 312 + .../Managed/HierarchyWindow.cs | 256 +- .../HierarchyEditorTestsHelper.bindings.cs | 8 +- .../HierarchyGameObjectHandler.bindings.cs | 67 +- Modules/IMGUI/ATGIMGUITextHandle.cs | 35 +- Modules/IMGUI/AssemblyInfo.cs | 72 +- Modules/IMGUI/GUI.cs | 3 + Modules/IMGUI/GUILayoutUtility.cs | 8 + Modules/IMGUI/GUISkin.cs | 5 +- Modules/IMGUI/GUIUtility.cs | 7 + .../Input/Private/Managed/InputCommonTypes.cs | 80 + Modules/InputLegacy/Input.bindings.cs | 16 +- .../Insights/EngineDiagnostics.bindings.cs | 37 + .../ManagedCapture/EventCorrelation.cs | 207 + .../ManagedCapture/EventJsonWriter.cs | 130 + .../ManagedCaptureHookEngine.Breadcrumbs.cs | 110 + .../ManagedCaptureHookEngine.Emit.cs | 303 + .../ManagedCaptureHookEngine.cs | 208 + .../ManagedCapture/ManagedCaptureHooks.cs | 98 + Modules/InsightsEditor/DisablementPopup.cs | 5 - .../EngineDiagnosticsSettings.bindings.cs | 15 + .../InsightsEditor/InsightsModuleStripping.cs | 22 +- .../InsightsRequirementsResolver.cs | 133 + .../ManagedCaptureDefaultConfig.cs | 11 + .../InsightsEditor/ManagedCaptureOtaConfig.cs | 111 + .../InsightsEditor/ManagedCaptureStripping.cs | 49 + .../RequiresInsightsAttribute.cs | 72 + .../AssemblyInfo.cs} | 6 +- Modules/JobsProfilerEditor/CacheFrameData.cs | 1606 ++ Modules/JobsProfilerEditor/Filter.cs | 91 + Modules/JobsProfilerEditor/JobFlow.cs | 761 + Modules/JobsProfilerEditor/JobsInfoPanel.cs | 487 + Modules/JobsProfilerEditor/JobsProfiler.cs | 246 + .../JobsProfilerEditor/JobsProfilerColors.cs | 39 + .../JobsProfilerResources.cs | 41 + .../JobsProfilerSettings.cs | 231 + .../JobsProfilerEditor/PrimitiveRenderer.cs | 317 + Modules/JobsProfilerEditor/SettingsMenu.cs | 80 + Modules/JobsProfilerEditor/Stats.cs | 783 + Modules/JobsProfilerEditor/TextRenderer.cs | 626 + Modules/JobsProfilerEditor/ThreadLabels.cs | 335 + Modules/JobsProfilerEditor/TickHandler.cs | 227 + Modules/JobsProfilerEditor/Timeline.cs | 2893 ++++ Modules/JobsProfilerEditor/ZoomableArea.cs | 808 + .../UI/Events/Windows/LicenseExpiredWindow.cs | 5 - .../LicenseOfflineValidityEndedWindow.cs | 5 - .../LicenseOfflineValidityEndingWindow.cs | 5 - .../UI/Events/Windows/LicenseRemovedWindow.cs | 5 - .../Events/Windows/LicenseReturnedWindow.cs | 5 - .../UI/Events/Windows/LicenseRevokedWindow.cs | 5 - .../Windows/TemplateLicenseEventWindow.cs | 5 - .../LightingSearchColumnHelpers.cs | 18 + .../LightingSearchDataAccessors.cs | 19 +- .../LightingSearch/LightingSearchPaths.cs | 7 - .../LightingSearchQueryTreeNodeHandler.cs | 38 +- .../LightingSearch/LightingSearchWindow.cs | 2 +- .../LightingSearch/LightmapSearchProvider.cs | 4 +- .../SearchColumnProvidersLightingSettings.cs | 2 +- .../SearchColumnProvidersMaterial.cs | 123 +- .../SearchColumnProvidersMeshRenderer.cs | 29 +- Modules/Lighting/UITK/LightmapPreviewField.cs | 4 +- .../LocalizationEditor/L10nContentCache.cs | 182 + .../LocalizationDatabase.cs | 96 +- .../Managed/Components/LocalizeAssetEvent.cs | 2 +- .../Components/LocalizeAudioClipEvent.cs | 26 + .../Components/LocalizeGameObjectEvent.cs | 26 + .../Managed/Components/LocalizeSpriteEvent.cs | 26 + .../Managed/Components/LocalizeStringEvent.cs | 2 +- .../Components/LocalizeStringListEvent.cs | 84 + .../Components/LocalizeTextureEvent.cs | 2 +- .../Managed/ILocaleDiscovery.cs | 2 +- .../Managed/IPostProcessValueLocale.cs | 4 +- Modules/LocalizationRuntime/Managed/Locale.cs | 6 +- .../Managed/LocaleIdentifier.cs | 18 +- .../Managed/Metadata/Comment.cs | 2 +- .../Metadata/ExcludeEntryFromEditorExport.cs | 2 +- .../Metadata/ExcludeEntryFromPlayerExport.cs | 2 +- .../Managed/Metadata/Metadata.cs | 14 +- .../Managed/Metadata/MetadataType.cs | 4 +- .../Managed/Providers/AssetKey.cs | 16 +- .../Managed/Providers/AssetProvider.cs | 12 +- .../Providers/FileTables/FileTableProvider.cs | 4 +- .../Providers/FileTables/ITableFileReader.cs | 2 +- .../Managed/Providers/IAssetProvider.cs | 4 +- .../Managed/Providers/IAsyncAssetProvider.cs | 4 +- .../Providers/ISynchronousAssetProvider.cs | 2 +- .../Providers/ReferencedAssetProvider.cs | 12 +- .../Providers/ResourceFolderProvider.cs | 10 +- .../Managed/Reference/LocalVariablesGroup.cs | 10 +- .../Reference/LocalizedAsset.binding.cs | 3 + .../Managed/Reference/LocalizedAsset.cs | 38 +- .../Managed/Reference/LocalizedEntry.cs | 8 +- .../Managed/Reference/LocalizedReference.cs | 2 +- .../Managed/Reference/LocalizedString.cs | 12 +- .../Managed/Reference/LocalizedStringList.cs | 287 + .../Managed/Reference/LocalizedTable.cs | 6 +- .../Settings/IStartupLocaleSelector.cs | 6 +- .../Managed/Settings/LoadingPreference.cs | 2 +- .../Managed/Settings/LocalizationSettings.cs | 188 +- .../Managed/Settings/PreloadBehavior.cs | 41 + .../Managed/Settings/ResourceDatabase.cs | 22 +- .../Settings/StartupLocaleSelectors.cs | 10 +- .../Managed/Tables/AssetEntries.cs | 11 +- .../Managed/Tables/DistributedUIDGenerator.cs | 8 +- .../Managed/Tables/Entries.cs | 4 +- .../Managed/Tables/IKeyGenerator.cs | 4 +- .../Managed/Tables/IResourceEntry.cs | 16 +- .../Managed/Tables/ResourceTable.cs | 132 +- .../Managed/Tables/SharedTableData.cs | 40 +- .../Managed/Tables/SubAssetAddress.cs | 55 + .../Managed/Tables/TableReference.cs | 38 +- .../Managed/Tables/Variants.cs | 64 +- .../Managed/UI/LanguageDropdown.cs | 7 +- .../Managed/UI/LanguageRadioButtonGroup.cs | 7 +- .../LocalizationRuntimeEditor/AssemblyInfo.cs | 4 + .../Managed/AssetEntryEditorBase.cs | 12 +- .../Managed/AssetEntryEditors.cs | 6 + .../Managed/AssetProviderDrawer.cs | 2 +- .../Managed/AssetProviderEditors.cs | 106 +- .../Managed/ExtensionUI.cs | 33 + .../FileTables/FileTableProviderEditor.cs | 2 +- .../Managed/FileTables/ITableFileWriter.cs | 2 +- .../CharacterSetCollectionFormat.cs | 119 + .../ImportExport/CollectionTableSelector.cs | 113 + .../ImportExport/ExportCharacterSetWindow.cs | 42 + .../FileCollectionExtensionDrawer.cs | 112 + .../ImportExport/FileCollectionExtensions.cs | 28 + .../Managed/ImportExport/TableImportExport.cs | 100 +- .../ImportExport/TableSelectionWindow.cs | 59 + .../Managed/LanguageToolbar.cs | 19 +- .../Managed/LoadingSpinner.cs | 2 - .../Managed/LocClasses.cs | 6 +- .../Managed/LocIcons.cs | 10 +- .../Managed/LocLabels.cs | 89 + .../Managed/LocaleGeneratorWindow.cs | 30 +- .../Managed/LocalizationEditorSettings.cs | 3 + .../Managed/LocalizationSettingsProvider.cs | 122 +- .../Managed/LocalizationTableAuthoring.cs | 11 +- .../Managed/LocalizeComponentMenus.cs | 36 + .../Managed/LocalizeStringListEventEditor.cs | 80 + .../Managed/LocalizedAssetDrawer.cs | 11 +- .../Managed/LocalizedBindingDrawers.cs | 2 - .../Managed/LocalizedReferenceElement.cs | 27 +- .../Managed/LocalizedReferencePopups.cs | 8 +- .../Managed/LocalizedStringDrawer.cs | 10 +- .../Managed/MetadataPopup.cs | 2 - .../Managed/ResourceCollectionExtension.cs | 18 + .../Managed/ResourceEntryDrawer.cs | 6 + .../Managed/ResourceTableCollection.cs | 44 + .../Managed/ResourceTableCollectionEditor.cs | 179 +- .../ResourceTableCollectionPostprocessor.cs | 35 +- .../Managed/ResourceTablesWindow.Authoring.cs | 2 - .../Managed/ResourceTablesWindow.cs | 216 +- .../Managed/Search/AssetEntryTypeResolver.cs | 20 +- .../LocalizedReferenceSearchProvider.cs | 2 - .../Managed/TableAssetEditors.cs | 59 + .../Managed/TableSearch.cs | 5 +- .../Managed/Collections/AllocatorManager.cs | 1745 ++ .../Managed/Collections/AssemblyInfo.cs | 28 + .../Managed/Collections/AutoFreeAllocator.cs | 268 + .../Managed/Collections/BitField.cs | 998 ++ .../Managed/Collections/CollectionHelper.cs | 715 + .../Managed/Collections/ConcurrentMask.cs | 213 + .../Collections/DataStreamExtensions.cs | 105 + .../Managed/Collections/DataStreamReader.cs | 808 + .../Managed/Collections/DataStreamWriter.cs | 928 ++ .../Managed/Collections/DebugView.cs | 52 + .../Collections/DoubleRewindableAllocators.cs | 124 + .../Managed/Collections/FixedList.gen.cs | 6982 ++++++++ .../Managed/Collections/FixedString.gen.cs | 8272 ++++++++++ .../Collections/FixedStringAppendMethods.cs | 452 + .../Collections/FixedStringFormat.gen.cs | 13390 ++++++++++++++++ .../FixedStringFormatMethods.gen.cs | 947 ++ .../Collections/FixedStringInternalMethods.cs | 162 + .../Managed/Collections/FixedStringMethods.cs | 1238 ++ .../Collections/FixedStringParseMethods.cs | 231 + .../Managed/Collections/FixedStringUtils.cs | 149 + ...rateTestsForBurstCompatibilityAttribute.cs | 110 + .../CollectionsJobReflectionRegistration.cs | 46 + .../Collections/Jobs/EarlyInitHelpers.cs | 83 + .../Managed/Collections/Jobs/IJobFilter.cs | 341 + .../Collections/Jobs/IJobParallelForBatch.cs | 254 + .../Collections/Jobs/IJobParallelForDefer.cs | 212 + .../Jobs/RegisterGenericJobTypeAttribute.cs | 38 + .../Managed/Collections/ListExtensions.cs | 113 + .../Managed/Collections/Memory.cs | 235 + .../Managed/Collections/MemoryLabel.cs | 51 + .../Collections/NativeArrayExtensions.cs | 350 + .../Managed/Collections/NativeBitArray.cs | 680 + .../NativeCollectionEnums.bindings.cs | 26 + .../Managed/Collections/NativeHashMap.cs | 827 + .../Managed/Collections/NativeHashSet.cs | 546 + .../Managed/Collections/NativeList.cs | 1244 ++ .../Collections/NativeNotBurstCompatible.cs | 78 + .../Collections/NativeParallelHashMap.cs | 863 + .../NativeParallelHashMapExtensions.cs | 153 + .../Collections/NativeParallelHashSet.cs | 501 + .../NativeParallelHashSetExtensions.gen.cs | 1237 ++ .../Collections/NativeParallelMultiHashMap.cs | 889 + .../Managed/Collections/NativeQueue.cs | 469 + .../Managed/Collections/NativeReference.cs | 391 + .../Managed/Collections/NativeRingQueue.cs | 261 + .../Managed/Collections/NativeSort.cs | 1453 ++ .../Managed/Collections/NativeStream.cs | 814 + .../Managed/Collections/NativeText.gen.cs | 1784 ++ .../Collections/RewindableAllocator.cs | 514 + .../Collections/StreamCompressionModel.cs | 325 + .../Managed/Collections/UIntFloat.cs | 24 + .../Collections/UTF8ArrayUnsafeUtility.cs | 342 + .../Managed/Collections/Unicode.cs | 711 + .../Managed/Collections/UnsafeAppendBuffer.cs | 485 + .../Collections/UnsafeAtomicCounter.cs | 191 + .../Managed/Collections/UnsafeBitArray.cs | 887 + .../Managed/Collections/UnsafeHashMap.cs | 1079 ++ .../Managed/Collections/UnsafeHashSet.cs | 408 + .../Managed/Collections/UnsafeList.cs | 2116 +++ .../Collections/UnsafeNotBurstCompatible.cs | 95 + .../Collections/UnsafeParallelHashMap.cs | 1808 +++ .../Collections/UnsafeParallelHashSet.cs | 432 + .../UnsafeParallelHashSetExtensions.gen.cs | 2327 +++ .../Collections/UnsafeParallelMultiHashMap.cs | 745 + .../Managed/Collections/UnsafeQueue.cs | 762 + .../Managed/Collections/UnsafeRingQueue.cs | 305 + .../Collections/UnsafeScratchAllocator.cs | 76 + .../Managed/Collections/UnsafeStream.cs | 755 + .../Managed/Collections/UnsafeText.cs | 264 + .../Managed/Collections/UnsafeUtilityEx.cs | 134 + .../Managed/Collections/xxHash3.AVX2.cs | 139 + .../Collections/xxHash3.StreamingState.cs | 354 + .../Managed/Collections/xxHash3.cs | 890 + .../Export/Hashing/Hash128.bindings.cs | 2 +- .../Managed/Export/Hashing/HashUtilities.cs | 74 + .../Managed}/Export/Hashing/SpookyHash.cs | 0 .../Jobs/AtomicSafetyHandle.bindings.cs | 236 + .../Managed/Jobs/BatchQueries.cs | 8 + Modules/ManagedKernel/Managed/Jobs/IJob.cs | 58 +- Modules/ManagedKernel/Managed/Jobs/IJobFor.cs | 110 + .../Managed/Jobs/IJobParallelFor.cs | 88 + .../Managed/Jobs/JobHandle.bindings.cs | 124 + .../Managed/Jobs/Jobs.bindings.cs | 133 +- .../Managed/ManagedKernelAssertions.cs | 111 + .../Managed/NativeArray/DisposeSentinel.cs | 28 + .../Managed/NativeArray/NativeArray.cs | 291 +- .../Managed/NativeArray/NativeSlice.cs | 92 + .../Managed/Unsafe/UnsafeUtility.bindings.cs | 907 ++ .../Managed/Unsafe/UnsafeUtility.cs | 8 + .../Unsafe/UnsafeUtilityPatchedForwarder.cs | 300 + .../Unity.Mathematics.Editor/MatrixDrawer.cs | 4 +- Modules/MetalFX/Managed/AssemblyInfo.cs | 7 + .../MetalFX/Managed/MetalFXDevice.bindings.cs | 135 + .../MultiplayerEditor/Managed/AssemblyInfo.cs | 8 + .../Managed/CliArguments/CLIDefaults.cs | 14 +- .../Managed/Common/ServiceSingleton.cs | 7 +- .../Managed/Common/SyncedSingleton.cs | 4 - .../Common/Deprecated/AnswerData.cs | 50 + .../Common/Deprecated/IOnboardingSection.cs | 189 + .../IOnboardingSectionAnalyticsProvider.cs | 40 + .../Common/Deprecated/Preset.cs | 91 + .../Deprecated/SelectedSolutionsData.cs | 88 + .../MultiplayerCenter/Common/GameGenre.cs | 25 + .../Common/MultiplayerCenterSettings.cs | 37 + .../Common/OnboardingGUIProvider.cs | 69 + .../Common/OnboardingSectionCategory.cs | 49 + .../Common/StyleConstants.cs | 73 + .../Editor/Analytics/AnalyticsEvent.cs | 70 + .../Analytics/GenreSelectedAnalytics.cs | 30 + .../Analytics/PackageInstalledAnalytics.cs | 54 + .../Analytics/SampleImportedAnalytics.cs | 42 + .../Analytics/WindowChangedAnalytics.cs | 47 + .../DeprecatedOnboardingSections.cs | 38 + .../Editor/Deprecated/SectionsFinder.cs | 143 + .../Models/CategoriesDescription.cs | 106 + .../Models/EnumBasedDescription.cs | 98 + .../Models/GameGenreList.cs | 62 + .../Models/GenreAssociatedBuildingBlocks.cs | 70 + .../Models/GettingStartedSamplesList.cs | 47 + .../Models/Recommendations.cs | 38 + .../MultiplayerCenterWindow.cs | 276 + .../Onboarding/CommunityHandlesSection.cs | 40 + .../GamePlayElements/BuildingBlockSection.cs | 94 + .../GettingStartedInstallQuickStart.cs | 73 + .../GettingStartedRecommendationPackages.cs | 327 + .../GettingStartedSampleSection.cs | 193 + .../QuickStartSamplesManager.cs | 314 + .../Onboarding/PlaceholderSection.cs | 45 + .../UI/StyleClasses.cs | 23 + .../VisualElements/CategoriesContainer.cs | 137 + .../VisualElements/ColoredMinMaxSlider.cs | 90 + .../VisualElements/HyperLink.cs | 47 + .../ImageWithPlaceholderElement.cs | 52 + .../VisualElements/QuestionModeToggle.cs | 28 + .../VisualElements/ReadOnlyInspectorDrawer.cs | 36 + .../Recommendations/DelayedPackageBinding.cs | 131 + .../Recommendations/HelpIcon.cs | 39 + .../Recommendations/PackageIcon.cs | 46 + .../Recommendations/PackageItem.cs | 102 + .../Recommendations/RecommendationsGrid.cs | 90 + .../SessionStateJsonRepository.cs | 3 + .../Common/MigrationUtility.cs | 28 +- .../Common/ScenarioDialog.cs | 4 +- .../OrchestratedScenario/DecoratorItem.cs | 2 +- .../OrchestratedScenario.cs | 22 +- .../OrchestratedScenarioSettings.cs | 98 +- .../OrchestratedScenarioUserSettings.cs | 24 +- .../PlayModeControllerItem.cs | 29 +- .../PlayModeConfig/ScenarioFactory.cs | 44 +- .../PlayModeConfig/UI/AdbDeviceField.cs | 2 - .../PlayModeConfig/UI/BuildProfileField.cs | 2 - .../PlayModeConfig/UI/FieldIcon.cs | 2 - .../UI/FilteredInstancesListProperty.cs | 2 +- .../UI/LaunchingScenarioWindow.cs | 2 - .../CloneEditorInstanceStatusElement.cs | 4 +- .../FreeRunningStatusElement.cs | 4 +- .../InstanceStatusElement.cs | 16 +- .../LocalPlayerInstanceStatusElement.cs | 6 +- .../OrchestratedScenarioStatusElement.cs | 10 +- .../PlaymodeStatusPopupContent.cs | 14 +- .../MultiplayerStatusView/RecompileTracker.cs | 12 +- .../ReuseBuildElement.cs | 15 +- .../ScenarioControllerStatusElement.cs | 76 + .../PlayModeConfig/UI/MultiplayerTagField.cs | 2 - .../UI/PlayModeControllerItemDrawer.cs | 7 + .../PlayModeConfig/UI/ScenarioConfigEditor.cs | 30 +- .../Debugging/ScenarioStatusWindow.cs | 2 - .../Decorators/ControllerDatabase.cs | 25 +- .../Decorators/PlayModeControllerDecorator.cs | 27 - .../Decorators/PlayModeControllerRegistry.cs | 2 - .../{Instance.cs => ControllerRuntime.cs} | 46 +- .../DomainReloadScopeGuard.cs | 2 - .../Scenarios/GraphsFoundation/Scenario.cs | 144 +- .../Instances/CloneEditorController.cs | 8 +- .../Instances/LocalPlayerController.cs | 6 +- .../Instances/MainEditorController.cs | 2 +- .../Scenarios/Instances/PlayModeController.cs | 65 +- .../Nodes/Local/Adb/AdbBridgeHelper.cs | 18 +- .../Nodes/Local/Adb/AdbInstallNode.cs | 4 +- .../Nodes/Local/Adb/AdbLogcatNode.cs | 4 +- .../Nodes/Local/Adb/AdbMonitorProcessNode.cs | 4 +- .../Scenarios/Nodes/Local/Adb/AdbService.cs | 2 - .../Nodes/Local/Adb/AdbStartProcessNode.cs | 4 +- .../Nodes/Local/Adb/AdbStopProcessNode.cs | 4 +- .../AssetDb/AssetDatabaseCallbacks.cs | 3 + .../VirtualProjects/Contexts/CloneContext.cs | 2 - .../Contexts/EditorContexts.cs | 7 +- .../Contexts/MainEditorContext.cs | 2 - .../Messaging/MessagingService.cs | 2 - .../VirtualProjects/VirtualProjectsApi.cs | 6 + .../Configuration/ProjectDataStore.cs | 2 - .../Workflow/Contexts/WorkflowCloneContext.cs | 2 - .../Contexts/WorkflowMainEditorContext.cs | 4 +- .../Workflow/CurrentPlayerEditor.cs | 4 - .../Workflow/EditorModes/LayoutFlags.cs | 2 +- .../EditorSystems/ClonedPlayerSystems.cs | 2 - .../EditorSystems/PlaymodeMessageQueue.cs | 2 - .../Workflow/Players/SystemDataStore.cs | 5 + .../Settings/PlayerTags/PlayerTagsView.cs | 2 - .../Settings/PlaymodeSettingsSection.cs | 2 - .../Workflow/UI/TopView.cs | 4 - .../Workflow/StandardCloneWorkflow.cs | 3 + .../Workflow/StandardMainEditorWorkflow.cs | 3 + .../Workflow/VirtualProjectWorkflow.cs | 33 +- .../WorkflowUI/MultiplayerWindow.cs | 4 - .../UI/UIElements/LoadingSpinner.cs | 2 - .../EditorMultiplayerManager.bindings.cs | 33 +- .../MultiplayerRoleDropdown.cs | 8 +- .../MultiplayerScenePostprocessor.cs | 82 + .../PublicAPI/ContentSelectionSettings.cs | 31 +- .../GUI/MultiplayerRolesSettingsSection.cs | 2 - .../MultiplayerRolesScenePostprocessor.cs | 29 - .../WebRequestDetailsViewController.cs | 958 +- .../Profiler/WebRequestProfilerCaptureLog.cs | 332 + .../Profiler/WebRequestProfilerData.cs | 125 +- .../Profiler/WebRequestProfilerFormatting.cs | 70 +- .../Profiler/WebRequestProfilerFrameReader.cs | 139 +- .../Profiler/WebRequestProfilerModule.cs | 14 +- .../PackageManager/Editor/Managed/Events.cs | 4 + .../External/EditorGameServiceExtension.cs | 6 +- .../Services/AssetStore/AssetStoreOAuth.cs | 217 - .../Services/AssetStore/AssetStoreRestAPI.cs | 14 +- .../Services/Common/BackgroundFetchHandler.cs | 4 +- .../Editor/Services/Common/DropdownHandler.cs | 2 - .../Services/Common/PlayModeDownload.cs | 2 - .../Editor/Services/Common/ResourceLoader.cs | 16 +- .../Editor/Services/Common/UIErrorCode.cs | 7 +- .../Editor/Services/Interfaces/IPage.cs | 2 +- .../Services/Interfaces/IVisualStateList.cs | 4 +- .../Packages/InProjectPackagesMonitor.cs | 66 +- .../Services/Packages/PackageCreator.cs | 133 +- .../Editor/Services/Pages/BasePage.cs | 7 +- .../Services/Pages/PageTypes/MyAssetsPage.cs | 30 +- .../Pages/PaginatedVisualStateList.cs | 91 - .../Editor/Services/Pages/SimplePage.cs | 4 - .../Editor/Services/Pages/VisualStateList.cs | 97 +- .../Editor/Services/Proxies/SelectionProxy.cs | 2 - .../Services/Proxies/UnityConnectProxy.cs | 22 +- .../Services/Proxies/UnityOAuthProxy.cs | 31 - .../Editor/Services/ServicesContainer.cs | 11 +- .../Editor/Services/Upm/UpmClient.cs | 4 +- .../PackageManagerUserSettingsProvider.cs | 2 - .../CustomDisplayDialogContent.cs | 2 - .../Tabs/PackageDetailsVersionHistoryItem.cs | 2 - .../UI/Dropdowns/CreatePackageDropdown.cs | 16 +- .../Editor/UI/Dropdowns/InProgressDropdown.cs | 2 +- .../Editor/UI/Filters/PageFiltersWindow.cs | 8 +- .../PackageManifestImporterEditor.cs | 48 +- .../UI/MainWindow/PackageManagerToolbar.cs | 2 - .../UI/MainWindow/PackageManagerWindow.cs | 5 - .../UI/ModalWindow/ModalWindowContainer.cs | 9 +- .../UI/MultiSelect/MultiSelectDetails.cs | 2 - .../Packages/CheckUpdateFoldout.cs | 2 - .../Packages/DownloadFoldoutGroup.cs | 2 - .../Packages/DownloadUpdateFoldoutGroup.cs | 2 - .../Packages/InstallFoldoutGroup.cs | 2 - .../Packages/NoActionsOnPackagesFoldout.cs | 2 - .../OpenManifestExternallyFoldoutGroup.cs | 2 - .../PackageMultiSelectFoldoutGroup.cs | 2 - .../Packages/PackageMultiSelectItem.cs | 2 - .../Packages/RemoveFoldoutGroup.cs | 2 - .../Packages/RemoveImportedFoldoutGroup.cs | 2 - .../UI/MultiSelect/Packages/UnlockFoldout.cs | 2 - .../UI/MultiSelect/Packages/UpdateFoldout.cs | 2 - .../Packages/UpdateFoldoutGroup.cs | 2 - .../ScopedRegistriesSettings.cs | 2 - .../UI/SelectionWindow/SelectionWindow.cs | 5 - .../TrustWindow.cs} | 216 +- .../TrustWindowReturnValue.cs} | 5 +- .../TrustWindowSection.cs | 4 +- .../ParticleSystemEditor/ParticleEffectUI.cs | 32 +- .../ParticleSystemClipboard.cs | 8 +- .../ParticleSystemCurveEditor.cs | 8 +- .../ParticleSystemEditor.cs | 12 +- .../ClampVelocityModuleUI.cs | 14 +- .../CollisionModuleUI.cs | 68 +- .../ColorByVelocityModuleUI.cs | 4 +- .../ParticleSystemModules/ColorModuleUI.cs | 2 +- .../CustomDataModuleUI.cs | 10 +- .../ParticleSystemModules/EmissionModuleUI.cs | 20 +- .../ExternalForcesModuleUI.cs | 14 +- .../ParticleSystemModules/ForceModuleUI.cs | 4 +- .../InheritVelocityModuleUI.cs | 8 +- .../ParticleSystemModules/InitialModuleUI.cs | 104 +- .../LifetimeByEmitterSpeedModuleUI.cs | 4 +- .../ParticleSystemModules/LightsModuleUI.cs | 20 +- .../ParticleSystemModules/ModuleUIHelpers.cs | 24 +- .../ParticleSystemModules/NoiseModuleUI.cs | 38 +- .../ParticleSystemModules/RendererModuleUI.cs | 136 +- .../RotationByVelocityModuleUI.cs | 6 +- .../ParticleSystemModules/RotationModuleUI.cs | 4 +- .../ParticleSystemModules/ShapeModuleUI.cs | 146 +- .../SizeByVelocityModuleUI.cs | 6 +- .../ParticleSystemModules/SizeModuleUI.cs | 4 +- .../ParticleSystemModules/SubModuleUI.cs | 20 +- .../ParticleSystemModules/TrailModuleUI.cs | 52 +- .../ParticleSystemModules/TriggerModuleUI.cs | 30 +- .../ParticleSystemModules/UVModuleUI.cs | 48 +- .../ParticleSystemModules/VelocityModuleUI.cs | 14 +- .../ParticleSystemStyles.cs | 2 - .../ParticleSystemEditor/ParticleSystemUI.cs | 20 +- .../ParticleSystemWindow.cs | 8 +- .../CharacterController.bindings.cs | 3 + .../ScriptBindings/PhysicsScene.bindings.cs | 88 +- .../Managed/Colliders/BoxCollider2DEditor.cs | 2 +- .../Colliders/CapsuleCollider2DEditor.cs | 2 +- .../Colliders/CircleCollider2DEditor.cs | 2 +- .../Managed/Colliders/Collider2DEditorBase.cs | 6 +- .../Managed/Colliders/Collider2DToolBase.cs | 2 +- .../Managed/Joints/HingeJoint2DEditor.cs | 2 +- .../Managed/Joints/HingeJoint2DTool.cs | 2 +- .../Managed/Menu/Physics2DMenuItem.cs | 2 - .../Managed/Rigidbody/Rigidbody2DEditor.cs | 4 +- .../Managed/Settings/Physics2DPreferences.cs | 22 +- .../Settings/Physics2DSettingsEditor.cs | 18 +- .../APIUpdates/PhysicsCore2D.obsolete.cs | 123 + .../Bindings/PhysicsShape.bindings.cs | 4 +- .../Bindings/PhysicsWorld.bindings.cs | 11 +- .../Joints/PhysicsDistanceJointDefinition.cs | 33 + .../Scripting/Joints/PhysicsJoint.cs | 82 + .../Scripting/Miscellaneous/PhysicsAABB.cs | 25 +- .../Scripting/Miscellaneous/PhysicsLayers.cs | 25 +- .../Scripting/Miscellaneous/PhysicsMask.cs | 30 + .../Miscellaneous/PhysicsUserData.cs | 34 + .../PhysicsCore2D/Scripting/PhysicsBody.cs | 163 +- .../Scripting/PhysicsBodyDefinition.cs | 35 + .../Scripting/PhysicsCallbacks.cs | 191 +- .../PhysicsCore2D/Scripting/PhysicsChain.cs | 3 +- .../Scripting/PhysicsComposer.cs | 76 + .../Scripting/PhysicsConstants.cs | 5 + .../PhysicsCore2D/Scripting/PhysicsEvents.cs | 134 +- .../PhysicsCore2D/Scripting/PhysicsMath.cs | 604 +- .../PhysicsCore2D/Scripting/PhysicsQuery.cs | 88 +- .../PhysicsCore2D/Scripting/PhysicsShape.cs | 233 +- .../Scripting/PhysicsShapeDefinition.cs | 40 +- .../Scripting/PhysicsTransformTweener.cs | 2 +- .../Scripting/PhysicsTransformWatcher.cs | 15 +- .../Scripting/PhysicsTransformWriter.cs | 2 +- .../PhysicsCore2D/Scripting/PhysicsWorld.cs | 392 +- .../Scripting/PhysicsWorldDefinition.cs | 50 +- .../Menu/PhysicsCore2DMenuItems.cs | 2 - .../Profiler/PhysicsCore2DFrameData.cs | 18 + .../Profiler/PhysicsCore2DProfilerMarkers.cs | 279 + .../Profiler/PhysicsCore2DProfilerModule.cs | 40 + .../PhysicsCore2DProfilerViewController.cs | 180 + .../PhysicsCore2DModuleView.cs | 367 + .../PhysicsWorldTreeData.cs | 65 + .../PhysicsCore2DProfilerView.cs | 57 + .../PhysicsCore2DStatisticView.cs | 76 + .../Profiler/UI/PhysicsModuleData.cs | 114 + .../PhysicsEditor/ArticulationBodyEditor.cs | 60 +- .../ArticulationBodyJointLimitTool.cs | 2 - .../ArticulatonBodyAnchorTransformTool.cs | 2 - .../BackendSystem/PhysicsBackendStripping.cs | 2 - Modules/PhysicsEditor/BoxColliderEditor.cs | 12 +- .../PhysicsEditor/CapsuleColliderEditor.cs | 4 +- .../CharacterControllerEditor.cs | 6 +- Modules/PhysicsEditor/Collider3DEditorBase.cs | 14 +- .../PhysicsEditor/ColliderEditorUtility.cs | 2 +- Modules/PhysicsEditor/HingeJointEditor.cs | 2 +- Modules/PhysicsEditor/JointEditor.cs | 2 +- Modules/PhysicsEditor/MeshColliderEditor.cs | 16 +- Modules/PhysicsEditor/PhysicsDebugWindow.cs | 181 +- .../PhysicsDebugWindowContactsTab.cs | 6 +- .../PhysicsEditor/PhysicsManagerInspector.cs | 14 +- .../PhysicsEditor/PhysicsMaterialEditor.cs | 10 +- Modules/PhysicsEditor/RagdollBuilderWindow.cs | 5 - Modules/PhysicsEditor/RigidbodyEditor.cs | 32 +- Modules/PhysicsEditor/SphereColliderEditor.cs | 2 +- .../PhysicsEditor/TerrainColliderEditor.cs | 4 +- Modules/PhysicsEditor/WheelColliderEditor.cs | 18 +- .../Scenarios/PlayModeScenarioUtils.cs | 3 + .../ActiveScenarioWindow.cs | 5 - .../PlayModeScenariosWindow/LabelWithIcon.cs | 2 - .../PlayModeListView.cs | 4 +- .../PlayModeScenariosWindow.cs | 5 - .../AddPresetTypeWindow.cs | 2 - Modules/PresetsUIEditor/PresetEditor.cs | 10 +- .../PresetsUIEditor/PresetManagerEditor.cs | 4 +- Modules/PresetsUIEditor/PresetSelector.cs | 4 +- .../ProfilerRoleProvider.cs | 18 +- .../Chart/BottlenecksChartViewController.cs | 9 +- .../Chart/Data/BottlenecksChartViewModel.cs | 8 +- ...GlobalProfilerPersistentSettingsService.cs | 2 - ...gacySingletonProfilerCaptureDataService.cs | 2 - .../SingleFrameTimesSectionViewController.cs | 2 - .../FrameBottlenecksViewController.cs | 2 - .../PieChart/PieChartViewController.cs | 2 - .../RangeBottlenecksViewController.cs | 2 - .../Summary/FrameSummaryViewController.cs | 8 +- .../SystemsImpactViewController.cs | 2 - .../Captures/CaptureDataService.cs | 10 +- .../Captures/CaptureFileBaseViewController.cs | 2 - .../CaptureFileTreeItemViewController.cs | 14 +- .../Captures/ScreenshotsManager.cs | 2 - .../EditorCoroutines/EditorCoroutine.cs | 2 - .../IProfilerWindowController.cs | 1 - .../ModuleEditor/ModuleEditorWindow.cs | 2 - .../ProfilerDetailedCallsView.cs | 16 +- .../ProfilerWindow/ProfilerDetailedView.cs | 4 +- .../ProfilerFrameDataTreeView.cs | 2 +- .../ProfilerFrameHierarchyView.cs | 6 +- .../ProfilerWindow/ProfilerFrameViewBase.cs | 83 +- .../ProfilerModules/CPU/CPUProfilerModule.cs | 9 +- .../CPU/FlowIndicatorDrawer.cs | 2 - .../ProfilerModules/CPUorGPUProfilerModule.cs | 68 +- .../IProfilerViewOptionsMenuContributor.cs | 23 + .../JobsProfilerViewProvider.cs | 54 + .../Memory/MemoryProfilerModule.cs | 6 +- .../Rendering/RenderingProfilerModule.cs | 4 +- .../ScreenshotDetailsViewController.cs | 8 + .../Screenshots/ScreenshotIndexCatalogue.cs | 317 +- .../ScreenshotsModuleViewController.cs | 16 +- .../SwitchableLegacyDetailsViewController.cs | 15 +- .../VirtualTexturingProfilerView.cs | 12 +- .../ProfilerModules/uGui/UISystemProfiler.cs | 26 +- .../uGui/UISystemProfilerModelBuilder.cs | 4 +- .../uGui/UISystemProfilerTreeView.cs | 4 +- .../ProfilerModulesDropdownWindow.cs | 2 - .../ProfilerWindow/ProfilerWindow.cs | 124 +- .../Public/FrameDataView.bindings.cs | 6 + .../Public/ProfilerAPI.bindings.cs | 9 + .../ProfilerEditor/Public/ProfilerSettings.cs | 10 + .../Public/ProfilerSettingsProvider.cs | 28 +- Modules/Progress/ProgressWindow.cs | 7 +- .../ProjectAuditorEditor/API/Enums/Areas.cs | 5 +- .../API/Enums/IssueCategory.cs | 29 + .../API/IRenderPipelineAssetCreator.cs | 21 + .../API/ProjectAuditor.cs | 16 +- Modules/ProjectAuditorEditor/API/Report.cs | 53 +- .../ProjectAuditorAssistantController.cs | 4 +- .../CodeAnalysis/RoslynDiagnosticsLibrary.cs | 7 + .../Core/API/ShaderModuleAnalyzer.cs | 5 + .../Core/AnalysisCoroutine.cs | 18 +- .../Core/DescriptorExtensions.cs | 49 +- .../Core/ObsoleteLibrary.cs | 12 +- .../Modules/AssetsModuleResourcesAnalyzer.cs | 64 - .../Modules/AudioClipAnalyzer.cs | 415 - .../Modules/CodeModule.cs | 28 +- .../GameObjectModuleMeshColliderAnalyzer.cs | 2 - .../GameObjectModuleReadWriteAnalyzer.cs | 2 - .../Modules/MaterialAnalyzer.cs | 113 - .../Modules/MeshAnalyzer.cs | 136 - .../Modules/MigrationToURPModule.cs | 41 +- .../Modules/MigrationToURPUtilities.cs | 205 + .../Modules/PackagesAnalyzer.cs | 109 - .../Modules/ShadersModule.cs | 3 + .../Modules/SpriteAtlasAnalyzer.cs | 63 - .../Modules/SpriteAtlasModule.cs | 14 +- .../Modules/TextureAnalyzer.cs | 203 - .../Modules/TextureUtilizationAnalyzer.cs | 133 - .../BuiltinRenderPipelineAnalyzer.cs | 116 - .../BuiltinSettingsAnalyzer.cs | 1 + .../EditorSettingsAnalyzer.cs | 77 - .../EntitiesGraphicsAnalyzer.cs | 58 - .../SettingsAnalysis/FogStrippingAnalyzer.cs | 105 - .../SettingsAnalysis/GraphicsApiAnalyzer.cs | 73 - .../SettingsAnalysis/HdrpAnalyzer.cs | 45 - .../SettingsAnalysis/Physics2DAnalyzer.cs | 72 - .../SettingsAnalysis/PhysicsAnalyzer.cs | 49 - .../PlayerSettingsAnalyzer.cs | 199 - .../QualitySettingsAnalyzer.cs | 221 - .../SettingsAnalysis/RenderPipelineUtils.cs | 97 - .../SrpAssetSettingsAnalyzer.cs | 71 - .../StreamingAssetsFolderAnalyzer.cs | 74 - .../SettingsAnalysis/StrippingAnalyzer.cs | 84 - .../TargetArchitectureAnalyzer.cs | 58 - .../SettingsAnalysis/TimeSettingsAnalyzer.cs | 56 - .../UI/CodeDomainReloadView.cs | 33 - .../UI/CompilerMessagesView.cs | 2 - .../UI/Framework/AnalysisView.cs | 11 +- .../UI/Framework/AreaSelectionWindow.cs | 2 - .../UI/Framework/AssemblySelectionWindow.cs | 2 - .../UI/Framework/ChartUtil.cs | 10 + .../UI/Framework/DescriptorSearchProvider.cs | 4 +- .../UI/Framework/DiagnosticView.cs | 24 +- .../UI/Framework/IssueSearchProvider.cs | 8 +- .../UI/Framework/IssueTable.cs | 6 +- .../UI/Framework/SelectionWindow.cs | 2 - .../TreeViews/ViewSelectionTreeView.cs | 2 - .../UI/Framework/Utility.cs | 91 +- .../UI/Framework/ViewManager.cs | 27 +- .../UI/MigrateToCoreCLRSummaryView.cs | 108 +- .../UI/MigrateToURPSummaryView.cs | 62 +- .../UI/MigrationWizardRunner.cs | 186 + .../UI/MigrationWorkflowView.cs | 781 + .../UI/OptimizationSummaryView.cs | 78 +- .../UI/ProjectAuditorWindow.cs | 135 +- .../UI/ShaderCompilerMessagesView.cs | 2 - .../ProjectAuditorEditor/UI/SummaryView.cs | 63 +- .../UI/UpgradeSummaryView.cs | 103 +- .../ProjectAuditorEditor/UserPreferences.cs | 32 +- .../Utils/PlayerSettingsUtil.cs | 174 - Modules/Properties/Runtime/Attributes.cs | 31 - .../Module/PropertiesEditorInitialization.cs | 2 +- .../Editor/Implementation/QuickInstaller.cs | 2 - .../Editor/Indexing/AssetIndexer.cs | 2 - .../Editor/Indexing/IndexManager.cs | 9 +- .../Editor/Indexing/ObjectIndexer.cs | 2 - .../Editor/Indexing/SearchIndexer.cs | 2 - .../QuickSearch/Editor/Indexing/SearchTask.cs | 2 - .../PropertyDatabase/PropertyDatabase.cs | 14 +- .../Editor/Providers/AdbProvider.cs | 2 - .../Providers/BasePerformanceProvider.cs | 2 - .../Providers/MainToolbarElementProvider.cs | 95 + .../Editor/Providers/MenuProvider.cs | 29 +- .../Editor/Providers/PerformanceProvider.cs | 2 - .../Providers/ProfilerMarkersProvider.cs | 2 - .../Editor/Providers/SceneProvider.cs | 2 - .../Editor/Providers/SearchServiceProvider.cs | 5 +- .../Editor/Providers/SettingsProvider.cs | 2 - .../Providers/ToolbarFavoritesProvider.cs | 101 + .../QueryBuilder/Blocks/QueryAddNewBlock.cs | 2 - .../QueryBuilder/Blocks/QueryBlockEditor.cs | 2 - .../Blocks/QueryExpressionBlock.cs | 2 - .../QueryBuilder/Blocks/QueryFilterBlock.cs | 2 - .../QueryBuilder/Blocks/QueryListBlock.cs | 2 - .../Blocks/QueryListBlockAttribute.cs | 6 + .../Editor/QueryBuilder/QueryBuilder.cs | 2 - .../QueryBuilder/QueryBuilderHelpers.cs | 2 - Modules/QuickSearch/Editor/SearchAnalytics.cs | 6 +- Modules/QuickSearch/Editor/SearchContext.cs | 2 - .../Editor/SearchEngines/SearchEngines.cs | 2 - Modules/QuickSearch/Editor/SearchItem.cs | 16 +- Modules/QuickSearch/Editor/SearchMonitor.cs | 33 + Modules/QuickSearch/Editor/SearchProvider.cs | 5 +- .../Editor/SearchQuery/SearchQuery.cs | 5 +- .../Editor/SearchQuery/SearchQueryAsset.cs | 6 + .../SearchQuery/SearchTemplateAttribute.cs | 3 + Modules/QuickSearch/Editor/SearchService.cs | 5 +- Modules/QuickSearch/Editor/SearchSettings.cs | 36 +- Modules/QuickSearch/Editor/SearchUtils.cs | 14 +- Modules/QuickSearch/Editor/SearchViewModel.cs | 2 - .../QuickSearch/Editor/Table/ColumnEditor.cs | 2 - .../QuickSearch/Editor/Table/SearchReport.cs | 2 - .../Editor/Transactions/TransactionViewer.cs | 2 - .../Editor/UI/HierarchySearchItemHandler.cs | 80 +- Modules/QuickSearch/Editor/UI/Icons.cs | 2 - .../Editor/UI/MainToolbarMenuItemPicker.cs | 38 - .../Editor/UI/MainToolbarPicker.cs | 416 + Modules/QuickSearch/Editor/UI/ObjectField.cs | 8 +- .../Editor/UI/SearchItemHierarchyNodeMap.cs | 24 +- .../Editor/UI/SearchItemHierarchySorting.cs | 15 +- .../Editor/UI/SearchPickerWindow.cs | 7 +- .../QuickSearch/Editor/UI/SearchViewState.cs | 2 - Modules/QuickSearch/Editor/UITK/GridView.cs | 6 +- .../UITK/ProjectSearchQueryTreeNodeHandler.cs | 2 - .../Editor/UITK/SearchBaseCollectionView.cs | 4 +- .../Editor/UITK/SearchDetailView.cs | 8 +- .../Editor/UITK/SearchEmptyView.cs | 2 - .../QuickSearch/Editor/UITK/SearchField.cs | 2 - .../QuickSearch/Editor/UITK/SearchGroupBar.cs | 2 - .../UITK/SearchIndexingWarningWindow.cs | 2 - .../Editor/UITK/SearchItemEditorElement.cs | 2 - .../Editor/UITK/SearchQueryBuilderView.cs | 4 +- .../Editor/UITK/SearchQueryPanelTreeView.cs | 2 - .../Editor/UITK/SearchStatusBar.cs | 2 - .../Editor/UITK/SearchTableView.cs | 16 +- .../Editor/UITK/SearchTableViewCell.cs | 4 +- .../QuickSearch/Editor/UITK/SearchToolbar.cs | 2 - .../QuickSearch/Editor/UITK/SearchTreeView.cs | 68 +- Modules/QuickSearch/Editor/UITK/SearchView.cs | 2 - .../QuickSearch/Editor/UITK/SearchViewItem.cs | 7 +- .../QuickSearch/Editor/UITK/SearchWindow.cs | 6 +- Modules/QuickSearch/Editor/Utilities/Utils.cs | 15 +- Modules/SafeMode/SafeModeToolbarWindow.cs | 16 +- .../SceneTemplateEditor/DependencyListView.cs | 2 - Modules/SceneTemplateEditor/ScenePicker.cs | 2 - .../SceneTemplateDialog.cs | 5 - .../SceneTemplateProjectSettings.cs | 12 +- .../SceneTemplateEditor/SceneTemplateUtils.cs | 2 - Modules/SceneView/CameraOverlay.cs | 2 - .../SceneView/SceneViewLightingOverlays.cs | 10 +- Modules/SceneView/SceneViewToolbarElements.cs | 2 - .../Attributes/CreatePropertyAttribute.cs | 39 + .../Attributes/MovedFromAttribute.cs | 4 +- .../Attributes/SerializeFieldAttribute.cs | 15 + .../Scripting/Debug/LowLevelDebug.bindings.cs | 28 +- .../Scripting/Debug/LowLevelDebug.cs | 31 +- .../RuntimeInitializeOnLoadAttribute.cs | 0 .../ReflectedFunction.bindings.cs | 2 +- .../Public/Managed/IHasFunctionSignature.cs | 21 + .../ShaderIncludeEditorExtensions.cs | 0 Modules/ShaderLabParserEditor/AssemblyInfo.cs | 7 + .../Public/Managed/ShaderUtil.cs | 31 + .../Public/Managed/ShouldBePublicAttribute.cs | 15 + .../Managed/VirtualFunctionDeclaration.cs | 49 + .../Reflection/PartialStruct.bindings.cs | 45 + .../ShaderInterfaceReflection.bindings.cs | 71 + .../Public/Reflection/ShaderScope.bindings.cs | 23 + .../Public/Reflection/StructField.bindings.cs | 26 + .../Reflection/VirtualFunction.bindings.cs | 43 + .../VirtualFunctionOverride.bindings.cs | 22 + .../ConflictResolverWindow.cs | 27 +- .../DeleteShortcutProfileWindow.cs | 5 - .../ShortcutController.cs | 9 +- .../ShortcutHelperBarUtility.cs | 2 - .../ShortcutManagerWindow.cs | 5 - .../ShortcutManagerWindowView.cs | 18 +- .../SketchUpEditor/Mono/SketchUpImportDlg.cs | 10 +- .../Mono/SketchUpImporterModelEditor.cs | 26 +- Modules/SmartStrings/AssemblyInfo.cs | 2 + .../SmartFormat/Core/Output/StringOutput.cs | 2 +- .../Core/Parsing/EscapedLiteral.cs | 10 +- .../SmartFormat/Core/Parsing/Format.cs | 6 +- .../SmartFormat/Core/Parsing/LiteralText.cs | 2 +- .../SmartFormat/Core/Parsing/Parser.cs | 83 +- .../SmartFormat/Core/Parsing/ParsingErrors.cs | 2 +- .../SmartFormat/Core/Parsing/Placeholder.cs | 2 +- .../SmartFormat/Core/Parsing/Selector.cs | 2 +- .../SmartFormat/Core/Parsing/SplitList.cs | 2 +- .../SmartFormat/Core/Settings/ErrorAction.cs | 30 - .../Core/Settings/SmartSettings.cs | 51 +- .../Extensions.Time/TimeFormatter.cs | 13 - .../Utilities/CommonLanguagesTimeTextInfo.cs | 12 + .../Utilities/TimeSpanFormatOptions.cs | 78 +- .../Utilities/TimeSpanUtility.cs | 34 +- .../Extensions/IsMatchFormatter.cs | 4 +- .../VariablesGroupAsset.cs | 9 - .../Extensions/PropertiesSource.cs | 12 +- .../Extensions/SubStringFormatter.cs | 4 +- .../Extensions/WellKnownExtensionTypes.cs | 10 +- Modules/SmartStrings/SmartFormat/Smart.cs | 26 +- .../SmartFormat/SmartFormatter.cs | 107 +- ...SmartFormatterLiteralCharacterExtractor.cs | 2 + .../Editor/Managed/SpriteMaskEditor.cs | 20 +- .../Managed/SpriteShapeRendererEditor.cs | 10 +- Modules/TerrainEditor/Brush/Brush.cs | 16 +- Modules/TerrainEditor/Brush/BrushEditor.cs | 18 +- Modules/TerrainEditor/Brush/BrushList.cs | 6 +- .../TerrainEditor/Overlays/BrushAttributes.cs | 5 +- .../TerrainEditor/Overlays/BrushesOverlay.cs | 2 - .../TerrainTransientToolbarOverlay.cs | 8 +- .../PaintTools/CreateTerrainTool.cs | 6 +- .../PaintTools/PaintDetailsTool.cs | 33 +- .../PaintTools/PaintDetailsToolUtility.cs | 2 - .../PaintTools/PaintHeightTool.cs | 2 +- .../PaintTools/PaintTreesTool.cs | 34 +- .../TerrainEditor/PaintTools/SetHeightTool.cs | 10 +- .../PaintTools/SmoothHeightTool.cs | 4 +- Modules/TerrainEditor/PaintTools/StampTool.cs | 8 +- Modules/TerrainEditor/TerrainInspector.cs | 204 +- Modules/TerrainEditor/TerrainWizards.cs | 16 +- .../Utilities/TerrainLayerInspector.cs | 38 +- .../Utilities/TerrainLayerUtility.cs | 26 +- .../TextCoreFontEngine/Managed/FaceInfo.cs | 8 +- .../Managed/MaterialManager.cs | 3 + .../Managed/MaterialReferenceManager.cs | 2 + .../Managed/TextAssets/FontAsset.cs | 42 + .../FontAsset/FontAsset.Deprecated.cs | 8 +- .../FontAsset/FontAssetAtlasPopulation.cs | 15 + .../TextAssets/FontAsset/FontAssetFactory.cs | 10 +- .../TextAssets/FontAsset/NativeFontAsset.cs | 27 + .../Managed/TextAssets/FontAssetUtilities.cs | 3 + .../TextAssets/TextSettings.Deprecated.cs | 4 +- .../Managed/TextAssets/TextSettings.cs | 25 +- .../Managed/TextEventManager.cs | 9 + .../Managed/TextGenerator.cs | 3 + .../Managed/TextGenerator/NativeTextBuffer.cs | 26 +- .../NativeTextGenerationSettings.bindings.cs | 27 +- .../Public/TextGenerationSettings.cs | 169 + .../TextGenerator/Public/TextGenerator.cs | 361 + .../Managed/TextGenerator/Public/TextMesh.cs | 116 + .../RichTextAssetRegistry.bindings.cs | 31 +- .../TextGenerator/TextGeneratorParsing.cs | 12 +- .../TextGeneratorPreferredValues.cs | 14 +- .../Managed/TextGenerator/TextLib.bindings.cs | 6 + .../TextCoreTextEngine/Managed/TextHandle.cs | 8 +- .../Managed/TextShaderUtilities.Deprecated.cs | 6 + .../Managed/AssemblyInfo.cs | 1 + .../Managed/FontAssetCreatorWindow.cs | 2 - .../Managed/FontAssetEditor.cs | 3 +- .../Managed/FontAssetEditorSubsetting.cs | 38 +- .../Managed/FontAssetMigrationProvider.cs | 350 + .../Managed/FontAssetMigrationWindow.cs | 548 + .../Managed/FontAssetStaticMigrator.cs | 149 +- .../Managed/FontSubsetterManager.cs | 130 +- .../CharacterPropertyDrawer.cs | 4 +- ...GlyphPairAdjustmentRecordPropertyDrawer.cs | 4 +- .../PropertyDrawers/GlyphPropertyDrawer.cs | 4 +- ...igatureSubstitutionRecordPropertyDrawer.cs | 4 +- ...arkToBaseAdjustmentRecordPropertyDrawer.cs | 4 +- ...arkToMarkAdjustmentRecordPropertyDrawer.cs | 4 +- .../Managed/SpriteAssetImporter.cs | 4 - .../Managed/TextCoreShaderGUI.Deprecated.cs | 4 - .../Managed/TextEditorResourceManager.cs | 4 - Modules/TextRendering/TextGenerator.cs | 2 - .../TextRendering/TextRendering.bindings.cs | 3 + .../TrueTypeFontImporterInspector.cs | 22 +- .../Editor/Managed/TileEditor.cs | 16 +- .../Editor/Managed/TilemapCollider2DEditor.cs | 8 +- .../Editor/Managed/TilemapEditor.cs | 16 +- .../Editor/Managed/TilemapRendererEditor.cs | 4 +- Modules/TreeEditor/TreeEditor.cs | 10 +- Modules/UIBuilder/Editor/Builder/Builder.cs | 209 +- .../Editor/Builder/BuilderPaneWindow.cs | 5 - .../Editor/Builder/BuilderSelection.cs | 6 +- .../UxmlBatchedChangesController.cs | 2 - .../Builder/Document/BuilderDocument.cs | 37 +- .../Document/BuilderDocumentOpenUXML.cs | 261 +- .../Document/BuilderUXMLFileSettings.cs | 2 - .../Builder/Draggers/BuilderClassDragger.cs | 4 + .../Draggers/BuilderExplorerDragger.cs | 5 + .../Draggers/BuilderHierarchyDragger.cs | 2 +- .../Builder/Explorer/BuilderExplorer.cs | 2 - .../Builder/Explorer/BuilderExplorerItem.cs | 7 +- .../Builder/Explorer/BuilderHierarchy.cs | 4 +- .../Explorer/BuilderHierarchyWindow.cs | 5 - .../Builder/Explorer/BuilderStyleSheets.cs | 11 +- .../Explorer/BuilderStyleSheetsContextMenu.cs | 9 +- .../Explorer/BuilderStyleSheetsUtilities.cs | 2 +- .../Explorer/BuilderStyleSheetsWindow.cs | 5 - .../Inspector/Binding/BuilderBindingView.cs | 2 - .../Inspector/Binding/BuilderBindingWindow.cs | 8 +- .../Builder/Inspector/BuilderInspector.cs | 13 +- .../Inspector/BuilderInspectorCanvas.cs | 8 +- .../Inspector/BuilderInspectorComponents.cs | 2 - .../Inspector/BuilderInspectorHeader.cs | 6 +- .../Inspector/BuilderInspectorLocalStyles.cs | 27 +- .../BuilderInspectorPreviewWindow.cs | 7 +- .../BuilderInspectorStyleFields+Grid.cs | 134 + ...BuilderInspectorStyleFields+Transitions.cs | 6 +- .../Inspector/BuilderInspectorStyleFields.cs | 10 + .../Inspector/BuilderInspectorVariables.cs | 2 - .../Inspector/BuilderInspectorWindow.cs | 5 - .../Editor/Builder/Library/BuilderLibrary.cs | 14 +- .../Builder/Library/BuilderLibraryContent.cs | 21 +- .../Library/BuilderLibraryProjectScanner.cs | 5 + .../Builder/Library/BuilderLibraryTreeItem.cs | 2 - .../Builder/Library/BuilderLibraryWindow.cs | 5 - .../Manipulators/BuilderManipulator.cs | 3 +- .../Builder/Previews/BuilderPreviewWindow.cs | 5 - .../Previews/BuilderUssPreviewWindow.cs | 5 - .../Previews/BuilderUxmlPreviewWindow.cs | 5 - .../Editor/Builder/Toolbar/BuilderToolbar.cs | 127 +- .../Utilities/BuilderAnalyticsUtility.cs | 6 + .../BuilderAssetModificationProcessor.cs | 3 + .../Utilities/BuilderAssetPostprocessor.cs | 3 + .../Utilities/BuilderAssetUtilities.cs | 20 +- .../Utilities/BuilderCommandHandler.cs | 76 +- .../Builder/Utilities/BuilderConstants.cs | 10 +- .../Utilities/BuilderDialogsUtility.cs | 12 +- .../Builder/Utilities/BuilderEditorUtility.cs | 6 +- .../Utilities/BuilderElementContextMenu.cs | 18 +- .../Utilities/BuilderStyleUtilities.cs | 34 +- .../Editor/Builder/Viewport/BuilderCanvas.cs | 2 - .../BuilderInPlaceTextEditingUtilities.cs | 4 + .../Builder/Viewport/BuilderViewport.cs | 10 +- .../Builder/Viewport/BuilderViewportWindow.cs | 5 - .../Animations/BuilderAnimationData.cs | 4 +- .../ElementHierarchyView.cs | 11 +- .../FoldoutField/FoldoutColorField.cs | 2 - .../Utilities/FoldoutField/FoldoutField.cs | 2 - .../FoldoutField/FoldoutNumberField.cs | 2 - .../FoldoutField/FoldoutTransitionField.cs | 2 - .../FoldoutWithCheckbox.cs | 2 - .../Editor/Utilities/HelpBox/HelpBox.cs | 2 - .../LibraryFoldout/LibraryFoldout.cs | 2 - .../BuilderCategoryPersistedFoldout.cs | 2 - .../PersistedFoldout/PersistedFoldout.cs | 2 - .../StyleField/BackgroundGradientField.cs | 2 - .../StyleField/BorderBoxModelView.cs | 2 - .../Utilities/StyleField/BoxModelElement.cs | 2 - .../Utilities/StyleField/CursorStyleField.cs | 2 - .../Utilities/StyleField/ImageStyleField.cs | 2 - .../StyleField/SpacingBoxModelView.cs | 2 - .../StyleField/StyleFieldPopupWindow.cs | 5 - .../StyleSheetExtensions.cs | 8 +- .../StyleSheetUtilities.cs | 2 +- .../Transitions/BuilderTransitionData.cs | 4 +- .../Transitions/TransitionListView.cs | 2 - .../TransitionPropertyDropdownContent.cs | 3 + Modules/UICommon/AssemblyInfo.cs | 28 +- Modules/UICommon/EventCommandNames.cs | 115 +- Modules/UIElements/AssemblyInfo.cs | 1 + .../AccessibilityFrameProjection.cs | 170 +- .../AccessibilityRoleRegistry.cs | 27 +- .../AccessibilityTreeGenerator.cs | 240 +- .../Accessibility/UITKAccessibilityBridge.cs | 799 +- .../Authoring/VisualTreeAuthoringUpdater.cs | 8 +- .../Core/Bindings/ComponentBinding.cs | 6 +- .../DefaultMultiColumnTreeViewController.cs | 2 - .../MultiColumnListViewController.cs | 2 - .../MultiColumnTreeViewController.cs | 2 - .../DynamicHeightVirtualizationController.cs | 2 - .../FixedHeightVirtualizationController.cs | 2 - .../VerticalVirtualizationController.cs | 2 - .../Core/Components/ComponentManager.cs | 375 +- .../Core/Components/ComponentTypeSet.cs | 276 + .../Components/IVisualElementComponent.cs | 21 + .../Core/Components/ManagedComponentBox.cs | 82 + .../Components/ManagedComponentRegistry.cs | 166 + .../UIElements/Core/Controls/BaseBoolField.cs | 4 - .../Core/Controls/BaseCompositeField.cs | 2 - .../UIElements/Core/Controls/BaseListView.cs | 4 +- .../Core/Controls/BasePopupField.cs | 2 - .../UIElements/Core/Controls/BoundsField.cs | 2 - .../Core/Controls/BoundsIntField.cs | 2 - Modules/UIElements/Core/Controls/Box.cs | 2 - Modules/UIElements/Core/Controls/Button.cs | 4 - .../Core/Controls/ButtonStripField.cs | 2 - .../Controls/CollectionView/CollectionView.cs | 2 - .../CollectionView/CollectionViewDragger.cs | 2 - .../CollectionView/CollectionViewScroller.cs | 2 - .../CollectionView/LayoutConfiguration.cs | 2 - ...llectionViewMultiColumnCollectionHeader.cs | 2 - .../CollectionViewMultiColumnHeaderColumn.cs | 2 - .../Controls/CollectionView/RecycledItem.cs | 4 - .../CollectionView/ScrollContainer.cs | 2 - .../Core/Controls/CompoundFields.cs | 2 - .../UIElements/Core/Controls/DoubleField.cs | 2 - .../UIElements/Core/Controls/DropdownField.cs | 2 - .../UIElements/Core/Controls/EntityIdField.cs | 2 - Modules/UIElements/Core/Controls/EnumField.cs | 2 - .../UIElements/Core/Controls/FloatField.cs | 2 - Modules/UIElements/Core/Controls/Foldout.cs | 2 - Modules/UIElements/Core/Controls/GUIDField.cs | 2 - .../Core/Controls/GenericDropdownMenu.cs | 2 - Modules/UIElements/Core/Controls/GroupBox.cs | 4 +- .../UIElements/Core/Controls/Hash128Field.cs | 2 - Modules/UIElements/Core/Controls/HelpBox.cs | 2 - Modules/UIElements/Core/Controls/Image.cs | 4 - .../Controls/InputField/AbstractBaseField.cs | 6 +- .../Core/Controls/InputField/BaseField.cs | 2 - .../Core/Controls/InputField/TextField.cs | 2 - .../UIElements/Core/Controls/IntegerField.cs | 2 - Modules/UIElements/Core/Controls/Label.cs | 2 - Modules/UIElements/Core/Controls/ListView.cs | 2 - Modules/UIElements/Core/Controls/LongField.cs | 2 - .../UIElements/Core/Controls/Mask64Field.cs | 2 - Modules/UIElements/Core/Controls/MaskField.cs | 2 - .../UIElements/Core/Controls/MinMaxSlider.cs | 2 - .../Core/Controls/MultiColumn/ColumnMover.cs | 2 - .../Controls/MultiColumn/ColumnResizer.cs | 2 - .../MultiColumnCollectionHeader.cs | 2 - .../MultiColumn/MultiColumnController.cs | 2 - .../MultiColumn/MultiColumnHeaderColumn.cs | 2 - .../MultiColumnHeaderColumnResizeHandle.cs | 2 - .../MultiColumn/MultiColumnListView.cs | 2 - .../MultiColumn/MultiColumnTreeView.cs | 2 - .../UIElements/Core/Controls/PopupField.cs | 2 - .../UIElements/Core/Controls/PopupWindow.cs | 2 - .../UIElements/Core/Controls/ProgressBar.cs | 2 - .../UIElements/Core/Controls/RadioButton.cs | 2 - .../Core/Controls/RadioButtonGroup.cs | 2 - .../UIElements/Core/Controls/RepeatButton.cs | 2 - Modules/UIElements/Core/Controls/Slider.cs | 2 - Modules/UIElements/Core/Controls/SliderInt.cs | 2 - .../Core/Controls/StyleField/AngleField.cs | 2 - .../Controls/StyleField/EnumToggleField.cs | 4 - .../Core/Controls/StyleField/LengthField.cs | 2 - .../Core/Controls/StyleField/RotateField.cs | 2 - .../Core/Controls/StyleField/ScaleField.cs | 2 - .../Controls/StyleField/TimeValueField.cs | 2 - .../Controls/StyleField/TranslateField.cs | 2 - Modules/UIElements/Core/Controls/Tab.cs | 4 +- .../UIElements/Core/Controls/TabDragger.cs | 2 - Modules/UIElements/Core/Controls/TabView.cs | 2 - Modules/UIElements/Core/Controls/Toggle.cs | 2 - .../ToggleButtonGroup/ToggleButtonGroup.cs | 2 - Modules/UIElements/Core/Controls/TreeView.cs | 2 - .../Core/Controls/TwoPaneSplitView.cs | 2 - .../Core/Controls/UnsignedIntegerField.cs | 2 - .../Core/Controls/UnsignedLongField.cs | 2 - .../Core/DragAndDrop/DragEventsProcessor.cs | 2 - .../Core/DragAndDrop/ListViewDragger.cs | 2 - .../DragAndDrop/ListViewDraggerAnimated.cs | 2 - Modules/UIElements/Core/DropdownMenu.cs | 2 + .../EventDebugger/GlobalCallbackRegistry.cs | 3 + .../Core/Events/EventDispatchUtilities.cs | 2 +- .../UIElements/Core/Events/EventHandler.cs | 17 +- Modules/UIElements/Core/FieldMouseDragger.cs | 4 - .../Core/FilterFunctionDefinition.cs | 32 +- .../Core/FilterFunctionDefinitionUtils.cs | 43 +- Modules/UIElements/Core/FocusController.cs | 29 +- .../Core/GameObjects/DefaultEventSystem.cs | 3 + .../Core/GameObjects/PanelComponentUtils.cs | 6 + .../Core/GameObjects/PanelSettings.cs | 22 + .../Core/GameObjects/RuntimePanel.cs | 3 +- .../UIElements/Core/GameObjects/UIDocument.cs | 24 +- .../Core/GameObjects/WorldSpaceInput.cs | 167 +- Modules/UIElements/Core/IMGUIContainer.cs | 85 +- .../UIElements/Core/ImmediateModeElement.cs | 4 - .../UIElements/Core/Layout/LayoutManager.cs | 14 +- .../Core/Native/ProfilerUIToolkit.bindings.cs | 12 + .../Native/Renderer/PanelRenderer.bindings.cs | 154 +- .../NativeSelectorMatcher.bindings.cs | 7 +- .../NativeTransformUtils.bindings.cs | 4 - Modules/UIElements/Core/Panel.cs | 29 +- .../Core/Renderer/UIRElementBuilder.cs | 4 +- .../Core/Renderer/UIRGpuUpdaterStaged.cs | 53 +- .../Core/Renderer/UIRMeshGenerator.cs | 6 +- .../UIElements/Core/Renderer/UIRPainter2D.cs | 4 +- .../UIElements/Core/Renderer/UIRRenderData.cs | 9 + .../Core/Renderer/UIRRenderEvents.cs | 9 +- .../Core/Renderer/UIRRenderTreeAtlas.cs | 28 +- .../Core/Renderer/UIRRenderTreeCompositor.cs | 69 +- .../Core/Renderer/UIRRenderTreeManager.cs | 19 +- .../Core/Renderer/UIRRepaintUpdater.cs | 31 +- .../Core/Renderer/UIRShaderInfoStorage.cs | 40 +- .../Core/Renderer/UIRShaderInfoUpdateGuard.cs | 27 +- .../Core/Renderer/UIRVEShaderInfoAllocator.cs | 14 - .../UIRenderer/UIRBackdropFilterHelper.cs | 114 +- .../Renderer/UIRenderer/UIRFilterHelper.cs | 49 +- .../UIElements/Core/Style/FilterFunction.cs | 25 + .../Style/Generated/StylePropertyUtil.gen.cs | 2 +- .../Core/Style/InlineStyleAccess.cs | 12 +- .../StyleSheets/SelectorAccelerationCache.cs | 232 +- .../SelectorAccelerationCacheBuilder.cs | 14 +- .../Core/StyleSheets/StyleClassList.cs | 9 +- .../Core/StyleSheets/StyleSelectorHelper.cs | 13 +- Modules/UIElements/Core/TemplateContainer.cs | 2 - Modules/UIElements/Core/Text/ATGTextHandle.cs | 35 +- .../UIElements/Core/Text/ATGTextJobSystem.cs | 6 +- .../Core/Text/NativeTextBufferReclaimer.cs | 68 - .../UIElements/Core/Text/PanelTextSettings.cs | 3 + .../UIElements/Core/Text/TextBufferStore.cs | 189 + Modules/UIElements/Core/Text/TextUtilities.cs | 8 + .../UIElements/Core/Text/UITKTextHandle.cs | 4 + .../Core/Text/UITKTextHandleOverlay.cs | 14 +- .../UIElements/Core/Text/UITKTextJobSystem.cs | 4 +- Modules/UIElements/Core/TextElement.cs | 94 +- Modules/UIElements/Core/TextElementEdition.cs | 12 +- .../Core/UIElementsRuntimeUtility.cs | 9 +- Modules/UIElements/Core/UIElementsUtility.cs | 23 +- .../UIElements/Core/UXML/UxmlAttributes.cs | 86 +- .../Core/UXML/UxmlDescriptionRegistry.cs | 5 +- .../Core/UXML/UxmlSerializedData.cs | 7 +- .../Core/VisualElement.Components.cs | 404 +- Modules/UIElements/Core/VisualElement.cs | 89 +- .../UIElements/Core/VisualElementFocusRing.cs | 95 +- .../UIElements/Core/VisualElementHierarchy.cs | 8 +- .../Core/VisualElementTransformData.cs | 2 + .../UIElements/Core/VisualElementTypeData.cs | 7 +- ...tAccessibilitySettingsProviderExtension.cs | 10 +- .../SerializedObjectBindingContext.cs | 3 + .../VisualElementComponentVisibility.cs | 44 + .../UIElementsEditor/Debugger/BoxModelView.cs | 4 +- .../Debugger/ComponentsDebugger.cs | 28 +- .../Events/UIElementsEventDebugger.cs | 4 +- .../Debugger/LayoutDiagnosticsTab.cs | 5 - .../Debugger/PanelDebugger.cs | 8 +- .../Debugger/StylePropertyDebugger.cs | 4 +- .../Debugger/StylesDebugger.cs | 22 +- .../TextureAtlas/TextureAtlasViewerWindow.cs | 5 - .../Debugger/UIElementsDebugger.cs | 48 +- .../UIR/Debugger/AllocatorDebugger.cs | 5 - .../Debugger/UIR/Debugger/UIRDebugger.cs | 5 - .../USSStats/USSStatsStyleProfiler.cs | 2 +- .../Debugger/UxmlAttributesDebugView.cs | 4 +- .../Delegates/EditorDelegateRegistration.cs | 39 +- .../EditorContextualMenuManager.cs | 11 +- .../Inspector/PanelComponentInspectorBase.cs | 77 + .../GameObjects/LiveReloadTrackerCreator.cs | 13 +- .../PanelSettingsCreator.cs | 6 - Modules/UIElementsEditor/PanelDebug.cs | 21 +- Modules/UIElementsEditor/RetainedMode.cs | 17 +- Modules/UIElementsEditor/ThemeUtility.cs | 3 + .../UIElementsEditorInitialization.cs | 4 +- .../UIElementsEditorWindowCreator.cs | 2 - .../UIElementsViewImporter.cs | 9 +- .../UIToolkitProjectSettings.cs | 100 +- .../UIToolkitSettingsProvider.cs | 46 +- .../UXML/UxmlAttributeConverter.cs | 19 +- .../UXML/UxmlSerializedDataRegistry.cs | 3 + .../UIElementsEditor/UXML/UxmlSerializer.cs | 18 +- .../VisualElementSelectorUtility.cs | 60 + .../VisualTreeAssetChangeTrackerUpdater.cs | 2 - .../DefaultEditorWindowBackend.cs | 12 +- .../UIElementsSamples.cs | 34 +- .../UIAnimationClipAssetOpener.cs | 3 - .../Commands/AddTemplatesToElementCommand.cs | 6 +- .../Managed/Commands/SaveCommand.cs | 42 + .../Commands/SetInlineStylePropertyCommand.cs | 4 +- .../Commands/UnsetAllAttributesCommand.cs | 10 +- .../UnsetAllInlineStylePropertiesCommand.cs | 4 +- .../Managed/Commands/UnsetAttributeCommand.cs | 28 + .../UnsetInlineStylePropertyCommand.cs | 4 +- .../Controls/CodePreviews/UxmlCodePreview.cs | 19 +- .../Managed/Hierarchy/Clipboard.cs | 8 + .../Commands/LoadUIDocumentCommand.cs | 103 +- .../Hierarchy/NodeHandlerStageStrategy.cs | 72 +- .../Controls/DisplayStyleToggleField.cs | 158 + .../Controls/FilterFunctionListViewItem.cs | 8 + .../Editor/Controls/InspectorSearchField.cs | 55 +- .../StylePropertyField/StyleEnumFields.cs | 15 +- .../Editor/NotEditableAssetHelpBox.cs | 20 - .../Selection/Editor/StyleRuleInspector.cs | 53 +- .../Hierarchy/Selection/Editor/UIInspector.cs | 54 +- .../Selection/Editor/UISelectionEditor.cs | 10 +- .../Selection/Editor/VisualElementHeader.cs | 75 +- .../Editor/VisualElementInspector.cs | 148 +- .../Editor/VisualElementSelectionEditor.cs | 4 +- .../Selection/Editor/VisualTreeAssetHeader.cs | 29 +- .../Editor/VisualTreeAssetInspector.cs | 11 +- .../VisualTreeAssetInspectorActionsView.cs | 120 +- .../VisualElementSelectionRegistry.cs | 128 +- .../VisualElementNodeHandler+DragAndDrop.cs | 3 + ...ualElementNodeHandler+EditorNodeHandler.cs | 66 +- .../Hierarchy/VisualElementNodeHandler.cs | 246 +- .../Managed/Highlights/HighlightResolver.cs | 191 + .../Managed/Highlights/HighlightUtility.cs | 4 +- .../Highlights/RequestHighlightsCommand.cs | 22 +- .../IntegratedAuthoringWorkflow.cs | 4 +- .../Bindings/StylePropertyBinding.cs | 14 +- .../Controls/AttributeFieldFocusRequest.cs | 65 + .../Controls/AttributeOverridesMenu.cs | 150 +- .../Controls/BindingDataSourceView.cs | 3 +- .../Controls/ComponentStylePropertiesView.cs | 7 +- .../ComponentUxmlAttributesEditingContext.cs | 14 +- .../Controls/ComponentValueReflection.cs | 15 + .../ToggleButtonGroupPropertyDrawer.cs | 64 + .../LiveAttributePropertyController.cs | 2 +- .../Controls/StyleInspectorDefaultContent.cs | 28 +- .../Inspector/Controls/UxmlAssetUtilities.cs | 111 +- .../Inspector/Controls/UxmlAttributeField.cs | 88 +- .../Controls/UxmlAttributesEditingContext.cs | 80 +- .../UxmlAttributesEditingController.cs | 76 +- .../Inspector/Controls/UxmlAttributesView.cs | 14 + ...VisualElementAttributesInspectorElement.cs | 116 +- ...VisualElementComponentsInspectorElement.cs | 6 +- .../Managed/Menu/MenuUtility.cs | 121 +- .../AnimationRecordingStyleBridge.cs | 2 - .../SceneVisualElementAnimationResponder.cs | 3 - .../Recording/VisualElementRecordability.cs | 15 +- .../VisualElementReferenceTools.cs | 8 +- .../Managed/Registry/UIAssetRegistry.cs | 291 +- ...UIAssetRegistrySceneTracking.LiveReload.cs | 55 +- .../UIAssetRegistrySceneTracking.Prompts.cs | 2 +- .../Registry/UIAssetRegistrySceneTracking.cs | 38 +- .../Registry/UIAssetSavePrompt.Discard.cs | 68 + .../Scene/AddElementDropManipulator.cs | 18 +- .../Scene/Context/DocumentViewportContext.cs | 31 +- .../Scene/Context/IUIViewportContext.cs | 11 + .../Context/MainStageViewportSelection.cs | 6 +- .../Scene/Context/StageViewportContext.cs | 4 + .../Managed/Scene/ICanvasDropContext.cs | 6 + .../Scene/Manipulators/VisualElementMover.cs | 25 +- .../Manipulators/VisualElementTransformer.cs | 45 +- .../Managed/Scene/SelectionHandleManager.cs | 19 +- .../Managed/Scene/UICanvas.cs | 11 +- .../Managed/Scene/UICanvasDocumentRoot.cs | 214 +- .../Managed/Scene/UICanvasDropContext.cs | 3 + .../Managed/Scene/UICanvasInPlaceEditor.cs | 477 + .../Managed/Scene/UIViewport.cs | 149 +- .../Managed/Scene/UIViewportWindow.cs | 55 +- .../VisualElementManipulatorOverlayManager.cs | 21 +- .../ScreenSpacePanelPreviewOverlay.cs | 78 +- .../SceneView/UIToolkitSceneViewPicking.cs | 5 - .../SceneView/VisualElementMoveTool.cs | 11 +- .../VisualElementSceneViewOverlay.cs | 5 +- .../SceneView/VisualElementToolUtility.cs | 11 +- .../Managed/Search/UIElementsProvider.cs | 3 +- .../Settings/UIToolkitAuthoringSettings.cs | 45 - .../UIToolkitAuthoringSettingsProvider.cs | 48 +- .../Managed/Stages/StageContextMenuUtility.cs | 242 +- .../Managed/Stages/UIStageNavigation.cs | 344 + .../Managed/Stages/UIToolkitStageUtility.cs | 31 +- .../Stages/UIViewportContextMenuUtility.cs | 190 + .../Stages/VisualElementEditingStage.cs | 221 +- .../StyleSheets/StyleSheetAssetUtilities.cs | 7 +- .../StyleSheetContextMenuUtility.cs | 14 + .../Managed/StyleSheets/StyleSheetsWindow.cs | 121 +- .../Utilities/UIAnimationClipFactory.cs | 20 +- .../Managed/Utilities/VisualElementUtility.cs | 48 +- Modules/UMPE/Editor/ChannelClient.cs | 13 +- Modules/UMPE/Editor/ChannelService.cs | 5 +- .../Editor/StandaloneWindow.cs | 6 - .../Public/UnityHttpMessageHandler.cs | 75 +- .../Public/UnityWebRequest.bindings.cs | 33 +- .../UnityWebRequest/Public/WebRequestUtils.cs | 34 +- .../VisualEffectResource.bindings.cs | 22 - .../Public/VisualEffectEditorDefault.cs | 2 +- .../VideoEditor/Editor/VideoPlayerEditor.cs | 40 +- .../VideoEditor/VideoClipImporterInspector.cs | 2 - Modules/XR/ScriptBindings/XR.bindings.cs | 17 +- Modules/XR/ScriptBindings/XRInput.bindings.cs | 4 +- Modules/XREditor/XRManagementInstaller.cs | 2 +- Projects/CSharp/UnityEditor.csproj | 716 +- Projects/CSharp/UnityEngine.csproj | 454 +- README.md | 2 +- .../ScriptBindings/Clipper2D.bindings.cs | 4 +- .../Application/Application.bindings.cs | 9 + Runtime/Export/AssemblyInfo.cs | 5 +- .../Collections/CollectionExtensions.cs | 12 - Runtime/Export/Device/Application.cs | 5 + Runtime/Export/Device/SystemInfo.cs | 6 + Runtime/Export/File/ArchiveFile.bindings.cs | 6 + .../Graphics/GraphicsRenderers.bindings.cs | 5 + Runtime/Export/Graphics/LOD.bindings.cs | 3 +- ...ayTracingAccelerationStructure.bindings.cs | 35 +- .../RenderingCommandBuffer.bindings.cs | 8 +- .../Export/Graphics/RenderingCommandBuffer.cs | 92 +- .../WebGPUDeviceFilterLists.bindings.cs | 27 +- Runtime/Export/Hashing/HashUtilities.cs | 73 +- .../Loadable/LoadableObjectId.bindings.cs | 22 +- .../Export/Misc/ObjectDispatcher.bindings.cs | 2 +- .../DictionaryDrawerAttributes.cs | 2 +- .../RenderPipeline/RenderPipelineManager.cs | 6 + .../Export/Scripting/Awaitable.DelayedCall.cs | 6 + Runtime/Export/Scripting/EnumDataUtility.cs | 3 + Runtime/Export/Scripting/TypeManagerV2.cs | 120 +- .../Scripting/UnityEngineObject.bindings.cs | 13 +- .../ManagedCommands/Dictionary.cs | 284 - .../ManagedCommands/FixedBuffer.cs | 138 - .../ManagedCommands/LinearCollection.cs | 541 - .../LinearCollectionShuffle.cs | 631 - .../ManagedCommands/ReadExecutor.cs | 552 - ...lizationBackendManagedCommands.bindings.cs | 159 +- .../Serialization/ManagedCommands/Strings.cs | 407 - .../ManagedCommands/WriteExecutor.cs | 600 - Runtime/Export/Serialization/Serialization.cs | 6 - .../Export/StaticShim/ApplicationShimBase.cs | 6 + .../Export/StaticShim/SystemInfoShimBase.cs | 6 + .../Export/SystemInfo/SystemInfo.bindings.cs | 24 + Runtime/Export/iOS/iOS.deprecated.cs | 22 - Runtime/Input/MouseEvents.cs | 2 - .../DomainReloadLifecycleController.cs | 1 + .../Managed/Core}/BufferDataStager.cs | 42 +- .../Managed/Core/CallbackResolution.cs} | 0 Runtime/Serialize/Managed/Core/Commands.cs | 440 + Runtime/Serialize/Managed/Core/FuidPaths.cs | 194 + Runtime/Serialize/Managed/Core/Instances.cs | 158 + .../Managed/Core/LinearCollection.cs | 131 + .../Serialize/Managed/Core/ReadExecutor.cs | 879 + .../Serialize/Managed/Core/ReadUtilities.cs | 89 + .../Serialize/Managed/Core/SharedUtilities.cs | 80 + Runtime/Serialize/Managed/Core/Strings.cs | 325 + .../Managed/Core}/WireFormat.cs | 0 .../Serialize/Managed/Core/WriteExecutor.cs | 878 + .../Serialize/Managed/Core/WriteUtilities.cs | 45 + .../Extensions}/DictionarySerialization.cs | 0 .../Managed/Extensions}/EntityIdArray.cs | 14 +- .../Managed/Extensions/ExtensionDictionary.cs | 86 + .../Managed/Extensions/ExtensionEntityId.cs | 127 + .../Extensions/ExtensionFixedBuffer.cs | 101 + .../Extensions/ExtensionNativeValueStruct.cs | 43 + .../Extensions/ExtensionPropertyName.cs | 55 + .../Extensions/ExtensionSerializeReference.cs | 146 + .../Extensions/ExtensionSimpleNativeType.cs | 66 + .../Extensions/ExtensionUnityObject.cs | 166 + .../Managed/Extensions/Extensions.cs | 317 + .../Managed/Extensions}/UnityObjectArray.cs | 14 +- .../Managed/Extensions}/ValueReference.cs | 114 - .../BeeDriver2/Bee.BeeDriver2.dll | Bin 124416 -> 124416 bytes .../Distribution/BeeDriver2/Bee.BinLog.dll | Bin 18944 -> 18944 bytes .../BeeTinyProfiler2/Bee.TinyProfiler2.dll | Bin 20480 -> 20480 bytes .../InternalsVisibleTo.cs | 7 +- .../asmDefToCSProj/AsmDefToCSProjLib.dll | Bin 103424 -> 0 bytes .../buildTools/Unity.BuildService.dll | Bin 91648 -> 0 bytes .../buildTools/UnityEditor.MSBuild.dll | Bin 25600 -> 0 bytes .../asmDefToCSProj/AsmDefToCSProjLib.dll | Bin 0 -> 103936 bytes .../buildTools/Unity.BuildService.dll | Bin 0 -> 92672 bytes .../buildTools/UnityEditor.MSBuild.dll | Bin 0 -> 25600 bytes third-party-notices.txt | 2 +- 2152 files changed, 137547 insertions(+), 25379 deletions(-) create mode 100644 Editor/Mono/AssetDatabase/ImporterGlobalSettings.cs create mode 100644 Editor/Mono/AssetPipeline/AssetImportCallbackDispatch.cs create mode 100644 Editor/Mono/BuildProfile/BuildProfileEntitlementClaimInfo.cs create mode 100644 Editor/Mono/BuildProfile/IPackageServiceInfoProvider.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/IMarketplaceWebRequestSender.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/IServiceTokenProvider.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceApiError.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiClient.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiModels.cs create mode 100644 Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceJson.cs create mode 100644 Editor/Mono/BuildProfile/ReferencedComponent.cs create mode 100644 Editor/Mono/SavedEditorGUIState.cs create mode 100644 Editor/Mono/Scripting/CLILeakDetectionSwapper.cs delete mode 100644 Modules/AcceleratorClient/IsExternalInit.cs delete mode 100644 Modules/AcceleratorClient/Managed/AcceleratorClientLoadToken.cs create mode 100644 Modules/AcceleratorClient/Managed/AcceleratorClientNativeCacheOp.bindings.cs delete mode 100644 Modules/AcceleratorClient/Managed/Contracts/CacheError.cs delete mode 100644 Modules/AcceleratorClient/Managed/Contracts/CacheValues.cs delete mode 100644 Modules/AcceleratorClient/Managed/Contracts/ConnectError.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/AcceleratorV2ClientOptions.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/BatchGetRaw.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/BufferPoolConfig.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/ContentKeyStub.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/DefaultKeyValueHandlerFactory.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/DictionaryPool.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/ExceptionTranslator.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/IKeyValueHandlerFactory.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/KeyValueClient.cs delete mode 100644 Modules/AcceleratorClient/Managed/LowLevel/SyncClientTestApi.cs delete mode 100644 Modules/AcceleratorClient/Managed/Models/Result.cs delete mode 100644 Modules/AcceleratorClient/Managed/Telemetry/ITelemetrySink.cs delete mode 100644 Modules/AcceleratorClient/Managed/Telemetry/NullSink.cs delete mode 100644 Modules/AcceleratorClient/Managed/Telemetry/TelemetryEnums.cs delete mode 100644 Modules/AcceleratorClient/Managed/Telemetry/TelemetryEvent.cs create mode 100644 Modules/AdaptivePerformance/IEnergyUsageControl.cs create mode 100644 Modules/Audio/Public/ScriptableProcessors/ScriptBindings/ScriptableEffect.bindings.cs create mode 100644 Modules/BuildAnalysis/Data/Models/DependencyGraph.cs create mode 100644 Modules/BuildAnalysis/Data/Models/IAssetReferenceProvider.cs create mode 100644 Modules/BuildAnalysis/Services/DependencyGraphBuilder.cs create mode 100644 Modules/BuildAnalysis/Services/DependencyGraphService.cs create mode 100644 Modules/BuildAnalysis/Services/DependencyGraphStore.cs create mode 100644 Modules/BuildAnalysis/UI/External/ExternalBuildDrawer.cs create mode 100644 Modules/BuildAnalysis/UI/External/ExternalBuildDrawers.cs create mode 100644 Modules/BuildAnalysis/UI/External/ExternalDrawerView.cs create mode 100644 Modules/BuildAnalysis/UI/External/ExternalViewRouter.cs create mode 100644 Modules/BuildAnalysis/UI/Tabs/Assets/ReferenceSection.cs create mode 100644 Modules/BuildProfileEditor/Elements/LinkedTextLabel.cs create mode 100644 Modules/BuildProfileEditor/Elements/Settings/ReferenceComponentSettingsProvider.cs create mode 100644 Modules/BuildReportingEditor/Managed/ExternalBuildInfo.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitCommonEditor/GraphVisualization/ConditionReference.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitCommonEditor/GraphVisualization/DebugStyles.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitCommonEditor/GraphVisualization/StateReference.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitCommonEditor/GraphVisualization/TransitionReference.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitCommonEditor/IStateOption.cs rename Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/{NodeAccentManager.cs => AccentManager.cs} (57%) rename Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/{NodeAccentRequest.cs => AccentRequest.cs} (62%) create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/AccentStore.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/ConditionVisualManager.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/ConditionVisualStore.cs delete mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/NodeAccentStore.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/TransitionVisualData.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/TransitionVisualManager.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/GraphVisualization/TransitionVisualStore.cs delete mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/Model/BasicModel/PolymorphicPortHandler.cs delete mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/Model/Interfaces/IPolymorphicPortHandler.cs rename Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/GraphView/ModelView/{Transition.cs => TransitionView.cs} (78%) create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/GraphView/ModelViewParts/Node/StateColorLinePart.cs delete mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/GraphView/ModelViewParts/ProgressBarPart.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/GraphView/UIElements/GradientFlowAnimator.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/Interfaces/IAccentAnimatableView.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/Utils/DataTypeIconHelper.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitPublic/Node/IStateOptionBuilders.cs create mode 100644 Modules/GraphViewEditor/Windows/TemplateQueryMatcher.cs create mode 100644 Modules/HierarchyCore/Managed/IHierarchyNodeTypeHandlerViewModelState.cs create mode 100644 Modules/HierarchyEditor/Managed/HierarchyStageStack.cs create mode 100644 Modules/Insights/ManagedCapture/EventCorrelation.cs create mode 100644 Modules/Insights/ManagedCapture/EventJsonWriter.cs create mode 100644 Modules/Insights/ManagedCapture/ManagedCaptureHookEngine.Breadcrumbs.cs create mode 100644 Modules/Insights/ManagedCapture/ManagedCaptureHookEngine.Emit.cs create mode 100644 Modules/Insights/ManagedCapture/ManagedCaptureHookEngine.cs create mode 100644 Modules/Insights/ManagedCapture/ManagedCaptureHooks.cs create mode 100644 Modules/InsightsEditor/InsightsRequirementsResolver.cs create mode 100644 Modules/InsightsEditor/ManagedCaptureDefaultConfig.cs create mode 100644 Modules/InsightsEditor/ManagedCaptureOtaConfig.cs create mode 100644 Modules/InsightsEditor/ManagedCaptureStripping.cs create mode 100644 Modules/InsightsEditor/RequiresInsightsAttribute.cs rename Modules/{AcceleratorClient/Managed/Contracts/CacheNamespace.cs => JobsProfilerEditor/AssemblyInfo.cs} (53%) create mode 100644 Modules/JobsProfilerEditor/CacheFrameData.cs create mode 100644 Modules/JobsProfilerEditor/Filter.cs create mode 100644 Modules/JobsProfilerEditor/JobFlow.cs create mode 100644 Modules/JobsProfilerEditor/JobsInfoPanel.cs create mode 100644 Modules/JobsProfilerEditor/JobsProfiler.cs create mode 100644 Modules/JobsProfilerEditor/JobsProfilerColors.cs create mode 100644 Modules/JobsProfilerEditor/JobsProfilerResources.cs create mode 100644 Modules/JobsProfilerEditor/JobsProfilerSettings.cs create mode 100644 Modules/JobsProfilerEditor/PrimitiveRenderer.cs create mode 100644 Modules/JobsProfilerEditor/SettingsMenu.cs create mode 100644 Modules/JobsProfilerEditor/Stats.cs create mode 100644 Modules/JobsProfilerEditor/TextRenderer.cs create mode 100644 Modules/JobsProfilerEditor/ThreadLabels.cs create mode 100644 Modules/JobsProfilerEditor/TickHandler.cs create mode 100644 Modules/JobsProfilerEditor/Timeline.cs create mode 100644 Modules/JobsProfilerEditor/ZoomableArea.cs create mode 100644 Modules/LocalizationEditor/L10nContentCache.cs create mode 100644 Modules/LocalizationRuntime/Managed/Components/LocalizeAudioClipEvent.cs create mode 100644 Modules/LocalizationRuntime/Managed/Components/LocalizeGameObjectEvent.cs create mode 100644 Modules/LocalizationRuntime/Managed/Components/LocalizeSpriteEvent.cs create mode 100644 Modules/LocalizationRuntime/Managed/Components/LocalizeStringListEvent.cs create mode 100644 Modules/LocalizationRuntime/Managed/Reference/LocalizedStringList.cs create mode 100644 Modules/LocalizationRuntime/Managed/Settings/PreloadBehavior.cs create mode 100644 Modules/LocalizationRuntime/Managed/Tables/SubAssetAddress.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ExtensionUI.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/CharacterSetCollectionFormat.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/CollectionTableSelector.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/ExportCharacterSetWindow.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/FileCollectionExtensionDrawer.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/FileCollectionExtensions.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ImportExport/TableSelectionWindow.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/LocLabels.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/LocalizeComponentMenus.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/LocalizeStringListEventEditor.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/ResourceCollectionExtension.cs create mode 100644 Modules/LocalizationRuntimeEditor/Managed/TableAssetEditors.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/AllocatorManager.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/AssemblyInfo.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/AutoFreeAllocator.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/BitField.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/CollectionHelper.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/ConcurrentMask.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/DataStreamExtensions.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/DataStreamReader.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/DataStreamWriter.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/DebugView.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/DoubleRewindableAllocators.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedList.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedString.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringAppendMethods.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringFormat.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringFormatMethods.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringInternalMethods.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringMethods.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringParseMethods.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/FixedStringUtils.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/GenerateTestsForBurstCompatibilityAttribute.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/CollectionsJobReflectionRegistration.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/EarlyInitHelpers.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/IJobFilter.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/IJobParallelForBatch.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/IJobParallelForDefer.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Jobs/RegisterGenericJobTypeAttribute.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/ListExtensions.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Memory.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeArrayExtensions.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeBitArray.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeHashSet.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeList.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeNotBurstCompatible.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeParallelHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeParallelHashMapExtensions.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeParallelHashSet.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeParallelHashSetExtensions.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeParallelMultiHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeQueue.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeReference.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeRingQueue.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeSort.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeStream.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/NativeText.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/RewindableAllocator.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/StreamCompressionModel.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UIntFloat.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UTF8ArrayUnsafeUtility.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/Unicode.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeAppendBuffer.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeAtomicCounter.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeBitArray.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeHashSet.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeList.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeNotBurstCompatible.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeParallelHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeParallelHashSet.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeParallelHashSetExtensions.gen.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeParallelMultiHashMap.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeQueue.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeRingQueue.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeScratchAllocator.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeStream.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeText.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/UnsafeUtilityEx.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/xxHash3.AVX2.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/xxHash3.StreamingState.cs create mode 100644 Modules/ManagedKernel/Managed/Collections/xxHash3.cs rename {Runtime => Modules/ManagedKernel/Managed}/Export/Hashing/Hash128.bindings.cs (99%) create mode 100644 Modules/ManagedKernel/Managed/Export/Hashing/HashUtilities.cs rename {Runtime => Modules/ManagedKernel/Managed}/Export/Hashing/SpookyHash.cs (100%) create mode 100644 Modules/ManagedKernel/Managed/ManagedKernelAssertions.cs create mode 100644 Modules/MetalFX/Managed/AssemblyInfo.cs create mode 100644 Modules/MetalFX/Managed/MetalFXDevice.bindings.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/Deprecated/AnswerData.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/Deprecated/IOnboardingSection.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/Deprecated/IOnboardingSectionAnalyticsProvider.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/Deprecated/Preset.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/Deprecated/SelectedSolutionsData.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/GameGenre.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/MultiplayerCenterSettings.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/OnboardingGUIProvider.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/OnboardingSectionCategory.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Common/StyleConstants.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Analytics/AnalyticsEvent.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Analytics/GenreSelectedAnalytics.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Analytics/PackageInstalledAnalytics.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Analytics/SampleImportedAnalytics.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Analytics/WindowChangedAnalytics.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Deprecated/DeprecatedOnboardingSections.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/Deprecated/SectionsFinder.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/CategoriesDescription.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/EnumBasedDescription.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/GameGenreList.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/GenreAssociatedBuildingBlocks.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/GettingStartedSamplesList.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Models/Recommendations.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/MultiplayerCenterWindow.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/CommunityHandlesSection.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/GamePlayElements/BuildingBlockSection.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/GettingStarted/GettingStartedInstallQuickStart.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/GettingStarted/GettingStartedRecommendationPackages.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/GettingStarted/GettingStartedSampleSection.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/GettingStarted/QuickStartSamplesManager.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/Onboarding/PlaceholderSection.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/UI/StyleClasses.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/CategoriesContainer.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/ColoredMinMaxSlider.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/HyperLink.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/ImageWithPlaceholderElement.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/QuestionModeToggle.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/ReadOnlyInspectorDrawer.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/Recommendations/DelayedPackageBinding.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/Recommendations/HelpIcon.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/Recommendations/PackageIcon.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/Recommendations/PackageItem.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerCenter/Editor/MultiplayerCenterWindow/VisualElements/Recommendations/RecommendationsGrid.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/PlayModeConfig/UI/MultiplayerStatusView/ScenarioControllerStatusElement.cs rename Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/GraphsFoundation/{Instance.cs => ControllerRuntime.cs} (88%) create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerRoles/MultiplayerScenePostprocessor.cs delete mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerRoles/PublicAPI/MultiplayerRolesScenePostprocessor.cs create mode 100644 Modules/NetworkProfilerEditor/Profiler/WebRequestProfilerCaptureLog.cs delete mode 100644 Modules/PackageManagerUI/Editor/Services/AssetStore/AssetStoreOAuth.cs delete mode 100644 Modules/PackageManagerUI/Editor/Services/Pages/PaginatedVisualStateList.cs delete mode 100644 Modules/PackageManagerUI/Editor/Services/Proxies/UnityOAuthProxy.cs rename Modules/PackageManagerUI/Editor/UI/{ActiveTrustWindow/ActiveTrustWindow.cs => TrustWindow/TrustWindow.cs} (68%) rename Modules/PackageManagerUI/Editor/UI/{ActiveTrustWindow/ActiveTrustReturnValue.cs => TrustWindow/TrustWindowReturnValue.cs} (75%) rename Modules/PackageManagerUI/Editor/UI/{ActiveTrustWindow => TrustWindow}/TrustWindowSection.cs (96%) create mode 100644 Modules/PhysicsCore2DEditor/Profiler/PhysicsCore2DFrameData.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/PhysicsCore2DProfilerMarkers.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/PhysicsCore2DProfilerModule.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/PhysicsCore2DProfilerViewController.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/UI/PhysicsCore2DModuleView/PhysicsCore2DModuleView.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/UI/PhysicsCore2DModuleView/PhysicsWorldTreeData.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/UI/PhysicsCore2DProfilerView/PhysicsCore2DProfilerView.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/UI/PhysicsCore2DStatisticView/PhysicsCore2DStatisticView.cs create mode 100644 Modules/PhysicsCore2DEditor/Profiler/UI/PhysicsModuleData.cs create mode 100644 Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/IProfilerViewOptionsMenuContributor.cs create mode 100644 Modules/ProfilerEditor/ProfilerWindow/ProfilerModules/JobsProfilerViewProvider.cs create mode 100644 Modules/ProjectAuditorEditor/API/IRenderPipelineAssetCreator.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/AssetsModuleResourcesAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/AudioClipAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/MaterialAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/MeshAnalyzer.cs create mode 100644 Modules/ProjectAuditorEditor/Modules/MigrationToURPUtilities.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/PackagesAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/SpriteAtlasAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/TextureAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/Modules/TextureUtilizationAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/BuiltinRenderPipelineAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/EditorSettingsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/EntitiesGraphicsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/FogStrippingAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/GraphicsApiAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/HdrpAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/Physics2DAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/PhysicsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/PlayerSettingsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/QualitySettingsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/RenderPipelineUtils.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/SrpAssetSettingsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/StreamingAssetsFolderAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/StrippingAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/TargetArchitectureAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/SettingsAnalysis/TimeSettingsAnalyzer.cs delete mode 100644 Modules/ProjectAuditorEditor/UI/CodeDomainReloadView.cs create mode 100644 Modules/ProjectAuditorEditor/UI/MigrationWizardRunner.cs create mode 100644 Modules/ProjectAuditorEditor/UI/MigrationWorkflowView.cs delete mode 100644 Modules/ProjectAuditorEditor/Utils/PlayerSettingsUtil.cs create mode 100644 Modules/QuickSearch/Editor/Providers/MainToolbarElementProvider.cs create mode 100644 Modules/QuickSearch/Editor/Providers/ToolbarFavoritesProvider.cs delete mode 100644 Modules/QuickSearch/Editor/UI/MainToolbarMenuItemPicker.cs create mode 100644 Modules/QuickSearch/Editor/UI/MainToolbarPicker.cs create mode 100644 Modules/Scripting/Attributes/CreatePropertyAttribute.cs rename Runtime/Export/Scripting/APIUpdating/UpdatedFromAttribute.cs => Modules/Scripting/Attributes/MovedFromAttribute.cs (93%) create mode 100644 Modules/Scripting/Attributes/SerializeFieldAttribute.cs rename {Runtime/Export => Modules/Scripting}/Scripting/RuntimeInitializeOnLoadAttribute.cs (100%) create mode 100644 Modules/ShaderApiReflectionEditor/Public/Managed/IHasFunctionSignature.cs rename Modules/ShaderApiReflectionEditor/Public/{UI => Managed}/ShaderIncludeEditorExtensions.cs (100%) create mode 100644 Modules/ShaderLabParserEditor/AssemblyInfo.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Managed/ShaderUtil.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Managed/ShouldBePublicAttribute.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Managed/VirtualFunctionDeclaration.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/PartialStruct.bindings.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/ShaderInterfaceReflection.bindings.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/ShaderScope.bindings.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/StructField.bindings.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/VirtualFunction.bindings.cs create mode 100644 Modules/ShaderLabParserEditor/Public/Reflection/VirtualFunctionOverride.bindings.cs delete mode 100644 Modules/SmartStrings/SmartFormat/Core/Settings/ErrorAction.cs create mode 100644 Modules/TextCoreTextEngine/Managed/TextGenerator/Public/TextGenerationSettings.cs create mode 100644 Modules/TextCoreTextEngine/Managed/TextGenerator/Public/TextGenerator.cs create mode 100644 Modules/TextCoreTextEngine/Managed/TextGenerator/Public/TextMesh.cs create mode 100644 Modules/TextCoreTextEngineEditor/Managed/FontAssetMigrationProvider.cs create mode 100644 Modules/TextCoreTextEngineEditor/Managed/FontAssetMigrationWindow.cs create mode 100644 Modules/UIElements/Core/Components/ComponentTypeSet.cs create mode 100644 Modules/UIElements/Core/Components/ManagedComponentBox.cs create mode 100644 Modules/UIElements/Core/Components/ManagedComponentRegistry.cs delete mode 100644 Modules/UIElements/Core/Text/NativeTextBufferReclaimer.cs create mode 100644 Modules/UIElements/Core/Text/TextBufferStore.cs create mode 100644 Modules/UIElementsEditor/Components/VisualElementComponentVisibility.cs create mode 100644 Modules/UIElementsEditor/VisualElementSelectorUtility.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Hierarchy/Selection/Editor/Controls/DisplayStyleToggleField.cs delete mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Hierarchy/Selection/Editor/NotEditableAssetHelpBox.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Highlights/HighlightResolver.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Inspector/Controls/AttributeFieldFocusRequest.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Inspector/Controls/Drawers/ToggleButtonGroupPropertyDrawer.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Registry/UIAssetSavePrompt.Discard.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Scene/UICanvasInPlaceEditor.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Stages/UIStageNavigation.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Stages/UIViewportContextMenuUtility.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/Dictionary.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/FixedBuffer.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/LinearCollection.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/LinearCollectionShuffle.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/ReadExecutor.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/Strings.cs delete mode 100644 Runtime/Export/Serialization/ManagedCommands/WriteExecutor.cs rename Runtime/{Export/Serialization => Serialize/Managed/Core}/BufferDataStager.cs (73%) rename Runtime/{Export/Serialization/ManagedCommands/Callbacks.cs => Serialize/Managed/Core/CallbackResolution.cs} (100%) create mode 100644 Runtime/Serialize/Managed/Core/Commands.cs create mode 100644 Runtime/Serialize/Managed/Core/FuidPaths.cs create mode 100644 Runtime/Serialize/Managed/Core/Instances.cs create mode 100644 Runtime/Serialize/Managed/Core/LinearCollection.cs create mode 100644 Runtime/Serialize/Managed/Core/ReadExecutor.cs create mode 100644 Runtime/Serialize/Managed/Core/ReadUtilities.cs create mode 100644 Runtime/Serialize/Managed/Core/SharedUtilities.cs create mode 100644 Runtime/Serialize/Managed/Core/Strings.cs rename Runtime/{Export/Serialization/ManagedCommands => Serialize/Managed/Core}/WireFormat.cs (100%) create mode 100644 Runtime/Serialize/Managed/Core/WriteExecutor.cs create mode 100644 Runtime/Serialize/Managed/Core/WriteUtilities.cs rename Runtime/{Export/Serialization => Serialize/Managed/Extensions}/DictionarySerialization.cs (100%) rename Runtime/{Export/Serialization/ManagedCommands => Serialize/Managed/Extensions}/EntityIdArray.cs (94%) create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionDictionary.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionEntityId.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionFixedBuffer.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionNativeValueStruct.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionPropertyName.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionSerializeReference.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionSimpleNativeType.cs create mode 100644 Runtime/Serialize/Managed/Extensions/ExtensionUnityObject.cs create mode 100644 Runtime/Serialize/Managed/Extensions/Extensions.cs rename Runtime/{Export/Serialization/ManagedCommands => Serialize/Managed/Extensions}/UnityObjectArray.cs (94%) rename Runtime/{Export/Serialization/ManagedCommands => Serialize/Managed/Extensions}/ValueReference.cs (50%) delete mode 100644 artifacts/Stevedore/msbu-tools_2d8f/asmDefToCSProj/AsmDefToCSProjLib.dll delete mode 100644 artifacts/Stevedore/msbu-tools_2d8f/buildTools/Unity.BuildService.dll delete mode 100644 artifacts/Stevedore/msbu-tools_2d8f/buildTools/UnityEditor.MSBuild.dll create mode 100644 artifacts/Stevedore/msbu-tools_cbff/asmDefToCSProj/AsmDefToCSProjLib.dll create mode 100644 artifacts/Stevedore/msbu-tools_cbff/buildTools/Unity.BuildService.dll create mode 100644 artifacts/Stevedore/msbu-tools_cbff/buildTools/UnityEditor.MSBuild.dll diff --git a/Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/BeeBuildProgramCommon.Data.gen.csproj b/Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/BeeBuildProgramCommon.Data.gen.csproj index d1a17e8a7b..56560a60cd 100644 --- a/Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/BeeBuildProgramCommon.Data.gen.csproj +++ b/Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/BeeBuildProgramCommon.Data.gen.csproj @@ -30,6 +30,6 @@ - + diff --git a/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs b/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs index 02db58f293..34f3b14ca6 100644 --- a/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs +++ b/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs @@ -69,6 +69,8 @@ public class LinkerConfig public string[] LinkXmlFiles = new string[0]; public string[] AssembliesToProcess = new string[0]; public string EditorToLinkerData; + // Path to the ManagedCapture config file, or null when no config is supplied. + public string ManagedCaptureConfigFile; public string Runtime; public string Profile; public string Ruleset; diff --git a/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/PlayerBuildProgramLibrary.Data.gen.csproj b/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/PlayerBuildProgramLibrary.Data.gen.csproj index 598d01fe47..d21a5d5fe4 100644 --- a/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/PlayerBuildProgramLibrary.Data.gen.csproj +++ b/Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/PlayerBuildProgramLibrary.Data.gen.csproj @@ -32,6 +32,6 @@ - + diff --git a/Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/ScriptCompilationBuildProgram.Data.gen.csproj b/Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/ScriptCompilationBuildProgram.Data.gen.csproj index 058e7f39a9..df316ee847 100644 --- a/Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/ScriptCompilationBuildProgram.Data.gen.csproj +++ b/Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/ScriptCompilationBuildProgram.Data.gen.csproj @@ -31,6 +31,6 @@ - + diff --git a/Editor/Mono/2D/Common/TexturePlatformSettingsView.cs b/Editor/Mono/2D/Common/TexturePlatformSettingsView.cs index b727a7fa50..da81d0b21b 100644 --- a/Editor/Mono/2D/Common/TexturePlatformSettingsView.cs +++ b/Editor/Mono/2D/Common/TexturePlatformSettingsView.cs @@ -13,23 +13,23 @@ internal class TexturePlatformSettingsView : ITexturePlatformSettingsView { class Styles { - public readonly GUIContent textureFormatLabel = EditorGUIUtility.TrTextContent("Format"); - public readonly GUIContent maxTextureSizeLabel = EditorGUIUtility.TrTextContent("Max Texture Size", "Maximum size of the packed texture."); - public readonly GUIContent compressionLabel = EditorGUIUtility.TrTextContent("Compression", "How will this texture be compressed?"); - public readonly GUIContent useCrunchedCompressionLabel = EditorGUIUtility.TrTextContent("Use Crunch Compression", "Texture is crunch-compressed to save space on disk when applicable."); - public readonly GUIContent useAlphaSplitLabel = EditorGUIUtility.TrTextContent("Split Alpha Channel", "Alpha for this texture will be preserved by splitting the alpha channel to another texture, and both resulting textures will be compressed using ETC1."); - public readonly GUIContent compressionQualityLabel = EditorGUIUtility.TrTextContent("Compressor Quality"); - public readonly GUIContent compressionQualitySliderLabel = EditorGUIUtility.TrTextContent("Compressor Quality", "Use the slider to adjust compression quality from 0 (Fastest) to 100 (Best)"); + public readonly GUIContent textureFormatLabel = L10n.TextContent("Format", null, null, null); + public readonly GUIContent maxTextureSizeLabel = L10n.TextContent("Max Texture Size", "Maximum size of the packed texture.", null, null); + public readonly GUIContent compressionLabel = L10n.TextContent("Compression", "How will this texture be compressed?", null, null); + public readonly GUIContent useCrunchedCompressionLabel = L10n.TextContent("Use Crunch Compression", "Texture is crunch-compressed to save space on disk when applicable.", null, null); + public readonly GUIContent useAlphaSplitLabel = L10n.TextContent("Split Alpha Channel", "Alpha for this texture will be preserved by splitting the alpha channel to another texture, and both resulting textures will be compressed using ETC1.", null, null); + public readonly GUIContent compressionQualityLabel = L10n.TextContent("Compressor Quality", null, null, null); + public readonly GUIContent compressionQualitySliderLabel = L10n.TextContent("Compressor Quality", "Use the slider to adjust compression quality from 0 (Fastest) to 100 (Best)", null, null); public readonly int[] kMaxTextureSizeValues = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384 }; public readonly GUIContent[] kMaxTextureSizeStrings; public readonly GUIContent[] kTextureCompressionOptions = { - EditorGUIUtility.TrTextContent("None", "Texture is not compressed."), - EditorGUIUtility.TrTextContent("Low Quality", "Texture compressed with low quality but high performance, high compression format."), - EditorGUIUtility.TrTextContent("Normal Quality", "Texture is compressed with a standard format."), - EditorGUIUtility.TrTextContent("High Quality", "Texture compressed with a high quality format."), + L10n.TextContent("None", "Texture is not compressed.", null, null), + L10n.TextContent("Low Quality", "Texture compressed with low quality but high performance, high compression format.", null, null), + L10n.TextContent("Normal Quality", "Texture is compressed with a standard format.", null, null), + L10n.TextContent("High Quality", "Texture compressed with a high quality format.", null, null), }; public readonly int[] kTextureCompressionValues = @@ -42,9 +42,9 @@ class Styles public readonly GUIContent[] kMobileCompressionQualityOptions = { - EditorGUIUtility.TrTextContent("Fast"), - EditorGUIUtility.TrTextContent("Normal"), - EditorGUIUtility.TrTextContent("Best") + L10n.TextContent("Fast", null, null, null), + L10n.TextContent("Normal", null, null, null), + L10n.TextContent("Best", null, null, null) }; public Styles() diff --git a/Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs b/Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs index 296b4a72a7..f2a0385a28 100644 --- a/Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs +++ b/Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: _2D not yet converted using System.Collections.Generic; using System.IO; using Unity.Jobs; @@ -50,38 +49,38 @@ class Styles public readonly GUIStyle previewSliderThumb = "preSliderThumb"; public readonly GUIStyle previewLabel = "preLabel"; - public readonly GUIContent textureSettingLabel = EditorGUIUtility.TrTextContent("Texture"); - public readonly GUIContent variantSettingLabel = EditorGUIUtility.TrTextContent("Variant"); - public readonly GUIContent packingParametersLabel = EditorGUIUtility.TrTextContent("Packing"); - public readonly GUIContent atlasTypeLabel = EditorGUIUtility.TrTextContent("Type"); - public readonly GUIContent defaultPlatformLabel = EditorGUIUtility.TrTextContent("Default"); - public readonly GUIContent masterAtlasLabel = EditorGUIUtility.TrTextContent("Master Atlas", "Assigning another Sprite Atlas asset will make this atlas a variant of it."); - public readonly GUIContent packerLabel = EditorGUIUtility.TrTextContent("Scriptable Packer", "Scriptable Object that implements custom packing for Sprite-Atlas."); - public readonly GUIContent bindAsDefaultLabel = EditorGUIUtility.TrTextContent("Include in Build", "Packed textures will be included in the build by default."); - public readonly GUIContent enableRotationLabel = EditorGUIUtility.TrTextContent("Allow Rotation", "Try rotating the sprite to fit better during packing."); - public readonly GUIContent enableTightPackingLabel = EditorGUIUtility.TrTextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing."); - public readonly GUIContent enableAlphaDilationLabel = EditorGUIUtility.TrTextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels."); - public readonly GUIContent paddingLabel = EditorGUIUtility.TrTextContent("Padding", "The amount of extra padding between packed sprites."); - - public readonly GUIContent generateMipMapLabel = EditorGUIUtility.TrTextContent("Generate Mip Maps"); - public readonly GUIContent packPreviewLabel = EditorGUIUtility.TrTextContent("Pack Preview", "Pack and preview Sprite Atlas textures when Enabled for Builds. Previews shown may not be upto-date."); - public readonly GUIContent sRGBLabel = EditorGUIUtility.TrTextContent("sRGB", "Texture content is stored in gamma space."); - public readonly GUIContent readWrite = EditorGUIUtility.TrTextContent("Read/Write", "Enable to be able to access the raw pixel data from code."); - public readonly GUIContent variantMultiplierLabel = EditorGUIUtility.TrTextContent("Scale", "Down scale ratio."); - public readonly GUIContent copyMasterButton = EditorGUIUtility.TrTextContent("Copy Master's Settings", "Copy all master's settings into this variant."); + public readonly GUIContent textureSettingLabel = L10n.TextContent("Texture", null, null, null); + public readonly GUIContent variantSettingLabel = L10n.TextContent("Variant", null, null, null); + public readonly GUIContent packingParametersLabel = L10n.TextContent("Packing", null, null, null); + public readonly GUIContent atlasTypeLabel = L10n.TextContent("Type", null, null, null); + public readonly GUIContent defaultPlatformLabel = L10n.TextContent("Default", null, null, null); + public readonly GUIContent masterAtlasLabel = L10n.TextContent("Master Atlas", "Assigning another Sprite Atlas asset will make this atlas a variant of it.", null, null); + public readonly GUIContent packerLabel = L10n.TextContent("Scriptable Packer", "Scriptable Object that implements custom packing for Sprite-Atlas.", null, null); + public readonly GUIContent bindAsDefaultLabel = L10n.TextContent("Include in Build", "Packed textures will be included in the build by default.", null, null); + public readonly GUIContent enableRotationLabel = L10n.TextContent("Allow Rotation", "Try rotating the sprite to fit better during packing.", null, null); + public readonly GUIContent enableTightPackingLabel = L10n.TextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing.", null, null); + public readonly GUIContent enableAlphaDilationLabel = L10n.TextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels.", null, null); + public readonly GUIContent paddingLabel = L10n.TextContent("Padding", "The amount of extra padding between packed sprites.", null, null); + + public readonly GUIContent generateMipMapLabel = L10n.TextContent("Generate Mip Maps", null, null, null); + public readonly GUIContent packPreviewLabel = L10n.TextContent("Pack Preview", "Pack and preview Sprite Atlas textures when Enabled for Builds. Previews shown may not be upto-date.", null, null); + public readonly GUIContent sRGBLabel = L10n.TextContent("sRGB", "Texture content is stored in gamma space.", null, null); + public readonly GUIContent readWrite = L10n.TextContent("Read/Write", "Enable to be able to access the raw pixel data from code.", null, null); + public readonly GUIContent variantMultiplierLabel = L10n.TextContent("Scale", "Down scale ratio.", null, null); + public readonly GUIContent copyMasterButton = L10n.TextContent("Copy Master's Settings", "Copy all master's settings into this variant.", null, null); public readonly GUIContent disabledPackLabel = EditorGUIUtility.TrTextContent("Sprite Atlas packing is disabled. Enable it in Edit > Project Settings > Editor.", null, EditorGUIUtility.GetHelpIcon(MessageType.Info)); - public readonly GUIContent packableListLabel = EditorGUIUtility.TrTextContent("Objects for Packing", "Only accepts Folders, Sprite Sheet (Texture) and Sprite."); + public readonly GUIContent packableListLabel = L10n.TextContent("Objects for Packing", "Only accepts Folders, Sprite Sheet (Texture) and Sprite.", null, null); - public readonly GUIContent notPowerOfTwoWarning = EditorGUIUtility.TrTextContent("This scale will produce a Variant Sprite Atlas with a packed Texture that is NPOT (non - power of two). This may cause visual artifacts in certain compression/Texture formats."); - public readonly GUIContent secondaryTextureNameLabel = EditorGUIUtility.TrTextContent("Secondary Texture Name", "The name of the Secondary Texture to apply the following settings to."); - public readonly GUIContent platformSettingsDropDownLabel = EditorGUIUtility.TrTextContent("Show Platform Settings For"); + public readonly GUIContent notPowerOfTwoWarning = L10n.TextContent("This scale will produce a Variant Sprite Atlas with a packed Texture that is NPOT (non - power of two). This may cause visual artifacts in certain compression/Texture formats.", null, null, null); + public readonly GUIContent secondaryTextureNameLabel = L10n.TextContent("Secondary Texture Name", "The name of the Secondary Texture to apply the following settings to.", null, null); + public readonly GUIContent platformSettingsDropDownLabel = L10n.TextContent("Show Platform Settings For", null, null, null); public readonly GUIContent smallZoom = EditorGUIUtility.IconContent("PreTextureMipMapLow"); public readonly GUIContent largeZoom = EditorGUIUtility.IconContent("PreTextureMipMapHigh"); public readonly GUIContent alphaIcon = EditorGUIUtility.IconContent("PreTextureAlpha"); public readonly GUIContent RGBIcon = EditorGUIUtility.IconContent("PreTextureRGB"); - public readonly GUIContent trashIcon = EditorGUIUtility.TrIconContent("TreeEditor.Trash", "Delete currently selected settings."); + public readonly GUIContent trashIcon = L10n.IconContent("TreeEditor.Trash", "Delete currently selected settings.", null); public readonly int packableElementHash = "PackableElement".GetHashCode(); public readonly int packableSelectorHash = "PackableSelector".GetHashCode(); @@ -94,8 +93,8 @@ class Styles public readonly int[] atlasTypeValues = { 0, 1 }; public readonly GUIContent[] atlasTypeOptions = { - EditorGUIUtility.TrTextContent("Master"), - EditorGUIUtility.TrTextContent("Variant"), + L10n.TextContent("Master", null, null, null), + L10n.TextContent("Variant", null, null, null), }; public readonly int[] paddingValues = { 2, 4, 8 }; @@ -1080,4 +1079,3 @@ public override void OnPreviewGUI(Rect r, GUIStyle background) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs b/Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs index 3fbfbeaac7..011a356838 100644 --- a/Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs +++ b/Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: _2D not yet converted using System.Collections.Generic; using UnityEngine; using UnityEngine.Experimental.Rendering; @@ -46,36 +45,36 @@ class Styles public readonly GUIStyle previewSliderThumb = "preSliderThumb"; public readonly GUIStyle previewLabel = "preLabel"; - public readonly GUIContent textureSettingLabel = EditorGUIUtility.TrTextContent("Texture"); - public readonly GUIContent variantSettingLabel = EditorGUIUtility.TrTextContent("Variant"); - public readonly GUIContent packingParametersLabel = EditorGUIUtility.TrTextContent("Packing"); - public readonly GUIContent atlasTypeLabel = EditorGUIUtility.TrTextContent("Type"); - public readonly GUIContent defaultPlatformLabel = EditorGUIUtility.TrTextContent("Default"); - public readonly GUIContent masterAtlasLabel = EditorGUIUtility.TrTextContent("Master Atlas", "Assigning another Sprite Atlas asset will make this atlas a variant of it."); - public readonly GUIContent bindAsDefaultLabel = EditorGUIUtility.TrTextContent("Include in Build", "Packed textures will be included in the build by default."); - public readonly GUIContent enableRotationLabel = EditorGUIUtility.TrTextContent("Allow Rotation", "Try rotating the sprite to fit better during packing."); - public readonly GUIContent enableTightPackingLabel = EditorGUIUtility.TrTextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing."); - public readonly GUIContent enableAlphaDilationLabel = EditorGUIUtility.TrTextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels."); - public readonly GUIContent paddingLabel = EditorGUIUtility.TrTextContent("Padding", "The amount of extra padding between packed sprites."); - - public readonly GUIContent generateMipMapLabel = EditorGUIUtility.TrTextContent("Generate Mip Maps"); - public readonly GUIContent sRGBLabel = EditorGUIUtility.TrTextContent("sRGB", "Texture content is stored in gamma space."); - public readonly GUIContent readWrite = EditorGUIUtility.TrTextContent("Read/Write", "Enable to be able to access the raw pixel data from code."); - public readonly GUIContent variantMultiplierLabel = EditorGUIUtility.TrTextContent("Scale", "Down scale ratio."); - public readonly GUIContent packButton = EditorGUIUtility.TrTextContent("Pack Preview", "Pack this atlas."); + public readonly GUIContent textureSettingLabel = L10n.TextContent("Texture", null, null, null); + public readonly GUIContent variantSettingLabel = L10n.TextContent("Variant", null, null, null); + public readonly GUIContent packingParametersLabel = L10n.TextContent("Packing", null, null, null); + public readonly GUIContent atlasTypeLabel = L10n.TextContent("Type", null, null, null); + public readonly GUIContent defaultPlatformLabel = L10n.TextContent("Default", null, null, null); + public readonly GUIContent masterAtlasLabel = L10n.TextContent("Master Atlas", "Assigning another Sprite Atlas asset will make this atlas a variant of it.", null, null); + public readonly GUIContent bindAsDefaultLabel = L10n.TextContent("Include in Build", "Packed textures will be included in the build by default.", null, null); + public readonly GUIContent enableRotationLabel = L10n.TextContent("Allow Rotation", "Try rotating the sprite to fit better during packing.", null, null); + public readonly GUIContent enableTightPackingLabel = L10n.TextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing.", null, null); + public readonly GUIContent enableAlphaDilationLabel = L10n.TextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels.", null, null); + public readonly GUIContent paddingLabel = L10n.TextContent("Padding", "The amount of extra padding between packed sprites.", null, null); + + public readonly GUIContent generateMipMapLabel = L10n.TextContent("Generate Mip Maps", null, null, null); + public readonly GUIContent sRGBLabel = L10n.TextContent("sRGB", "Texture content is stored in gamma space.", null, null); + public readonly GUIContent readWrite = L10n.TextContent("Read/Write", "Enable to be able to access the raw pixel data from code.", null, null); + public readonly GUIContent variantMultiplierLabel = L10n.TextContent("Scale", "Down scale ratio.", null, null); + public readonly GUIContent packButton = L10n.TextContent("Pack Preview", "Pack this atlas.", null, null); public readonly GUIContent disabledPackLabel = EditorGUIUtility.TrTextContent("Sprite Atlas packing is disabled. Enable it in Edit > Project Settings > Editor.", null, EditorGUIUtility.GetHelpIcon(MessageType.Info)); - public readonly GUIContent packableListLabel = EditorGUIUtility.TrTextContent("Objects for Packing", "Only accepts Folder, Sprite Sheet (Texture) and Sprite."); + public readonly GUIContent packableListLabel = L10n.TextContent("Objects for Packing", "Only accepts Folder, Sprite Sheet (Texture) and Sprite.", null, null); - public readonly GUIContent notPowerOfTwoWarning = EditorGUIUtility.TrTextContent("This scale will produce a Variant Sprite Atlas with a packed Texture that is NPOT (non - power of two). This may cause visual artifacts in certain compression/Texture formats."); - public readonly GUIContent secondaryTextureNameLabel = EditorGUIUtility.TrTextContent("Secondary Texture Name", "The name of the Secondary Texture to apply the following settings to."); - public readonly GUIContent platformSettingsDropDownLabel = EditorGUIUtility.TrTextContent("Show Platform Settings For"); + public readonly GUIContent notPowerOfTwoWarning = L10n.TextContent("This scale will produce a Variant Sprite Atlas with a packed Texture that is NPOT (non - power of two). This may cause visual artifacts in certain compression/Texture formats.", null, null, null); + public readonly GUIContent secondaryTextureNameLabel = L10n.TextContent("Secondary Texture Name", "The name of the Secondary Texture to apply the following settings to.", null, null); + public readonly GUIContent platformSettingsDropDownLabel = L10n.TextContent("Show Platform Settings For", null, null, null); public readonly GUIContent smallZoom = EditorGUIUtility.IconContent("PreTextureMipMapLow"); public readonly GUIContent largeZoom = EditorGUIUtility.IconContent("PreTextureMipMapHigh"); public readonly GUIContent alphaIcon = EditorGUIUtility.IconContent("PreTextureAlpha"); public readonly GUIContent RGBIcon = EditorGUIUtility.IconContent("PreTextureRGB"); - public readonly GUIContent trashIcon = EditorGUIUtility.TrIconContent("TreeEditor.Trash", "Delete currently selected settings."); + public readonly GUIContent trashIcon = L10n.IconContent("TreeEditor.Trash", "Delete currently selected settings.", null); public readonly int packableElementHash = "PackableElement".GetHashCode(); public readonly int packableSelectorHash = "PackableSelector".GetHashCode(); @@ -88,8 +87,8 @@ class Styles public readonly int[] atlasTypeValues = { 0, 1 }; public readonly GUIContent[] atlasTypeOptions = { - EditorGUIUtility.TrTextContent("Master"), - EditorGUIUtility.TrTextContent("Variant"), + L10n.TextContent("Master", null, null, null), + L10n.TextContent("Variant", null, null, null), }; public readonly int[] paddingValues = { 2, 4, 8 }; @@ -848,4 +847,3 @@ public override void OnPreviewGUI(Rect r, GUIStyle background) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Accessibility/UserAccessibilitySettings.cs b/Editor/Mono/Accessibility/UserAccessibilitySettings.cs index d3c4f6f28c..5067d276c4 100644 --- a/Editor/Mono/Accessibility/UserAccessibilitySettings.cs +++ b/Editor/Mono/Accessibility/UserAccessibilitySettings.cs @@ -46,6 +46,9 @@ public static ColorBlindCondition colorBlindCondition private static ColorBlindCondition s_ColorBlindCondition; [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static Action colorBlindConditionChanged; } } diff --git a/Editor/Mono/Animation/AnimationEventWrapperInspector.cs b/Editor/Mono/Animation/AnimationEventWrapperInspector.cs index 944e19023e..6919381ad3 100644 --- a/Editor/Mono/Animation/AnimationEventWrapperInspector.cs +++ b/Editor/Mono/Animation/AnimationEventWrapperInspector.cs @@ -15,9 +15,9 @@ namespace UnityEditor [CanEditMultipleObjects] internal partial class AnimationEventWrapperInspector : UnityEditor.Editor { - public static readonly GUIContent s_OverloadWarning = EditorGUIUtility.TrTextContent("Some functions were overloaded in MonoBehaviour components and may not work as intended if used with Animation Events!"); - public static readonly GUIContent s_DuplicatesWarning = EditorGUIUtility.TrTextContent("Some functions have the same name across several MonoBehaviour components and may not work as intended if used with Animation Events!"); - public static readonly GUIContent s_RequireMethod = EditorGUIUtility.TrTextContent("Require Receiver", "When enabled, an error will be emitted if there is no matching method on the GameObject."); + public static readonly GUIContent s_OverloadWarning = L10n.TextContent("Some functions were overloaded in MonoBehaviour components and may not work as intended if used with Animation Events!", null, null, null); + public static readonly GUIContent s_DuplicatesWarning = L10n.TextContent("Some functions have the same name across several MonoBehaviour components and may not work as intended if used with Animation Events!", null, null, null); + public static readonly GUIContent s_RequireMethod = L10n.TextContent("Require Receiver", "When enabled, an error will be emitted if there is no matching method on the GameObject.", null, null); const string kNotSupportedPostFix = " (Function Not Supported)"; const string kNoneSelected = "(No Function Selected)"; @@ -180,7 +180,7 @@ public static void OnEditAnimationEvents(AnimationEventWrapper[] awEvents, Anima { EditorGUI.showMixedValue = !singleFunctionName; string oldFunctionName = singleFunctionName ? firstEvent.functionName : ""; - string functionName = EditorGUILayout.TextField(EditorGUIUtility.TrTextContent("Function"), oldFunctionName).Replace(" ", ""); + string functionName = EditorGUILayout.TextField(L10n.TextContent("Function", null, null, null), oldFunctionName).Replace(" ", ""); if (functionName != oldFunctionName) { foreach (var evt in data.selectedEvents) @@ -267,7 +267,7 @@ public static void OnDisabledAnimationEvent() using (new EditorGUI.DisabledScope(true)) { - dummyEvent.functionName = EditorGUILayout.TextField(EditorGUIUtility.TrTextContent("Function"), dummyEvent.functionName); + dummyEvent.functionName = EditorGUILayout.TextField(L10n.TextContent("Function", null, null, null), dummyEvent.functionName); EditorGUI.indentLevel++; dummyEvent.m_MessageOptions = EditorGUILayout.Toggle(s_RequireMethod, dummyEvent.messageOptions == SendMessageOptions.RequireReceiver) ? 0 : 1; EditorGUI.indentLevel--; diff --git a/Editor/Mono/Animation/CurveEditor/CurveEditor.cs b/Editor/Mono/Animation/CurveEditor/CurveEditor.cs index 65b5f2d640..2c27b208d7 100644 --- a/Editor/Mono/Animation/CurveEditor/CurveEditor.cs +++ b/Editor/Mono/Animation/CurveEditor/CurveEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEngine; using UnityEngine.Bindings; using UnityEditor; @@ -2386,9 +2385,9 @@ void SelectPoints() { GenericMenu menu = new GenericMenu(); if (m_AnimationCurves[curveIndex].animationIsEditable) - menu.AddItem(EditorGUIUtility.TrTextContent("Add Key"), false, CreateKeyFromClick, Event.current.mousePosition); + menu.AddItem(L10n.TextContent("Add Key", null, null, null), false, CreateKeyFromClick, Event.current.mousePosition); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Add Key")); + menu.AddDisabledItem(L10n.TextContent("Add Key", null, null, null)); menu.ShowAsContext(); Event.current.Use(); @@ -4225,4 +4224,3 @@ public void GridGUI() } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Animation/CurveEditor/CurveEditorWindow.cs b/Editor/Mono/Animation/CurveEditor/CurveEditorWindow.cs index e5f5f0f976..d62f832007 100644 --- a/Editor/Mono/Animation/CurveEditor/CurveEditorWindow.cs +++ b/Editor/Mono/Animation/CurveEditor/CurveEditorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using System; using UnityEditor.ShortcutManagement; using UnityEngine; @@ -22,10 +21,6 @@ internal enum WrapModeFixedCurve [Serializable] internal partial class CurveEditorWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal CurveEditorWindow() {} - #pragma warning restore UAL0015 - public enum NormalizationMode { None = 0, @@ -37,6 +32,9 @@ public enum NormalizationMode const int kPresetsHeight = 50; [AutoStaticsCleanupOnCodeReload] + // Shared window cache: the accessor creates a CurveEditorWindow when this is null and OnEnable assigns + // it back, so it returns on the next access. + [IgnoreForUAL0015("Shared window cache recreated on demand and reassigned by OnEnable")] static CurveEditorWindow s_SharedCurveEditor; internal CurveEditor m_CurveEditor; @@ -159,7 +157,7 @@ void Init(CurveEditorSettings settings) m_CurveEditor.FrameSelected(frameH, frameV); - titleContent = EditorGUIUtility.TrTextContent("Curve"); + titleContent = L10n.TextContent("Curve", null, null, null); // deal with window size minSize = new Vector2(240, 240 + kPresetsHeight); @@ -633,4 +631,3 @@ static void FrameClip(ShortcutArguments args) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Animation/CurveEditor/CurveMenuManager.cs b/Editor/Mono/Animation/CurveEditor/CurveMenuManager.cs index d56c29fe14..6c6e386714 100644 --- a/Editor/Mono/Animation/CurveEditor/CurveMenuManager.cs +++ b/Editor/Mono/Animation/CurveEditor/CurveMenuManager.cs @@ -116,45 +116,45 @@ public void AddTangentMenuItems(GenericMenu menu, List keyList) } if (anyKeys) { - menu.AddItem(EditorGUIUtility.TrTextContent("Clamped Auto"), allClampedAuto, SetClampedAuto, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Auto"), allAuto, SetAuto, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Free Smooth"), allFreeSmooth, SetEditable, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Flat"), allFlat, SetFlat, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Broken"), allBroken, SetBroken, keyList); + menu.AddItem(L10n.TextContent("Clamped Auto", null, null, null), allClampedAuto, SetClampedAuto, keyList); + menu.AddItem(L10n.TextContent("Auto", null, null, null), allAuto, SetAuto, keyList); + menu.AddItem(L10n.TextContent("Free Smooth", null, null, null), allFreeSmooth, SetEditable, keyList); + menu.AddItem(L10n.TextContent("Flat", null, null, null), allFlat, SetFlat, keyList); + menu.AddItem(L10n.TextContent("Broken", null, null, null), allBroken, SetBroken, keyList); menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Free"), allLeftFree, SetLeftEditable, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear"), allLeftLinear, SetLeftLinear, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant"), allLeftConstant, SetLeftConstant, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Left Tangent/Weighted"), allLeftWeighted, ToggleLeftWeighted, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Free"), allRightFree, SetRightEditable, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear"), allRightLinear, SetRightLinear, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant"), allRightConstant, SetRightConstant, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Right Tangent/Weighted"), allRightWeighted, ToggleRightWeighted, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Free"), allRightFree && allLeftFree, SetBothEditable, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Linear"), allRightLinear && allLeftLinear, SetBothLinear, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant"), allRightConstant && allLeftConstant, SetBothConstant, keyList); - menu.AddItem(EditorGUIUtility.TrTextContent("Both Tangents/Weighted"), allRightWeighted && allLeftWeighted, ToggleBothWeighted, keyList); + menu.AddItem(L10n.TextContent("Left Tangent/Free", null, null, null), allLeftFree, SetLeftEditable, keyList); + menu.AddItem(L10n.TextContent("Left Tangent/Linear", null, null, null), allLeftLinear, SetLeftLinear, keyList); + menu.AddItem(L10n.TextContent("Left Tangent/Constant", null, null, null), allLeftConstant, SetLeftConstant, keyList); + menu.AddItem(L10n.TextContent("Left Tangent/Weighted", null, null, null), allLeftWeighted, ToggleLeftWeighted, keyList); + menu.AddItem(L10n.TextContent("Right Tangent/Free", null, null, null), allRightFree, SetRightEditable, keyList); + menu.AddItem(L10n.TextContent("Right Tangent/Linear", null, null, null), allRightLinear, SetRightLinear, keyList); + menu.AddItem(L10n.TextContent("Right Tangent/Constant", null, null, null), allRightConstant, SetRightConstant, keyList); + menu.AddItem(L10n.TextContent("Right Tangent/Weighted", null, null, null), allRightWeighted, ToggleRightWeighted, keyList); + menu.AddItem(L10n.TextContent("Both Tangents/Free", null, null, null), allRightFree && allLeftFree, SetBothEditable, keyList); + menu.AddItem(L10n.TextContent("Both Tangents/Linear", null, null, null), allRightLinear && allLeftLinear, SetBothLinear, keyList); + menu.AddItem(L10n.TextContent("Both Tangents/Constant", null, null, null), allRightConstant && allLeftConstant, SetBothConstant, keyList); + menu.AddItem(L10n.TextContent("Both Tangents/Weighted", null, null, null), allRightWeighted && allLeftWeighted, ToggleBothWeighted, keyList); } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Weighted")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Auto")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Free Smooth")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Flat")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Broken")); + menu.AddDisabledItem(L10n.TextContent("Weighted", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Auto", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Free Smooth", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Flat", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Broken", null, null, null)); menu.AddSeparator(""); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Free")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Linear")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Constant")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Left Tangent/Weighted")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Free")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Linear")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Constant")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Right Tangent/Weighted")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Free")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Linear")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Constant")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Both Tangents/Weighted")); + menu.AddDisabledItem(L10n.TextContent("Left Tangent/Free", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Left Tangent/Linear", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Left Tangent/Constant", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Left Tangent/Weighted", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Right Tangent/Free", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Right Tangent/Linear", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Right Tangent/Constant", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Right Tangent/Weighted", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Both Tangents/Free", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Both Tangents/Linear", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Both Tangents/Constant", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Both Tangents/Weighted", null, null, null)); } } diff --git a/Editor/Mono/Animation/CurveEditor/MinMaxCurveEditorWindow.cs b/Editor/Mono/Animation/CurveEditor/MinMaxCurveEditorWindow.cs index fbe211a558..51ad694550 100644 --- a/Editor/Mono/Animation/CurveEditor/MinMaxCurveEditorWindow.cs +++ b/Editor/Mono/Animation/CurveEditor/MinMaxCurveEditorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using System; using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -11,10 +10,6 @@ namespace UnityEditor { internal partial class MinMaxCurveEditorWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal MinMaxCurveEditorWindow() {} - #pragma warning restore UAL0015 - const int k_PresetsHeight = 46; const float k_WindowMinSize = 240; const float k_WindowMaxSize = 10000; @@ -277,7 +272,7 @@ public void Show(GUIView viewToUpdate, CurveEditorSettings settings) delegateView = viewToUpdate; Init(settings); ShowAuxWindow(); - titleContent = EditorGUIUtility.TrTextContent("Curve Editor"); + titleContent = L10n.TextContent("Curve Editor", null, null, null); // deal with window size minSize = new Vector2(k_WindowMinSize, k_WindowMinSize + k_PresetsHeight); @@ -424,4 +419,3 @@ void SendEvent(string eventName, bool exitGUI) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/AnimatorController.bindings.cs b/Editor/Mono/AnimatorController.bindings.cs index d676c896de..5fd33feac2 100644 --- a/Editor/Mono/AnimatorController.bindings.cs +++ b/Editor/Mono/AnimatorController.bindings.cs @@ -76,7 +76,7 @@ static public StateMachineBehaviourContext[] FindStateMachineBehaviourContext(St extern internal static StateMachineBehaviourContext[] Internal_FindStateMachineBehaviourContext(ScriptableObject behaviour); [FreeFunction("AnimatorControllerBindings::Internal_CreateNewStateMachineBehaviour")] - extern public static EntityId CreateNewStateMachineBehaviour(MonoScript script); + extern public static EntityId CreateNewStateMachineBehaviour([NotNull] MonoScript script); [Obsolete("CreateStateMachineBehaviour is deprecated. Use CreateNewStateMachineBehaviour instead.", true)] public static int CreateStateMachineBehaviour(MonoScript script) => (int)CreateNewStateMachineBehaviour(script); diff --git a/Editor/Mono/Annotation/AnnotationWindow.cs b/Editor/Mono/Annotation/AnnotationWindow.cs index 59011fd4a7..0679bffc33 100644 --- a/Editor/Mono/Annotation/AnnotationWindow.cs +++ b/Editor/Mono/Annotation/AnnotationWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using UnityEngine; using System.Collections.Generic; using UnityEditor.ShortcutManagement; @@ -66,6 +65,9 @@ private enum EnabledState float iconTextRightAlign; [AutoStaticsCleanupOnCodeReload] + // Cache of the open gizmos popup, which a code reload closes anyway; ShowAtPosition creates a + // new instance whenever this is null. + [IgnoreForUAL0015("Popup instance recreated by ShowAtPosition when the cached one is null")] static AnnotationWindow s_AnnotationWindow = null; [NoAutoStaticsCleanup] // safe: timestamp guard, intentionally persisted across reloads static long s_LastClosedTime; @@ -84,19 +86,19 @@ private enum EnabledState const int maxShowRecent = 5; readonly string textGizmoVisible = L10n.Tr("Show/Hide Gizmo", null); - GUIContent generalContent = EditorGUIUtility.TrTextContent("General"); - GUIContent iconToggleContent = EditorGUIUtility.TrTextContent("", "Show/Hide Icon"); - GUIContent iconSelectContent = EditorGUIUtility.TrTextContent("", "Select Icon"); - GUIContent icon3dGizmoContent = EditorGUIUtility.TrTextContent("3D Icons"); - GUIContent terrainDebugWarnings = EditorGUIUtility.TrTextContent("Terrain Debug Warnings"); - GUIContent showOutlineContent = EditorGUIUtility.TrTextContent("Selection Outline"); - GUIContent showWireframeContent = EditorGUIUtility.TrTextContent("Selection Wire"); - GUIContent showLODLabelContent = EditorGUIUtility.TrTextContent("LOD Labels", "Show or Hide LOD Labels for Mesh LOD and LODGroup. Disabled if MeshRenderer, SkinnedMeshRenderer or LODGroup Gizmos are are hidden"); - GUIContent fadeGizmosContent = EditorGUIUtility.TrTextContent("Fade Gizmos", "Fade out and stop rendering gizmos that are small on screen"); - GUIContent lightProbeVisualizationContent = EditorGUIUtility.TrTextContent("Light Probe Visualization"); - GUIContent displayWeightsContent = EditorGUIUtility.TrTextContent("Display Weights"); - GUIContent displayOcclusionContent = EditorGUIUtility.TrTextContent("Display Occlusion"); - GUIContent highlightInvalidCellsContent = EditorGUIUtility.TrTextContent("Highlight Invalid Cells", "Highlight the invalid cells that cannot be used for probe interpolation."); + GUIContent generalContent = L10n.TextContent("General", null, null, null); + GUIContent iconToggleContent = L10n.TextContent("", "Show/Hide Icon", null, null); + GUIContent iconSelectContent = L10n.TextContent("", "Select Icon", null, null); + GUIContent icon3dGizmoContent = L10n.TextContent("3D Icons", null, null, null); + GUIContent terrainDebugWarnings = L10n.TextContent("Terrain Debug Warnings", null, null, null); + GUIContent showOutlineContent = L10n.TextContent("Selection Outline", null, null, null); + GUIContent showWireframeContent = L10n.TextContent("Selection Wire", null, null, null); + GUIContent showLODLabelContent = L10n.TextContent("LOD Labels", "Show or Hide LOD Labels for Mesh LOD and LODGroup. Disabled if MeshRenderer, SkinnedMeshRenderer or LODGroup Gizmos are are hidden", null, null); + GUIContent fadeGizmosContent = L10n.TextContent("Fade Gizmos", "Fade out and stop rendering gizmos that are small on screen", null, null); + GUIContent lightProbeVisualizationContent = L10n.TextContent("Light Probe Visualization", null, null, null); + GUIContent displayWeightsContent = L10n.TextContent("Display Weights", null, null, null); + GUIContent displayOcclusionContent = L10n.TextContent("Display Occlusion", null, null, null); + GUIContent highlightInvalidCellsContent = L10n.TextContent("Highlight Invalid Cells", "Highlight the invalid cells that cannot be used for probe interpolation.", null, null); private bool m_IsGameView; string m_SearchFilter = string.Empty; @@ -786,4 +788,3 @@ static void ToggleLODLabels() } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Annotation/LayerVisibilityWindow.cs b/Editor/Mono/Annotation/LayerVisibilityWindow.cs index 2856874e7a..175c25b95d 100644 --- a/Editor/Mono/Annotation/LayerVisibilityWindow.cs +++ b/Editor/Mono/Annotation/LayerVisibilityWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using UnityEngine; using UnityEditorInternal; using System.Collections.Generic; @@ -25,7 +24,7 @@ private class Styles public readonly Texture2D visibleOff = EditorGUIUtility.LoadIcon("animationvisibilitytoggleoff"); public readonly Texture2D pickable = EditorGUIUtility.LoadIcon("scenepicking_pickable"); public readonly Texture2D notpickable = EditorGUIUtility.LoadIcon("scenepicking_notpickable"); - public readonly GUIContent editLayers = EditorGUIUtility.TrTextContent("Edit Layers..."); + public readonly GUIContent editLayers = L10n.TextContent("Edit Layers...", null, null, null); public Styles() { listTextStyle = new GUIStyle(EditorStyles.label); @@ -45,6 +44,9 @@ public Styles() const string k_LayerPickable = "Toggle Pickable status this Layer. Non-Pickable items cannot be selected in the Scene View."; [AutoStaticsCleanupOnCodeReload] + // ShowAtPosition recreates the popup window the next time it is opened, and OnDisable already nulls + // this slot as part of normal operation. + [IgnoreForUAL0015("Popup window slot recreated by ShowAtPosition; OnDisable already nulls it")] private static LayerVisibilityWindow s_LayerVisibilityWindow; [NoAutoStaticsCleanup] // safe: timestamp guard, intentionally persisted across reloads private static long s_LastClosedTime; @@ -318,4 +320,3 @@ static void RepaintAllSceneViews() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Annotation/SceneRenderModeWindow.cs b/Editor/Mono/Annotation/SceneRenderModeWindow.cs index 532e89e534..be4d8243c4 100644 --- a/Editor/Mono/Annotation/SceneRenderModeWindow.cs +++ b/Editor/Mono/Annotation/SceneRenderModeWindow.cs @@ -89,7 +89,7 @@ static class Styles private static GUIStyle menuItem; [NoAutoStaticsCleanup] // safe: lazily rebuilt GUI style cache, recreated on demand private static GUIStyle separator; - private static readonly GUIContent debuggerLabel = EditorGUIUtility.TrTextContent("Rendering Debugger..."); + private static readonly GUIContent debuggerLabel = L10n.TextContent("Rendering Debugger...", null, null, null); public static GUIStyle s_MenuItem => menuItem ?? (menuItem = "MenuItem"); public static GUIStyle s_Separator => separator ?? (separator = "sv_iconselector_sep"); diff --git a/Editor/Mono/Annotation/SceneViewCameraWindow.cs b/Editor/Mono/Annotation/SceneViewCameraWindow.cs index 2404bf9bb1..c4b371b85c 100644 --- a/Editor/Mono/Annotation/SceneViewCameraWindow.cs +++ b/Editor/Mono/Annotation/SceneViewCameraWindow.cs @@ -21,11 +21,11 @@ static class Styles public static readonly string maxTooltips = L10n.Tr($"The maximum speed of the camera in the Scene view. Valid values are between [{SceneView.CameraSettings.kAbsoluteSpeedMin + .0001f}, {SceneView.CameraSettings.kAbsoluteSpeedMax}].", null); // Menu labels - public static readonly GUIContent copyPlacementLabel = EditorGUIUtility.TrTextContent("Copy Placement"); - public static readonly GUIContent pastePlacementLabel = EditorGUIUtility.TrTextContent("Paste Placement"); - public static readonly GUIContent copySettingsLabel = EditorGUIUtility.TrTextContent("Copy Settings"); - public static readonly GUIContent pasteSettingsLabel = EditorGUIUtility.TrTextContent("Paste Settings"); - public static readonly GUIContent resetSettingsLabel = EditorGUIUtility.TrTextContent("Reset Settings"); + public static readonly GUIContent copyPlacementLabel = L10n.TextContent("Copy Placement", null, null, null); + public static readonly GUIContent pastePlacementLabel = L10n.TextContent("Paste Placement", null, null, null); + public static readonly GUIContent copySettingsLabel = L10n.TextContent("Copy Settings", null, null, null); + public static readonly GUIContent pasteSettingsLabel = L10n.TextContent("Paste Settings", null, null, null); + public static readonly GUIContent resetSettingsLabel = L10n.TextContent("Reset Settings", null, null, null); // Layout public const int windowWidth = 290; diff --git a/Editor/Mono/AssemblyInfo/AssemblyInfo.cs b/Editor/Mono/AssemblyInfo/AssemblyInfo.cs index a63fec25a8..51d68bd44c 100644 --- a/Editor/Mono/AssemblyInfo/AssemblyInfo.cs +++ b/Editor/Mono/AssemblyInfo/AssemblyInfo.cs @@ -55,6 +55,7 @@ [assembly: InternalsVisibleTo("Unity.IntegrationTests.Profiler")] [assembly: InternalsVisibleTo("Unity.Modules.ProfilerEditor.MemorySnapshot.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.ProfilerEditor.MemorySnapshot.Tests.Playmode")] +[assembly: InternalsVisibleTo("Unity.Modules.JobsProfilerEditor.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.UnityConnectEditor.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.PS4")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.PS5")] @@ -208,6 +209,7 @@ [assembly: InternalsVisibleTo("SRPSmoke.Editor.Tests")] [assembly: InternalsVisibleTo("Unity.Testing.HDRP_EditModeTests")] [assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")] +[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.RenderPipelines.Core.Editor")] [assembly: InternalsVisibleTo("Unity.ShaderGraph.Editor")] [assembly: InternalsVisibleTo("Unity.Testing.SRP.Universal.Foundation.Editor")] @@ -263,6 +265,7 @@ [assembly: InternalsVisibleTo("Unity.Modules.BuildProfileEditor.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.BuildProfileEditor.BuildPlayerWindow.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.DeviceSimulator.Tests.Editor")] +[assembly: InternalsVisibleTo("Unity.Modules.Core.PlayerSettings.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.UI.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.Multiplayer.Server.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.Multiplayer.PlayMode.Tests.Editor")] @@ -273,6 +276,10 @@ [assembly: InternalsVisibleTo("Unity.Modules.Physics.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.GI.EditorBake.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.GI.LightProbes.Tests.Editor")] +[assembly: InternalsVisibleTo("Unity.Modules.GI.EnvironmentLighting.Tests.Editor")] +[assembly: InternalsVisibleTo("Unity.Modules.GI.LightingWindow.Tests.Editor")] +[assembly: InternalsVisibleTo("Unity.Modules.GI.LightingExplorer.Tests.Editor")] +[assembly: InternalsVisibleTo("Unity.Modules.GI.LightingSettings.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.GI.BakedGI.SubScenes.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.GI.BakedGI.SceneVisibility.Tests.Editor")] [assembly: InternalsVisibleTo("Unity.Modules.GI.UVUnwrap.Tests.Editor")] diff --git a/Editor/Mono/AssemblyReloadEvents.cs b/Editor/Mono/AssemblyReloadEvents.cs index d27222cc81..15585e2749 100644 --- a/Editor/Mono/AssemblyReloadEvents.cs +++ b/Editor/Mono/AssemblyReloadEvents.cs @@ -16,6 +16,9 @@ public static event AssemblyReloadCallback beforeAssemblyReload remove => m_BeforeAssemblyReloadEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing list for the beforeAssemblyReload event: subscribers attach through their own lifecycle + // and re-subscribe after a code reload, so the cleared list refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_BeforeAssemblyReloadEvent = new EventWithPerformanceTracker($"{nameof(AssemblyReloadEvents)}.{nameof(beforeAssemblyReload)}"); public static event AssemblyReloadCallback afterAssemblyReload @@ -24,6 +27,9 @@ public static event AssemblyReloadCallback afterAssemblyReload remove => m_AfterAssemblyReloadEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing store for the afterAssemblyReload event: subscribers attach through their own lifecycle + // and re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_AfterAssemblyReloadEvent = new EventWithPerformanceTracker($"{nameof(AssemblyReloadEvents)}.{nameof(afterAssemblyReload)}"); diff --git a/Editor/Mono/AssetDatabase/ImporterGlobalSettings.cs b/Editor/Mono/AssetDatabase/ImporterGlobalSettings.cs new file mode 100644 index 0000000000..a470584a35 --- /dev/null +++ b/Editor/Mono/AssetDatabase/ImporterGlobalSettings.cs @@ -0,0 +1,217 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Unity.Scripting.LifecycleManagement; +using UnityEditorInternal; +using UnityEngine; +using UnityEngine.Scripting; + +namespace UnityEditor +{ + /// + /// A settings singleton that asset importers read, kept in sync with asset import workers. + /// + /// + /// Unity synchronizes the values with asset import workers whenever an AssetDatabase refresh starts + /// importing assets, so an importer reads the same values whether it runs in the Editor or on a worker. + /// This includes changes that you have not saved to disk. + /// + /// Changing a value does not synchronize it on its own. Unity picks the change up the next time it starts + /// importing assets, so imports that are already running keep the values they started with. + /// + /// Add the to your class to also persist the values between + /// Editor sessions, and call Save to write them to disk. Unity synchronizes settings without this + /// attribute in the same way, but only keeps them for the current session. + /// + public class ImporterGlobalSettings : ScriptableObject where T : ScriptableObject + { + const string k_OverlayPathPrefix = $"ImporterGlobalSettings/"; + + [NoAutoStaticsCleanup] // reconstructed from a backup on reload and re-linked in the ctor; lazily recreated if null + static T s_Instance; + + /// + /// Gets the instance of the ImporterGlobalSettings Singleton. Unity creates the Singleton instance when this property is accessed for the first time. If you use the FilePathAttribute, then Unity loads the data on the first access as well. + /// + public static T instance + { + get + { + if (s_Instance == null) + CreateAndLoad(); + + return s_Instance; + } + } + + // On domain reload ScriptableObject objects gets reconstructed from a backup. We therefore set the s_Instance here + protected ImporterGlobalSettings() + { + if (s_Instance != null) + { + Debug.LogError("ImporterGlobalSettings already exists. Did you query the settings in a constructor?"); + return; + } + + object casted = this; + s_Instance = casted as T; + System.Diagnostics.Debug.Assert(s_Instance != null); + + // Registering the singleton for recording in the SourceAssetDB and synchronization on workers. + ImporterGlobalSettingsRegistry.Register(typeof(T), GetOverlayPath(), this); + } + + private static void CreateAndLoad() + { + System.Diagnostics.Debug.Assert(s_Instance == null); + + // If worker, load it from SourceAssetDB + if (AssetDatabase.IsAssetImportWorkerProcess()) + { + InternalEditorUtility.LoadSerializedFileAndForget("mem://" + GetOverlayPath()); + } + + // Either no overlay was synced yet, or this is the main editor, which owns the on-disk state. + if (s_Instance == null) + { + // If a file exists then load it and deserialize it. + // This creates an instance of T which will set s_Instance in the constructor. Then it will deserialize it and call relevant serialization callbacks. + string filePath = GetFilePath(); + if (!string.IsNullOrEmpty(filePath)) + InternalEditorUtility.LoadSerializedFileAndForget(filePath); + } + + if (s_Instance == null) + { + T t = CreateInstance(); + t.hideFlags = HideFlags.HideAndDontSave & ~HideFlags.NotEditable; + } + + System.Diagnostics.Debug.Assert(s_Instance != null); + } + + private static string GetOverlayPath() + { + return k_OverlayPathPrefix + typeof(T).FullName; + } + + /// + /// Saves the current state of the ImporterGlobalSettings. + /// Call Save to save the current state of the ImporterGlobalSettings to disk for persistence. If you call this function and your class has no FilePathAttribute, then saving has no effect. + /// Note: Don't call this method from ScriptableObject.OnValidate because the singleton can be in the process of reading its data from a file, which causes an error. + /// + /// If true then the file is saved as text, if false it is saved as binary. + protected virtual void Save(bool saveAsText) + { + if (s_Instance == null) + { + Debug.LogError("Cannot save ImporterGlobalSettings: no instance!"); + return; + } + + // Import worker are consummers only for these singletons + if (AssetDatabase.IsAssetImportWorkerProcess()) + { + Debug.LogWarning($"Saving ImporterGlobalSettings '{GetType()}' has no effect on an asset import worker process."); + return; + } + + string filePath = GetFilePath(); + if (!string.IsNullOrEmpty(filePath)) + { + string folderPath = Path.GetDirectoryName(filePath); + if (!Directory.Exists(folderPath)) + Directory.CreateDirectory(folderPath); + + InternalEditorUtility.SaveToSerializedFileAndForget(new[] { s_Instance }, filePath, saveAsText); + } + else + { + Debug.LogWarning($"Saving has no effect. Your class '{GetType()}' is missing the FilePathAttribute. Use this attribute to specify where to save your ImporterGlobalSettings.\nOnly call Save() and use this attribute if you want your state to survive between sessions of Unity."); + } + } + + /// + /// Get the file path where this ImporterGlobalSettings is saved to. + /// If you call this function and your class has no FilePathAttribute, then an empty string is returned. + /// + /// The file path where this ImporterGlobalSettings is saved to. + protected static string GetFilePath() + { + var attr = typeof(T).GetCustomAttribute(inherit: true); + return attr?.filepath ?? string.Empty; + } + } + + /// + /// The ImporterGlobalSettings instances that exist in this process, registered as they are created. + /// On the main editor the registry is what gets captured and overlaid onto the asset import workers; on a + /// worker it is used to drop the states once a new overlay has been synced. + /// + static partial class ImporterGlobalSettingsRegistry + { + [AutoStaticsCleanupOnCodeReload] + // Suppressed at the declaration rather than at the call site so that it also covers the constructor of + // every class deriving from ImporterGlobalSettings, which inherits the side effect. + [IgnoreForUAL0015("Registrations are cleared when the CodeLoaded scope exits and re-made by the ImporterGlobalSettings constructor when the instances are reconstructed")] + static readonly Dictionary s_States = + new Dictionary(); + + internal static void Register(Type stateType, string overlayPath, UnityEngine.Object instance) + { + s_States[stateType] = (overlayPath, instance); + } + + /// + /// Invoked on the main editor (from native AssetDatabase::RecordImporterGlobalSettingsOverlays) to collect the + /// live states along with the path each one is overlaid under (matching index in both arrays). + /// + [RequiredByNativeCode] + internal static UnityEngine.Object[] CaptureImporterGlobalSettings(out string[] overlayPaths) + { + Debug.Assert(!AssetDatabase.IsAssetImportWorkerProcess(), "CaptureImporterGlobalSettings should only be called in the main Editor (not on workers)"); + + var paths = new List(s_States.Count); + var instances = new List(s_States.Count); + + foreach (var state in s_States.Values) + { + if (state.instance == null) + continue; + + paths.Add(state.overlayPath); + instances.Add(state.instance); + } + + overlayPaths = paths.ToArray(); + return instances.ToArray(); + } + + /// + /// Invoked on import workers (via AssetImportWorkerClient) after they are re-prepared following a + /// change on the main editor, so that the next access reloads from the refreshed overlay. + /// + [RequiredByNativeCode] + internal static void ReloadImporterGlobalSettings() + { + Debug.Assert(AssetDatabase.IsAssetImportWorkerProcess(), "ReloadImporterGlobalSettings should only be called on an Import Worker"); + + var instances = new List(s_States.Count); + foreach (var state in s_States.Values) + instances.Add(state.instance); + + s_States.Clear(); + + foreach (var instance in instances) + { + if (instance != null) + UnityEngine.Object.DestroyImmediate(instance); + } + } + } +} diff --git a/Editor/Mono/AssetModificationProcessor.cs b/Editor/Mono/AssetModificationProcessor.cs index 949e866083..ca1a24d7c0 100644 --- a/Editor/Mono/AssetModificationProcessor.cs +++ b/Editor/Mono/AssetModificationProcessor.cs @@ -82,6 +82,9 @@ static bool CheckArgumentsAndReturnType(object[] args, MethodInfo method, System #pragma warning disable 0618 [AutoStaticsCleanupOnCodeReload] + // The AssetModificationProcessors getter rebuilds this from TypeCache whenever it is null, so the + // list cleared on reload is recollected on the next use. + [IgnoreForUAL0015("Processor type list rebuilt from TypeCache by the AssetModificationProcessors getter")] static System.Collections.Generic.IEnumerable assetModificationProcessors = null; static System.Collections.Generic.IEnumerable AssetModificationProcessors { @@ -584,6 +587,9 @@ internal static void OnStatusUpdated() } [AutoStaticsCleanupOnCodeReload] + // GetMakeEditableMethods re-reflects the MakeEditable methods whenever this is null, so the array + // cleared on reload is rebuilt on the next use. + [IgnoreForUAL0015("Reflected method array rebuilt by GetMakeEditableMethods when null")] static MethodInfo[] s_MakeEditableMethods; static MethodInfo[] GetMakeEditableMethods() diff --git a/Editor/Mono/AssetPipeline/AssetImportCallbackDispatch.cs b/Editor/Mono/AssetPipeline/AssetImportCallbackDispatch.cs new file mode 100644 index 0000000000..1a93bb1116 --- /dev/null +++ b/Editor/Mono/AssetPipeline/AssetImportCallbackDispatch.cs @@ -0,0 +1,423 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Collections.Generic; +using Unity.Scripting.LifecycleManagement; +using UnityEditor.AssetImporters; +using UnityEngine; +using UnityEngine.Scripting; + +namespace UnityEditor +{ + // Fans each import callback out to postprocessors and import blocks, and owns the per-import state both need. + // Scopes are stacked, so a nested import restores the outer one when it ends. + internal static partial class AssetImportCallbackDispatch + { + // Blocks run between the postprocessors ordered below this and those at or above it. The default + // GetPostprocessOrder() is 0, so a postprocessor opts into running after blocks by returning 1 or more. + internal const int k_PostprocessOrderThreshold = 1; + + sealed class Scope + { + public AssetImporter Importer { get; } + public AssetImportContext Context { get; } + + public Scope(AssetImporter importer, AssetImportContext context) + { + Importer = importer; + Context = context; + } + } + + [AutoStaticsCleanupOnCodeReload] + static Stack s_ScopeStack = new Stack(); + + static Scope currentScope => s_ScopeStack.Count > 0 ? s_ScopeStack.Peek() : null; + + static AssetImporter currentImporter => currentScope?.Importer; + static AssetImportContext currentContext => currentScope?.Context; + + + static void PushScope(Scope scope) + { + s_ScopeStack.Push(scope); + } + + // A code reload resets the stack, so a cleanup can arrive for a scope that was pushed before the reload. + static void PopScope() + { + if (s_ScopeStack.Count == 0) + return; + + s_ScopeStack.Pop(); + } + + [RequiredByNativeCode] + static void InitImportCallbacks(AssetImportContext context, string pathName, Type importerType, AssetImporter importer, double importStartTime) + { + PushScope(new Scope(importer, context)); + AssetPostprocessingInternal.InitPostprocessors(context, pathName, importerType, importStartTime); + } + + // For imports that run postprocessors without an importer instance, such as scene processing. + // Blocks hang off an importer's collection, so a scope without one reaches no blocks. + [RequiredByNativeCode] + static void InitImportCallbacksWithoutImporter(AssetImportContext context, string pathName, Type importerType, double importStartTime) + { + PushScope(new Scope(null, context)); + AssetPostprocessingInternal.InitPostprocessors(context, pathName, importerType, importStartTime); + } + + [RequiredByNativeCode] + static void InitImportCallbacksForTextureGenerator(string pathName) + { + PushScope(new Scope(null, null)); + AssetPostprocessingInternal.InitPostprocessorsForTextureGenerator(pathName); + } + + [RequiredByNativeCode] + static void CleanupImportCallbacks() + { + try + { + AssetPostprocessingInternal.CleanupPostprocessors(); + } + finally + { + PopScope(); + } + } + + static int RunPostprocessorRange(string methodName, object[] args, int minOrder, int maxOrder, bool analyticsEnabled, ref float duration) + { + if (!analyticsEnabled) + { + AssetPostprocessingInternal.CallPostProcessMethodsInRange(methodName, args, minOrder, maxOrder); + return 0; + } + + return AssetPostprocessingInternal.CallPostProcessMethodsInRange(methodName, args, minOrder, maxOrder, ref duration); + } + + static int RunEarlyRange(string methodName, object[] args, bool analyticsEnabled, ref float duration) + { + return RunPostprocessorRange(methodName, args, int.MinValue, k_PostprocessOrderThreshold - 1, analyticsEnabled, ref duration); + } + + static int RunLateRange(string methodName, object[] args, bool analyticsEnabled, ref float duration) + { + return RunPostprocessorRange(methodName, args, k_PostprocessOrderThreshold, int.MaxValue, analyticsEnabled, ref duration); + } + + static bool RunEarlyRangeUntilReturnedObjectIsValid(string methodName, object[] args, out T returnedObject, ref float duration) where T : class + { + return AssetPostprocessingInternal.CallPostProcessMethodsInRangeUntilReturnedObjectIsValid(methodName, args, int.MinValue, k_PostprocessOrderThreshold - 1, out returnedObject, ref duration); + } + + static bool RunLateRangeUntilReturnedObjectIsValid(string methodName, object[] args, out T returnedObject, ref float duration) where T : class + { + return AssetPostprocessingInternal.CallPostProcessMethodsInRangeUntilReturnedObjectIsValid(methodName, args, k_PostprocessOrderThreshold, int.MaxValue, out returnedObject, ref duration); + } + + static int RunAllPostprocessors(string methodName, object[] args, bool analyticsEnabled, ref float duration) + { + return RunPostprocessorRange(methodName, args, int.MinValue, int.MaxValue, analyticsEnabled, ref duration); + } + + static bool RunAllPostprocessorsUntilReturnedObjectIsValid(string methodName, object[] args, out T returnedObject, ref float duration) where T : class + { + return AssetPostprocessingInternal.CallPostProcessMethodsInRangeUntilReturnedObjectIsValid(methodName, args, int.MinValue, int.MaxValue, out returnedObject, ref duration); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessModel(string pathName) + { + object[] args = null; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessModel", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessModel", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessAnimation(string pathName) + { + object[] args = null; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessAnimation", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessAnimation", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessModel(GameObject gameObject) + { + object[] args = { gameObject }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessModel", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessModel", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessMeshHierarchy(GameObject root) + { + object[] args = { root }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessMeshHierarchy", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessMeshHierarchy", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessAnimation(GameObject root, AnimationClip clip) + { + object[] args = { root, clip }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessAnimation", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessAnimation", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessMaterial(Material material) + { + object[] args = { material }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessMaterial", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessMaterial", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessMaterialDescription(MaterialDescription description, Material material, AnimationClip[] animations) + { + object[] args = { description, material, animations }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessMaterialDescription", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessMaterialDescription", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessCameraDescription(AssetImportContext assetImportContext, CameraDescription description, Camera camera, AnimationClip[] animations) + { + assetImportContext.DependsOnCustomDependency(AssetPostprocessingInternal.kCameraPostprocessorDependencyName); + + object[] args = { description, camera, animations }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessCameraDescription", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessCameraDescription", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessLightDescription(AssetImportContext assetImportContext, LightDescription description, Light light, AnimationClip[] animations) + { + assetImportContext.DependsOnCustomDependency(AssetPostprocessingInternal.kLightPostprocessorDependencyName); + + object[] args = { description, light, animations }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessLightDescription", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessLightDescription", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static bool DispatchHasAssignMaterial() + { + if (AssetPostprocessingInternal.ProcessMeshHasAssignMaterial()) + return true; + + + return false; + } + + [RequiredByNativeCode] + internal static bool DispatchHasPostprocessGameObjectWithUserProperties() + { + if (AssetPostprocessingInternal.HasPostprocessGameObjectWithUserProperties()) + return true; + + + return false; + } + + [RequiredByNativeCode] + internal static bool DispatchHasPostprocessGameObjectWithAnimatedUserProperties() + { + if (AssetPostprocessingInternal.HasPostprocessGameObjectWithAnimatedUserProperties()) + return true; + + + return false; + } + + // The analytics count is postprocessor invocations only, so a material supplied by a block leaves it at 0. + [RequiredByNativeCode] + internal static Material DispatchAssignMaterial(Renderer renderer, Material material) + { + object[] args = { material, renderer }; // material first + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + bool foundByPostprocessor = RunAllPostprocessorsUntilReturnedObjectIsValid("OnAssignMaterialModel", args, out Material assignedMaterial, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnAssignMaterialModel", foundByPostprocessor ? 1 : 0, duration); + + return assignedMaterial; + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessGameObjectWithUserProperties(GameObject root, string[] propNames, object[] propValues) + { + object[] args = { root, propNames, propValues }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessGameObjectWithUserProperties", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessGameObjectWithUserProperties", invocationCount, duration); + } + + // One conversion and one copy-back: the same array threads through both walks and the block step between them. + [RequiredByNativeCode] + internal static void DispatchPostprocessGameObjectWithAnimatedUserProperties(GameObject root, IntPtr bindingsPtr) + { + var bindings = AnimationUtility.BindingsArrayPtrToBindingsArray(bindingsPtr); + object[] args = { root, bindings }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessGameObjectWithAnimatedUserProperties", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessGameObjectWithAnimatedUserProperties", invocationCount, duration); + + AnimationUtility.CopyBindingsArrayToBindingsArrayPtr(bindings, bindingsPtr); + } + + [RequiredByNativeCode] + internal static void DispatchPreprocessTexture(string pathName, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTexturePreprocessorDependencyName); + + object[] args = null; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPreprocessTexture", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPreprocessTexture", invocationCount, duration); + } + + // Note: The postprocess callbacks below are also called from TextureGenerator.GenerateTextureScripting, which pushes a scope with no importer. + + [RequiredByNativeCode] + internal static void DispatchPostprocessTexture(Texture2D tex, string pathName, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTexture2DPostprocessorDependencyName); + + object[] args = { tex }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessTexture", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessTexture", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessCubemap(Cubemap tex, string pathName, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTextureCubePostprocessorDependencyName); + + object[] args = { tex }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessCubemap", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessCubemap", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessTexture3D(Texture3D tex, string pathName, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTexture3DPostprocessorDependencyName); + + object[] args = { tex }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessTexture3D", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessTexture3D", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessTexture2DArray(Texture2DArray tex, string pathName, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTexture2DArrayPostprocessorDependencyName); + + object[] args = { tex }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessTexture2DArray", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessTexture2DArray", invocationCount, duration); + } + + [RequiredByNativeCode] + internal static void DispatchPostprocessSprites(Texture2D tex, string pathName, Sprite[] sprites, AssetImportContext context) + { + context?.DependsOnCustomDependency(AssetPostprocessingInternal.kTextureSpritePostprocessorDependencyName); + + object[] args = { tex, sprites }; + bool analyticsEnabled = AssetPostprocessingInternal.IsAssetPostprocessorAnalyticsEnabled(); + float duration = 0f; + + int invocationCount = RunAllPostprocessors("OnPostprocessSprites", args, analyticsEnabled, ref duration); + + if (analyticsEnabled) + AssetPostprocessingInternal.RecordPostProcessMethodCallAnalytics("OnPostprocessSprites", invocationCount, duration); + } + } +} diff --git a/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs b/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs index f289d40860..3bf54bc9dd 100644 --- a/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs +++ b/Editor/Mono/AssetPipeline/AssetImportContext.bindings.cs @@ -48,7 +48,6 @@ public class AssetImportContext public extern BuildTarget selectedBuildTarget { get; } - [NativeMethod(ThrowsException = true)] public extern void SetMainObject(Object obj); public extern Object mainObject { get; } @@ -105,7 +104,7 @@ internal void DependsOnImportedAsset(string path) DependsOnImportedAssetInternal(path); } - [NativeName("GetArtifactFilePath")] + [NativeName("GetArtifactFilePath_Binding")] private extern string GetArtifactFilePath_Internal(string path, string fileName); [Obsolete("GetArtifactFilePath has been deprecated. Use GetArtifactData to get the data instead.")] @@ -121,6 +120,7 @@ public string GetArtifactFilePath(GUID guid, string fileName) } [Obsolete("GetArtifactFilePath has been deprecated. Use GetArtifactData to get the data instead.")] + [NativeName("GetArtifactFilePath_Binding")] public extern string GetArtifactFilePath(ArtifactKey key, string fileName); [NativeName("GetArtifactData")] diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterEditor.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterEditor.cs index 7d91527359..735ea8d38b 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterEditor.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterEditor.cs @@ -15,10 +15,10 @@ internal class SpeedTree9ImporterEditor : AssetImporterTabbedEditor { private static class Styles { - public static readonly GUIContent ApplyAndGenerate = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and generate materials with new settings."); - public static readonly GUIContent Regenerate = EditorGUIUtility.TrTextContent("Regenerate Materials", "Regenerate materials from the current importer settings."); - public static readonly GUIContent RegenerateRemapped = EditorGUIUtility.TrTextContent("Regenerate Materials", "Regenerate the remapped materials from the current import settings."); - public static readonly GUIContent ApplyAndGenerateRemapped = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and regenerate the remapped materials with new settings."); + public static readonly GUIContent ApplyAndGenerate = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and generate materials with new settings.", null, null); + public static readonly GUIContent Regenerate = L10n.TextContent("Regenerate Materials", "Regenerate materials from the current importer settings.", null, null); + public static readonly GUIContent RegenerateRemapped = L10n.TextContent("Regenerate Materials", "Regenerate the remapped materials from the current import settings.", null, null); + public static readonly GUIContent ApplyAndGenerateRemapped = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and regenerate the remapped materials with new settings.", null, null); public static readonly string ModelTabName = "Model"; public static readonly string MaterialsTabName = "Materials"; diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterMaterialEditor.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterMaterialEditor.cs index 41046848a0..27526bbb1c 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterMaterialEditor.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterMaterialEditor.cs @@ -12,18 +12,18 @@ class SpeedTree9ImporterMaterialEditor : BaseSpeedTree9ImporterTabUI { private static class Styles { - public static readonly GUIContent RemapOptions = EditorGUIUtility.TrTextContent("On Demand Remap"); - public static readonly GUIContent RemapMaterialsInProject = EditorGUIUtility.TrTextContent("Search and Remap...", "Click on this button to search and remap the materials from the project."); - public static readonly GUIContent ExternalMaterialMappings = EditorGUIUtility.TrTextContent("Remapped Materials", "External materials to use for each embedded material."); + public static readonly GUIContent RemapOptions = L10n.TextContent("On Demand Remap", null, null, null); + public static readonly GUIContent RemapMaterialsInProject = L10n.TextContent("Search and Remap...", "Click on this button to search and remap the materials from the project.", null, null); + public static readonly GUIContent ExternalMaterialMappings = L10n.TextContent("Remapped Materials", "External materials to use for each embedded material.", null, null); - public static readonly GUIContent Materials = EditorGUIUtility.TrTextContent("Materials"); - public static readonly GUIContent ExtractEmbeddedMaterials = EditorGUIUtility.TrTextContent("Extract Materials...", "Click on this button to extract the embedded materials."); + public static readonly GUIContent Materials = L10n.TextContent("Materials", null, null, null); + public static readonly GUIContent ExtractEmbeddedMaterials = L10n.TextContent("Extract Materials...", "Click on this button to extract the embedded materials.", null, null); - public static readonly GUIContent InternalMaterialHelp = EditorGUIUtility.TrTextContent("Materials are embedded inside the imported asset."); - public static readonly GUIContent MaterialAssignmentsHelp = EditorGUIUtility.TrTextContent("Material assignments can be remapped below."); + public static readonly GUIContent InternalMaterialHelp = L10n.TextContent("Materials are embedded inside the imported asset.", null, null, null); + public static readonly GUIContent MaterialAssignmentsHelp = L10n.TextContent("Material assignments can be remapped below.", null, null, null); - public static readonly GUIContent ExternalMaterialSearchHelp = EditorGUIUtility.TrTextContent("Searches the user provided directory and matches the materials that share the same name and LOD with the originally imported material."); - public static readonly GUIContent SelectMaterialFolder = EditorGUIUtility.TrTextContent("Select Materials Folder"); + public static readonly GUIContent ExternalMaterialSearchHelp = L10n.TextContent("Searches the user provided directory and matches the materials that share the same name and LOD with the originally imported material.", null, null, null); + public static readonly GUIContent SelectMaterialFolder = L10n.TextContent("Select Materials Folder", null, null, null); } private SpeedTree9Importer m_STImporter; diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterModelEditor.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterModelEditor.cs index ac481ed547..56789497b8 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterModelEditor.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterModelEditor.cs @@ -641,7 +641,7 @@ private void DrawLODSettingCustomizationGUI(List lods, int lodIn else { // Toggle - GUIContent customizationLabel = EditorGUIUtility.TrTextContent(String.Format("Customize {0} options", lods[lodIndex].LODName), "To override options for a certain LOD, check this box and select the LOD from the LOD slider above"); + GUIContent customizationLabel = L10n.TextContent(String.Format("Customize {0} options", lods[lodIndex].LODName), "To override options for a certain LOD, check this box and select the LOD from the LOD slider above", null, null); EditorGUILayout.PropertyField(lodSettingOverride, customizationLabel); // Warning diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterWindEditor.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterWindEditor.cs index 9ae55d60f0..2316f9b848 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterWindEditor.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTree9ImporterWindEditor.cs @@ -12,10 +12,10 @@ class SpeedTree9ImporterWindEditor : BaseSpeedTree9ImporterTabUI { private class Styles { - public static readonly GUIContent EnableWind = EditorGUIUtility.TrTextContent("Enable Wind"); - public static readonly GUIContent StrengthResponse = EditorGUIUtility.TrTextContent("Strength Response", "The strength response of the wind."); - public static readonly GUIContent DirectionResponse = EditorGUIUtility.TrTextContent("Direction Response", "The direction response of the wind."); - public static readonly GUIContent WindRandomness = EditorGUIUtility.TrTextContent("Randomness", "Amount of world position based noise applied to each tree."); + public static readonly GUIContent EnableWind = L10n.TextContent("Enable Wind", null, null, null); + public static readonly GUIContent StrengthResponse = L10n.TextContent("Strength Response", "The strength response of the wind.", null, null); + public static readonly GUIContent DirectionResponse = L10n.TextContent("Direction Response", "The direction response of the wind.", null, null); + public static readonly GUIContent WindRandomness = L10n.TextContent("Randomness", "Amount of world position based noise applied to each tree.", null, null); } private SerializedProperty m_EnableWind; diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterCommon.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterCommon.cs index b0d1685186..239fbbe648 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterCommon.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterCommon.cs @@ -97,9 +97,9 @@ static class SpeedTreeImporterCommonEditor internal class Styles { // Meshes labels - public static readonly GUIContent MeshesHeader = EditorGUIUtility.TrTextContent("Meshes"); - public static readonly GUIContent UnitConversion = EditorGUIUtility.TrTextContent("Unit Conversion", "Select the unit conversion to apply to the imported SpeedTree asset."); - public static readonly GUIContent ScaleFactor = EditorGUIUtility.TrTextContent("Scale Factor", "How much to scale the tree model, interpreting the exported units as meters. Must be positive."); + public static readonly GUIContent MeshesHeader = L10n.TextContent("Meshes", null, null, null); + public static readonly GUIContent UnitConversion = L10n.TextContent("Unit Conversion", "Select the unit conversion to apply to the imported SpeedTree asset.", null, null); + public static readonly GUIContent ScaleFactor = L10n.TextContent("Scale Factor", "How much to scale the tree model, interpreting the exported units as meters. Must be positive.", null, null); public static readonly GUIContent[] UnitConversionNames = { new GUIContent("Leave As Is") @@ -110,21 +110,21 @@ internal class Styles }; // Materials labels - public static readonly GUIContent MaterialHeader = EditorGUIUtility.TrTextContent("Material"); - public static readonly GUIContent MainColor = EditorGUIUtility.TrTextContent("Main Color", "The color modulating the diffuse lighting component."); - public static readonly GUIContent EnableColorVariation = EditorGUIUtility.TrTextContent("Color Variation", "Color is determined by linearly interpolating between the Main Color & Color Variation values based on the world position X, Y and Z values"); - public static readonly GUIContent EnableBump = EditorGUIUtility.TrTextContent("Normal Map", "Enable normal (Bump) mapping."); - public static readonly GUIContent EnableSubsurface = EditorGUIUtility.TrTextContent("Subsurface Scattering", "Enable subsurface scattering effects."); - public static readonly GUIContent HueVariation = EditorGUIUtility.TrTextContent("Variation Color (RGB), Intensity (A)", "Tint the tree with the Variation Color"); - public static readonly GUIContent AlphaTestRef = EditorGUIUtility.TrTextContent("Alpha Cutoff", "The alpha-test reference value."); - public static readonly GUIContent TransmissionScale = EditorGUIUtility.TrTextContent("Transmission Scale", "The transmission scale value."); + public static readonly GUIContent MaterialHeader = L10n.TextContent("Material", null, null, null); + public static readonly GUIContent MainColor = L10n.TextContent("Main Color", "The color modulating the diffuse lighting component.", null, null); + public static readonly GUIContent EnableColorVariation = L10n.TextContent("Color Variation", "Color is determined by linearly interpolating between the Main Color & Color Variation values based on the world position X, Y and Z values", null, null); + public static readonly GUIContent EnableBump = L10n.TextContent("Normal Map", "Enable normal (Bump) mapping.", null, null); + public static readonly GUIContent EnableSubsurface = L10n.TextContent("Subsurface Scattering", "Enable subsurface scattering effects.", null, null); + public static readonly GUIContent HueVariation = L10n.TextContent("Variation Color (RGB), Intensity (A)", "Tint the tree with the Variation Color", null, null); + public static readonly GUIContent AlphaTestRef = L10n.TextContent("Alpha Cutoff", "The alpha-test reference value.", null, null); + public static readonly GUIContent TransmissionScale = L10n.TextContent("Transmission Scale", "The transmission scale value.", null, null); // Lighting labels - public static readonly GUIContent LightingHeader = EditorGUIUtility.TrTextContent("Lighting"); - public static readonly GUIContent CastShadows = EditorGUIUtility.TrTextContent("Cast Shadows", "The tree casts shadow"); - public static readonly GUIContent ReceiveShadows = EditorGUIUtility.TrTextContent("Receive Shadows", "The tree receives shadow"); - public static readonly GUIContent UseLightProbes = EditorGUIUtility.TrTextContent("Light Probes", "The tree uses light probe for lighting"); // TODO: update help text - public static readonly GUIContent UseReflectionProbes = EditorGUIUtility.TrTextContent("Reflection Probes", "The tree uses reflection probe for rendering"); // TODO: update help text + public static readonly GUIContent LightingHeader = L10n.TextContent("Lighting", null, null, null); + public static readonly GUIContent CastShadows = L10n.TextContent("Cast Shadows", "The tree casts shadow", null, null); + public static readonly GUIContent ReceiveShadows = L10n.TextContent("Receive Shadows", "The tree receives shadow", null, null); + public static readonly GUIContent UseLightProbes = L10n.TextContent("Light Probes", "The tree uses light probe for lighting", null, null); // TODO: update help text + public static readonly GUIContent UseReflectionProbes = L10n.TextContent("Reflection Probes", "The tree uses reflection probe for rendering", null, null); // TODO: update help text public static readonly GUIContent[] ReflectionProbeUsageNames = GetReflectionProbeUsageNames(); public static GUIContent[] GetReflectionProbeUsageNames() @@ -142,12 +142,12 @@ public static GUIContent[] GetReflectionProbeUsageNames() } // Additional Settings labels - public static readonly GUIContent AdditionalSettingsHeader = EditorGUIUtility.TrTextContent("Additional Settings"); - public static readonly GUIContent MotionVectorMode = EditorGUIUtility.TrTextContent("Motion Vectors", "Motion vector mode to set for the mesh renderer of each LOD object"); + public static readonly GUIContent AdditionalSettingsHeader = L10n.TextContent("Additional Settings", null, null, null); + public static readonly GUIContent MotionVectorMode = L10n.TextContent("Motion Vectors", "Motion vector mode to set for the mesh renderer of each LOD object", null, null); // Wind labels - public static readonly GUIContent WindHeader = EditorGUIUtility.TrTextContent("Wind"); - public static readonly GUIContent WindQuality = EditorGUIUtility.TrTextContent("Wind Quality", "Controls the wind effect's quality."); + public static readonly GUIContent WindHeader = L10n.TextContent("Wind", null, null, null); + public static readonly GUIContent WindQuality = L10n.TextContent("Wind Quality", "Controls the wind effect's quality.", null, null); public static readonly GUIContent[] MotionVectorModeNames = // Match SharedRendererDataTypes.h / enum MotionVectorGenerationMode { new GUIContent("Camera Motion Only") // kMotionVectorCamera = 0, // Use camera motion for motion vectors @@ -168,18 +168,18 @@ public static GUIContent[] GetWindQualityNames() } // LOD labels - public static readonly GUIContent LODHeader = EditorGUIUtility.TrTextContent("LOD"); - public static readonly GUIContent ResetLOD = EditorGUIUtility.TrTextContent("Reset LOD to...", "Unify the LOD settings for all selected assets"); - public static readonly GUIContent SmoothLOD = EditorGUIUtility.TrTextContent("Smooth Transitions", "Toggles smooth LOD transitions"); - public static readonly GUIContent AnimateCrossFading = EditorGUIUtility.TrTextContent("Animate Cross-fading", "Cross-fading is animated instead of being calculated by distance"); - public static readonly GUIContent CrossFadeWidth = EditorGUIUtility.TrTextContent("Crossfade Width", "Proportion of the last 3D mesh LOD region width which is used for cross-fading to billboard tree"); - public static readonly GUIContent FadeOutWidth = EditorGUIUtility.TrTextContent("Fade Out Width", "The proportion of the billboard LOD region width that is used to fade out the billboard."); - - public static readonly GUIContent EnableLodCustomizationsWarn = EditorGUIUtility.TrTextContent("Customizing LOD options may help with tuning the GPU performance but will likely negatively impact the instanced draw batching, i.e. CPU performance.\nPlease use the per-LOD customizations with careful memory and performance profiling for both CPU and GPU and remember that these options are a trade-off rather than a free win."); - public static readonly GUIContent BillboardSettingsHelp = EditorGUIUtility.TrTextContent("Billboard options are separate from the 3D model options shown above.\nChange the options below for influencing billboard rendering."); - public static readonly GUIContent MultiSelectionLODNotSupported = EditorGUIUtility.TrTextContent("Multi-selection is not supported for LOD settings."); - - public static readonly GUIContent ApplyAndGenerate = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and generate asset materials with the new settings."); + public static readonly GUIContent LODHeader = L10n.TextContent("LOD", null, null, null); + public static readonly GUIContent ResetLOD = L10n.TextContent("Reset LOD to...", "Unify the LOD settings for all selected assets", null, null); + public static readonly GUIContent SmoothLOD = L10n.TextContent("Smooth Transitions", "Toggles smooth LOD transitions", null, null); + public static readonly GUIContent AnimateCrossFading = L10n.TextContent("Animate Cross-fading", "Cross-fading is animated instead of being calculated by distance", null, null); + public static readonly GUIContent CrossFadeWidth = L10n.TextContent("Crossfade Width", "Proportion of the last 3D mesh LOD region width which is used for cross-fading to billboard tree", null, null); + public static readonly GUIContent FadeOutWidth = L10n.TextContent("Fade Out Width", "The proportion of the billboard LOD region width that is used to fade out the billboard.", null, null); + + public static readonly GUIContent EnableLodCustomizationsWarn = L10n.TextContent("Customizing LOD options may help with tuning the GPU performance but will likely negatively impact the instanced draw batching, i.e. CPU performance.\nPlease use the per-LOD customizations with careful memory and performance profiling for both CPU and GPU and remember that these options are a trade-off rather than a free win.", null, null, null); + public static readonly GUIContent BillboardSettingsHelp = L10n.TextContent("Billboard options are separate from the 3D model options shown above.\nChange the options below for influencing billboard rendering.", null, null, null); + public static readonly GUIContent MultiSelectionLODNotSupported = L10n.TextContent("Multi-selection is not supported for LOD settings.", null, null, null); + + public static readonly GUIContent ApplyAndGenerate = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and generate asset materials with the new settings.", null, null); } static internal void ShowMeshGUI( diff --git a/Editor/Mono/AssetPipeline/TextureImporter.bindings.cs b/Editor/Mono/AssetPipeline/TextureImporter.bindings.cs index e44c9e850e..65389b912f 100644 --- a/Editor/Mono/AssetPipeline/TextureImporter.bindings.cs +++ b/Editor/Mono/AssetPipeline/TextureImporter.bindings.cs @@ -20,8 +20,10 @@ namespace UnityEditor [NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporterPlatformSettingsUtils.h")] [global::UnityEngine.NativeClass("TextureImporter", PersistentTypeId = 1006)] [NativeHeader("Editor/Src/EditorUserBuildSettings.h")] + [UnityEngine.ExtensionOfNativeClass] public sealed partial class TextureImporter : AssetImporter { + [FreeFunction] internal static extern string GetTexturePlatformSerializationName(string platformName); diff --git a/Editor/Mono/AssetPostprocessor.cs b/Editor/Mono/AssetPostprocessor.cs index 2b73d3b12f..b48b291a53 100644 --- a/Editor/Mono/AssetPostprocessor.cs +++ b/Editor/Mono/AssetPostprocessor.cs @@ -10,10 +10,12 @@ using System.Linq; using System.Reflection; using UnityEditor.AssetImporters; +using UnityEditor.Build.Content; using Object = UnityEngine.Object; using UnityEditor.Profiling; using UnityEditor.Callbacks; using Unity.Scripting.LifecycleManagement; +using UnityEngine.SceneManagement; namespace UnityEditor { @@ -66,6 +68,10 @@ public PostprocessorInfo(Type assetPostprocessorType, string[] implementedMethod // The context of the import, used to specify dependencies public AssetImportContext context { get { return m_Context; } internal set { m_Context = value; } } + // GetPostprocessOrder() as read once after assetPath is assigned, so an implementation answering per asset + // answers for this one, and the answer cannot change during the import. + internal int m_PostprocessOrder; + // Logs an import warning to the console. [ExcludeFromDocs] [Obsolete("Use context.LogImportWarning(string) instead.")] @@ -176,6 +182,7 @@ public override List GetCallbacks() internal partial class AssetPostprocessingInternal { + // What is it: // Static postprocessor methods always called for each importer that are part of importer static dependency. // No new postprocessors should be added to these lists. Please reach out to #devs-import-workflow to talk about new additions. @@ -213,6 +220,11 @@ internal partial class AssetPostprocessingInternal "OnPostprocessTexture2DArray" }; + static readonly string[] k_DynamicSinglePassBuildPostprocessors = + { + "OnProcessScene", + }; + static readonly string[] k_IHVImporterPostprocessors = { "OnPostprocessTexture", @@ -263,6 +275,10 @@ internal partial class AssetPostprocessingInternal { "OnPostprocessSprites", }; + static readonly string[] k_DynamicSinglePassBuild_Scene_Postprocessors = + { + "OnProcessScene", + }; [NoAutoStaticsCleanup] // Lookup tables keyed/valued by built-in importer types and fixed dependency-name constants; contents are domain-invariant and safe to persist across reloads. static Dictionary s_PostprocessorMethodsByDependencyKey; @@ -287,6 +303,7 @@ static AssetPostprocessingInternal() s_DynamicPostprocessorMethodsByImporterType = new Dictionary(); s_DynamicPostprocessorMethodsByImporterType.Add(typeof(ModelImporter), k_DynamicModelImporterPostprocessors); s_DynamicPostprocessorMethodsByImporterType.Add(typeof(TextureImporter), k_TextureImporterPostprocessors); + s_DynamicPostprocessorMethodsByImporterType.Add(typeof(SinglePassBuildImporter), k_DynamicSinglePassBuildPostprocessors); s_PostprocessorMethodsByDependencyKey = new Dictionary(); s_PostprocessorMethodsByDependencyKey.Add(kCameraPostprocessorDependencyName, k_CameraPostprocessors); @@ -297,6 +314,7 @@ static AssetPostprocessingInternal() s_PostprocessorMethodsByDependencyKey.Add(kTexture3DPostprocessorDependencyName, k_Texture3DPostprocessors); s_PostprocessorMethodsByDependencyKey.Add(kTextureCubePostprocessorDependencyName, k_TextureCubePostprocessors); s_PostprocessorMethodsByDependencyKey.Add(kTextureSpritePostprocessorDependencyName, k_SpritePostprocessors); + s_PostprocessorMethodsByDependencyKey.Add(kSinglePassBuildSceneProcessorDependencyName, k_DynamicSinglePassBuild_Scene_Postprocessors); } [Serializable] @@ -419,6 +437,7 @@ private static string BuildHashString(SortedList list) internal const string kTexture2DArrayPostprocessorDependencyName = "postprocessor/texture2DArray"; internal const string kTextureSpritePostprocessorDependencyName = "postprocessor/textureSprite"; internal const string kTexturePreprocessorDependencyName = "postprocessor/texturePreprocessor"; + internal const string kSinglePassBuildSceneProcessorDependencyName = "postprocessor/build/scene"; [AutoStaticsCleanupOnCodeReload] static Stack> m_PostprocessStack = null; @@ -451,6 +470,8 @@ private static string BuildHashString(SortedList list) static string m_TextureSpriteDependencyName = null; [AutoStaticsCleanupOnCodeReload] static string m_TexturePreprocessorDependencyName = null; + [AutoStaticsCleanupOnCodeReload] + static string m_SinglePassBuildSceneProcessorsHashString = null; [AutoStaticsCleanupOnCodeReload] static Dictionary> s_StaticPostprocessorsPerImporterType = new Dictionary>(); @@ -469,8 +490,7 @@ static Type[] GetCachedAssetPostprocessorClasses() return m_PostprocessorClasses; } - [RequiredByNativeCode] - static void InitPostprocessorsForTextureGenerator(string pathName) + internal static void InitPostprocessorsForTextureGenerator(string pathName) { var analyticsEvent = new AssetPostProcessorAnalyticsData(); analyticsEvent.importActionId = "None"; @@ -482,6 +502,7 @@ static void InitPostprocessorsForTextureGenerator(string pathName) var assetPostprocessor = (AssetPostprocessor)Activator.CreateInstance(postprocessorInfo.Type); assetPostprocessor.assetPath = pathName; assetPostprocessor.context = null; + assetPostprocessor.m_PostprocessOrder = assetPostprocessor.GetPostprocessOrder(); m_ImportProcessors.Add(assetPostprocessor); } @@ -490,6 +511,7 @@ static void InitPostprocessorsForTextureGenerator(string pathName) var assetPostprocessor = (AssetPostprocessor)Activator.CreateInstance(postprocessorInfo.Type); assetPostprocessor.assetPath = pathName; assetPostprocessor.context = null; + assetPostprocessor.m_PostprocessOrder = assetPostprocessor.GetPostprocessOrder(); m_ImportProcessors.Add(assetPostprocessor); } @@ -499,8 +521,7 @@ static void InitPostprocessorsForTextureGenerator(string pathName) m_PostprocessStack.Push(m_ImportProcessors); } - [RequiredByNativeCode] - static void InitPostprocessors(AssetImportContext context, string pathName, Type importerType, double importStartTime) + internal static void InitPostprocessors(AssetImportContext context, string pathName, Type importerType, double importStartTime) { var analyticsEvent = new AssetPostProcessorAnalyticsData(); analyticsEvent.importActionId = ((int)Math.Floor(importStartTime * 1000)).ToString(); @@ -512,6 +533,7 @@ static void InitPostprocessors(AssetImportContext context, string pathName, Type var assetPostprocessor = (AssetPostprocessor)Activator.CreateInstance(postprocessorInfo.Type); assetPostprocessor.assetPath = pathName; assetPostprocessor.context = context; + assetPostprocessor.m_PostprocessOrder = assetPostprocessor.GetPostprocessOrder(); m_ImportProcessors.Add(assetPostprocessor); } @@ -520,6 +542,7 @@ static void InitPostprocessors(AssetImportContext context, string pathName, Type var assetPostprocessor = (AssetPostprocessor)Activator.CreateInstance(postprocessorInfo.Type); assetPostprocessor.assetPath = pathName; assetPostprocessor.context = context; + assetPostprocessor.m_PostprocessOrder = assetPostprocessor.GetPostprocessOrder(); m_ImportProcessors.Add(assetPostprocessor); } @@ -529,8 +552,7 @@ static void InitPostprocessors(AssetImportContext context, string pathName, Type m_PostprocessStack.Push(m_ImportProcessors); } - [RequiredByNativeCode] - static void CleanupPostprocessors() + internal static void CleanupPostprocessors() { if (m_PostprocessStack != null) { @@ -683,43 +705,13 @@ static void PreprocessAsset() } } - [RequiredByNativeCode] - static void PreprocessModel(string pathName) - { - CallPostProcessMethods("OnPreprocessModel", null); - } - [RequiredByNativeCode] static void PreprocessSpeedTree(string pathName) { CallPostProcessMethods("OnPreprocessSpeedTree", null); } - [RequiredByNativeCode] - static void PreprocessAnimation(string pathName) - { - CallPostProcessMethods("OnPreprocessAnimation", null); - } - - [RequiredByNativeCode] - static void PostprocessAnimation(GameObject root, AnimationClip clip) - { - object[] args = { root, clip }; - CallPostProcessMethods("OnPostprocessAnimation", args); - } - - [RequiredByNativeCode] - static Material ProcessMeshAssignMaterial(Renderer renderer, Material material) - { - object[] args = { material, renderer }; - Material assignedMaterial; - CallPostProcessMethodsUntilReturnedObjectIsValid("OnAssignMaterialModel", args, out assignedMaterial); - - return assignedMaterial; - } - - [RequiredByNativeCode] - static bool ProcessMeshHasAssignMaterial() + internal static bool ProcessMeshHasAssignMaterial() { foreach (AssetPostprocessor inst in m_ImportProcessors) { @@ -730,20 +722,6 @@ static bool ProcessMeshHasAssignMaterial() return false; } - [RequiredByNativeCode] - static void PostprocessMeshHierarchy(GameObject root) - { - object[] args = { root }; - CallPostProcessMethods("OnPostprocessMeshHierarchy", args); - } - - [RequiredByNativeCode] - static void PostprocessMesh(GameObject gameObject) - { - object[] args = { gameObject }; - CallPostProcessMethods("OnPostprocessModel", args); - } - [RequiredByNativeCode] static void PostprocessSpeedTree(GameObject gameObject) { @@ -751,54 +729,7 @@ static void PostprocessSpeedTree(GameObject gameObject) CallPostProcessMethods("OnPostprocessSpeedTree", args); } - [RequiredByNativeCode] - static void PostprocessMaterial(Material material) - { - object[] args = { material }; - CallPostProcessMethods("OnPostprocessMaterial", args); - } - - [RequiredByNativeCode] - static void PreprocessCameraDescription(AssetImportContext assetImportContext, CameraDescription description, Camera camera, AnimationClip[] animations) - { - assetImportContext.DependsOnCustomDependency(kCameraPostprocessorDependencyName); - object[] args = { description, camera, animations }; - CallPostProcessMethods("OnPreprocessCameraDescription", args); - } - - [RequiredByNativeCode] - static void PreprocessLightDescription(AssetImportContext assetImportContext, LightDescription description, Light light, AnimationClip[] animations) - { - assetImportContext.DependsOnCustomDependency(kLightPostprocessorDependencyName); - object[] args = { description, light, animations }; - CallPostProcessMethods("OnPreprocessLightDescription", args); - } - - [RequiredByNativeCode] - static void PreprocessMaterialDescription(MaterialDescription description, Material material, AnimationClip[] animations) - { - object[] args = { description, material, animations }; - CallPostProcessMethods("OnPreprocessMaterialDescription", args); - } - - [RequiredByNativeCode] - static void PostprocessGameObjectWithUserProperties(GameObject go, string[] prop_names, object[] prop_values) - { - object[] args = { go, prop_names, prop_values }; - CallPostProcessMethods("OnPostprocessGameObjectWithUserProperties", args); - } - - [RequiredByNativeCode] - static void PostprocessGameObjectWithAnimatedUserProperties(GameObject go, IntPtr bindingsPtr) - { - var bindings = AnimationUtility.BindingsArrayPtrToBindingsArray(bindingsPtr); - object[] args = { go, bindings }; - CallPostProcessMethods("OnPostprocessGameObjectWithAnimatedUserProperties", args); - AnimationUtility.CopyBindingsArrayToBindingsArrayPtr(bindings, bindingsPtr); - } - - [RequiredByNativeCode] - static bool HasPostprocessGameObjectWithUserProperties() + internal static bool HasPostprocessGameObjectWithUserProperties() { foreach (AssetPostprocessor inst in m_ImportProcessors) { @@ -809,8 +740,7 @@ static bool HasPostprocessGameObjectWithUserProperties() return false; } - [RequiredByNativeCode] - static bool HasPostprocessGameObjectWithAnimatedUserProperties() + internal static bool HasPostprocessGameObjectWithAnimatedUserProperties() { foreach (AssetPostprocessor inst in m_ImportProcessors) { @@ -822,110 +752,11 @@ static bool HasPostprocessGameObjectWithAnimatedUserProperties() } [RequiredByNativeCode] - static void PreprocessTexture(string pathName, AssetImportContext context) - { - if (context != null) - { - context.DependsOnCustomDependency(kTexturePreprocessorDependencyName); - } - - CallPostProcessMethods("OnPreprocessTexture", null); - } - - [RequiredByNativeCode] - static void PreprocessTextureFromScript(string pathName) - { - CallPostProcessMethods("OnPreprocessTexture", null); - } - - [RequiredByNativeCode] - static void PostprocessTexture(Texture2D tex, string pathName, AssetImportContext context) - { - if (context != null) - { - context.DependsOnCustomDependency(kTexture2DPostprocessorDependencyName); - } - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture", args); - } - - [RequiredByNativeCode] - static void PostprocessTextureFromScript(Texture2D tex, string pathName) - { - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture", args); - } - - [RequiredByNativeCode] - static void PostprocessCubemap(Cubemap tex, string pathName, AssetImportContext context) - { - if (context != null) - { - context.DependsOnCustomDependency(kTextureCubePostprocessorDependencyName); - } - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessCubemap", args); - } - - [RequiredByNativeCode] - static void PostprocessCubemapFromScript(Cubemap tex, string pathName) - { - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessCubemap", args); - } - - [RequiredByNativeCode] - static void PostprocessTexture3D(Texture3D tex, string pathName, AssetImportContext context) - { - if (context != null) - { - context.DependsOnCustomDependency(kTexture3DPostprocessorDependencyName); - } - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture3D", args); - } - - [RequiredByNativeCode] - static void PostprocessTexture3DFromScript(Texture3D tex, string pathName) - { - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture3D", args); - } - - [RequiredByNativeCode] - static void PostprocessTexture2DArray(Texture2DArray tex, string pathName, AssetImportContext context) - { - if (context != null) - { - context.DependsOnCustomDependency(kTexture2DArrayPostprocessorDependencyName); - } - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture2DArray", args); - } - - [RequiredByNativeCode] - static void PostprocessTexture2DArrayFromScript(Texture2DArray tex, string pathName) - { - object[] args = { tex }; - CallPostProcessMethods("OnPostprocessTexture2DArray", args); - } - - [RequiredByNativeCode] - static void PostprocessSprites(Texture2D tex, string pathName, Sprite[] sprites, AssetImportContext context) + static void SinglePassBuildProcessScene(AssetImportContext assetImportContext, Scene scene, SceneImportContext sceneContext) { - if (context != null) - { - context.DependsOnCustomDependency(kTextureSpritePostprocessorDependencyName); - } - object[] args = { tex, sprites }; - CallPostProcessMethods("OnPostprocessSprites", args); - } - - [RequiredByNativeCode] - static void PostprocessSpritesFromScript(Texture2D tex, string pathName, Sprite[] sprites) - { - object[] args = { tex, sprites }; - CallPostProcessMethods("OnPostprocessSprites", args); + assetImportContext.DependsOnCustomDependency(kSinglePassBuildSceneProcessorDependencyName); + object[] args = { scene, sceneContext }; + CallPostProcessMethods("OnProcessScene", args); } [RequiredByNativeCode] @@ -999,6 +830,7 @@ static void RefreshCustomDependencies() AssetDatabase.RegisterCustomDependency(kTexture2DArrayPostprocessorDependencyName, Hash128.Compute(GetTexture2DArrayProcessorsHashString())); AssetDatabase.RegisterCustomDependency(kTextureSpritePostprocessorDependencyName, Hash128.Compute(GetTextureSpriteProcessorsHashString())); AssetDatabase.RegisterCustomDependency(kTexturePreprocessorDependencyName, Hash128.Compute(GetTexturePreProcessorsHashString())); + AssetDatabase.RegisterCustomDependency(kSinglePassBuildSceneProcessorDependencyName, Hash128.Compute(GetSinglePassBuildSceneProcessorsHashString())); } static void GetProcessorHashString(string methodName, ref string hashString) @@ -1088,34 +920,16 @@ static string GetTextureSpriteProcessorsHashString() return m_TextureSpriteDependencyName; } - static bool IsAssetPostprocessorAnalyticsEnabled() + [RequiredByNativeCode] + static string GetSinglePassBuildSceneProcessorsHashString() { - return EditorAnalytics.enabled; + GetProcessorHashString("OnProcessScene", ref m_SinglePassBuildSceneProcessorsHashString); + return m_SinglePassBuildSceneProcessorsHashString; } - static void CallPostProcessMethodsUntilReturnedObjectIsValid(string methodName, object[] args, out T returnedObject) where T : class + internal static bool IsAssetPostprocessorAnalyticsEnabled() { - returnedObject = default(T); - int invocationCount = 0; - float startTime = Time.realtimeSinceStartup; - - foreach (AssetPostprocessor inst in m_ImportProcessors) - { - if (InvokeMethodIfAvailable(inst, methodName, args, ref returnedObject)) - { - invocationCount++; - break; - } - } - - if (IsAssetPostprocessorAnalyticsEnabled() && invocationCount > 0) - { - var methodCallAnalytics = new AssetPostProcessorMethodCallAnalyticsData(); - methodCallAnalytics.invocationCount = invocationCount; - methodCallAnalytics.methodName = methodName; - methodCallAnalytics.duration_sec = Time.realtimeSinceStartup - startTime; - s_AnalyticsEventsStack.Peek().postProcessorCalls.Add(methodCallAnalytics); - } + return EditorAnalytics.enabled; } static void CallPostProcessMethods(string methodName, object[] args) @@ -1164,6 +978,89 @@ static object InvokeMethod(MethodInfo method, object[] args) return res; } + // Runs the postprocessors whose order falls between minOrder and maxOrder, both ends included. + // Don't stop at the first one out of range: m_ImportProcessors is sorted using its own call + // to GetPostprocessOrder(), which need not match the stored order, so a postprocessor in + // range can still turn up later. + internal static void CallPostProcessMethodsInRange(string methodName, object[] args, int minOrder, int maxOrder) + { + if (m_ImportProcessors == null) + { + throw new Exception("m_ImportProcessors is null, InitPostProcessors should be called before any of the post process methods are called."); + } + + foreach (AssetPostprocessor inst in m_ImportProcessors) + { + if (inst.m_PostprocessOrder < minOrder || inst.m_PostprocessOrder > maxOrder) + continue; + + InvokeMethodIfAvailable(inst, methodName, args); + } + } + + internal static int CallPostProcessMethodsInRange(string methodName, object[] args, int minOrder, int maxOrder, ref float duration) + { + if (m_ImportProcessors == null) + { + throw new Exception("m_ImportProcessors is null, InitPostProcessors should be called before any of the post process methods are called."); + } + + int invocationCount = 0; + float startTime = Time.realtimeSinceStartup; + + foreach (AssetPostprocessor inst in m_ImportProcessors) + { + if (inst.m_PostprocessOrder < minOrder || inst.m_PostprocessOrder > maxOrder) + continue; + + if (InvokeMethodIfAvailable(inst, methodName, args)) + invocationCount++; + } + + duration += Time.realtimeSinceStartup - startTime; + return invocationCount; + } + + internal static bool CallPostProcessMethodsInRangeUntilReturnedObjectIsValid(string methodName, object[] args, int minOrder, int maxOrder, out T returnedObject, ref float duration) where T : class + { + if (m_ImportProcessors == null) + { + throw new Exception("m_ImportProcessors is null, InitPostProcessors should be called before any of the post process methods are called."); + } + + returnedObject = default(T); + bool found = false; + float startTime = Time.realtimeSinceStartup; + + foreach (AssetPostprocessor inst in m_ImportProcessors) + { + if (inst.m_PostprocessOrder < minOrder || inst.m_PostprocessOrder > maxOrder) + continue; + + if (InvokeMethodIfAvailable(inst, methodName, args, ref returnedObject)) + { + found = true; + break; + } + } + + duration += Time.realtimeSinceStartup - startTime; + return found; + } + + // Records one entry; invocationCount and duration are the totals for the callback. + internal static void RecordPostProcessMethodCallAnalytics(string methodName, int invocationCount, float duration) + { + if (invocationCount > 0) + { + var methodCallAnalytics = new AssetPostProcessorMethodCallAnalyticsData(); + methodCallAnalytics.invocationCount = invocationCount; + methodCallAnalytics.methodName = methodName; + methodCallAnalytics.duration_sec = duration; + s_AnalyticsEventsStack.Peek().postProcessorCalls.Add(methodCallAnalytics); + } + } + static bool InvokeMethodIfAvailable(object target, string methodName, object[] args) { var type = target.GetType(); diff --git a/Editor/Mono/AssetStore/AssetStoreWindow.cs b/Editor/Mono/AssetStore/AssetStoreWindow.cs index 57270ab3e9..94f781af9e 100644 --- a/Editor/Mono/AssetStore/AssetStoreWindow.cs +++ b/Editor/Mono/AssetStore/AssetStoreWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Packman not yet converted using UnityEngine; using UnityEngine.UIElements; using UnityEditor.Connect; @@ -14,10 +13,6 @@ namespace UnityEditor [EditorWindowTitle(title = "Asset Store", icon = "Asset Store")] internal class AssetStoreWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal AssetStoreWindow() {} - #pragma warning restore UAL0015 - public static AssetStoreWindow Init() { if (EditorPrefs.GetBool("AlwaysOpenAssetStoreInBrowser", false)) @@ -119,4 +114,3 @@ private void SetMinMaxSizes() private Toggle alwaysOpenInBrowserToggle { get { return rootVisualElement.Q("alwaysOpenInBrowserToggle"); } } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/AttributeHelper.cs b/Editor/Mono/AttributeHelper.cs index 2caeadf252..ed64bc2055 100644 --- a/Editor/Mono/AttributeHelper.cs +++ b/Editor/Mono/AttributeHelper.cs @@ -312,6 +312,9 @@ public IEnumerable FilterAndSortOnAttribute(Func filter, } [AutoStaticsCleanupOnCodeReload] + // Reflection memo: GetMethodsWithAttribute re-scans and re-adds an entry on every miss, so entries + // dropped on reload are recomputed from the currently loaded assemblies. + [IgnoreForUAL0015("Reflection memo, entries recomputed on demand by GetMethodsWithAttribute")] static Dictionary s_DecoratedMethodsByAttrTypeCache = new Dictionary(); private const BindingFlags kAllStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; diff --git a/Editor/Mono/Audio/Analytics/AudioRandomContainerQuitAnalyticsEvent.cs b/Editor/Mono/Audio/Analytics/AudioRandomContainerQuitAnalyticsEvent.cs index cbefb12928..27a8a63948 100644 --- a/Editor/Mono/Audio/Analytics/AudioRandomContainerQuitAnalyticsEvent.cs +++ b/Editor/Mono/Audio/Analytics/AudioRandomContainerQuitAnalyticsEvent.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using UnityEngine; using UnityEngine.Analytics; @@ -63,4 +62,3 @@ static void SendEvent() EditorAnalytics.SendAnalytic(new AudioRandomAnalytic(assetPaths.Length)); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/AudioContainerWindow.cs b/Editor/Mono/Audio/AudioContainerWindow.cs index 74c997b220..e44e74d255 100644 --- a/Editor/Mono/Audio/AudioContainerWindow.cs +++ b/Editor/Mono/Audio/AudioContainerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -22,10 +21,6 @@ namespace UnityEditor; sealed partial class AudioContainerWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public AudioContainerWindow() { } - #pragma warning restore UAL0015 - enum Icons { Play = 0, @@ -1578,4 +1573,3 @@ static void Preview(ShortcutArguments args) #endregion } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/AudioContainerWindowState.cs b/Editor/Mono/Audio/AudioContainerWindowState.cs index ac344de75e..c900df7467 100644 --- a/Editor/Mono/Audio/AudioContainerWindowState.cs +++ b/Editor/Mono/Audio/AudioContainerWindowState.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using UnityEditor.UIElements; using UnityEngine; @@ -368,4 +367,3 @@ void OnSelectionChanged() UpdateTarget(); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/AudioMixerDescription.cs b/Editor/Mono/Audio/Mixer/AudioMixerDescription.cs index 09834b0393..bc84785756 100644 --- a/Editor/Mono/Audio/Mixer/AudioMixerDescription.cs +++ b/Editor/Mono/Audio/Mixer/AudioMixerDescription.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using UnityEditor; using System; @@ -159,4 +158,3 @@ public static bool RegisterAudioMixerEffect(string name, MixerParameterDefinitio private static readonly List s_MixerEffectDefinitions = new List(); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerChannelStripView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerChannelStripView.cs index 666b71d258..abbc5d09fe 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerChannelStripView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerChannelStripView.cs @@ -335,7 +335,7 @@ class PatchSlot public float x, y; } - GUIContent bypassButtonContent = EditorGUIUtility.TrTextContent("", "Toggle bypass on this effect"); + GUIContent bypassButtonContent = L10n.TextContent("", "Toggle bypass on this effect", null, null); void EffectSlot(Rect effectRect, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, int effectIndex, ref int highlightEffectIndex, ChannelStripParams p, ref Dictionary patchslots) { if (effect == null) @@ -975,8 +975,8 @@ private void DoEffectSlotInsertEffectPopup(Rect buttonRect, AudioMixerGroupContr var effect = group.effects[effectSlotIndex]; if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsReceive() && !effect.IsDuckVolume()) { - pm.AddItem(EditorGUIUtility.TrTextContent("Allow Wet Mixing (causes higher memory usage)"), effect.enableWetMix, delegate { AudioMixerUtility.ToggleEffectWetMix(effect); }); - pm.AddItem(EditorGUIUtility.TrTextContent("Bypass"), effect.bypass, delegate { effect.bypass = !effect.bypass; m_Controller.UpdateBypass(); InspectorWindow.RepaintAllInspectors(); }); + pm.AddItem(L10n.TextContent("Allow Wet Mixing (causes higher memory usage)", null, null, null), effect.enableWetMix, delegate { AudioMixerUtility.ToggleEffectWetMix(effect); }); + pm.AddItem(L10n.TextContent("Bypass", null, null, null), effect.bypass, delegate { effect.bypass = !effect.bypass; m_Controller.UpdateBypass(); InspectorWindow.RepaintAllInspectors(); }); pm.AddSeparator(""); } @@ -995,7 +995,7 @@ private void DoEffectSlotInsertEffectPopup(Rect buttonRect, AudioMixerGroupContr if (!effect.IsAttenuation()) { pm.AddSeparator(""); - pm.AddItem(EditorGUIUtility.TrTextContent("Remove"), false, RemoveEffectPopupCallback, new EffectContext(m_Controller, groups, effectSlotIndex, "")); + pm.AddItem(L10n.TextContent("Remove", null, null, null), false, RemoveEffectPopupCallback, new EffectContext(m_Controller, groups, effectSlotIndex, "")); bool insertedSeparator = false; if (effect.IsSend()) { @@ -1008,7 +1008,7 @@ private void DoEffectSlotInsertEffectPopup(Rect buttonRect, AudioMixerGroupContr } var sendContext = new ConnectSendContext(group.controller, effect, null); - pm.AddItem(EditorGUIUtility.TrTextContent("Disconnect from '" + effect.GetSendTargetDisplayString(effectMap) + "'") , false, ConnectSendPopupCallback, sendContext); + pm.AddItem(L10n.TextContent("Disconnect from '" + effect.GetSendTargetDisplayString(effectMap) + "'", null, null, null) , false, ConnectSendPopupCallback, sendContext); } if (!insertedSeparator) @@ -1278,7 +1278,7 @@ void DoTotaldB(ChannelStripParams p) GUI.Label(rect, string.Format(CultureInfo.InvariantCulture.NumberFormat, "{0:F1} dB", vu_level), styles.totalVULevel); } - GUIContent addText = EditorGUIUtility.TrTextContent("Add..."); + GUIContent addText = L10n.TextContent("Add...", null, null, null); void DoEffectList(ChannelStripParams p, bool selected, ref int highlightEffectIndex, ref Dictionary patchslots, bool showBusConnectionsOfSelection) { Event evt = Event.current; diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerDrawUtils.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerDrawUtils.cs index b8af67f480..374fc5e63c 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerDrawUtils.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerDrawUtils.cs @@ -72,18 +72,18 @@ public class Styles public GUIStyle warningOverlay = GetStyle("WarningOverlay"); public Texture2D scrollShadowTexture = EditorGUIUtility.FindTexture("ScrollShadow"); public Texture2D leftToRightShadowTexture = EditorGUIUtility.FindTexture("LeftToRightShadow"); - public GUIContent soloGUIContent = EditorGUIUtility.TrTextContent("", "Adds this group to set of soloed groups"); - public GUIContent muteGUIContent = EditorGUIUtility.TrTextContent("", "Mutes this group"); - public GUIContent bypassGUIContent = EditorGUIUtility.TrTextContent("", "Bypasses the effects on this group"); - public GUIContent effectSlotGUIContent = EditorGUIUtility.TrTextContent("", "Drag horizontally to change wet mix levels or vertically to change order of effects. Note: Enable wet mixing in the context menu."); - public GUIContent attenuationSlotGUIContent = EditorGUIUtility.TrTextContent("", "Place the attenuation slot in the effect stack where attenuation should take effect"); - public GUIContent emptySendSlotGUIContent = EditorGUIUtility.TrTextContent("", "Connect to a Receive in the context menu or in the inspector"); - public GUIContent returnSlotGUIContent = EditorGUIUtility.TrTextContent("", "Connect a Send to this Receive"); - public GUIContent duckVolumeSlotGUIContent = EditorGUIUtility.TrTextContent("", "Connect a Send to this Duck Volume"); - public GUIContent duckingFaderGUIContent = EditorGUIUtility.TrTextContent("", "Ducking Fader"); - public GUIContent attenuationFader = EditorGUIUtility.TrTextContent("", "Attenuation fader"); - public GUIContent vuMeterGUIContent = EditorGUIUtility.TrTextContent("", "The VU meter shows the current level of the mix of all sounds and subgroups."); - public GUIContent referencedGroups = EditorGUIUtility.TrTextContent("Referenced groups", "Mixer groups that are hidden but are referenced by the visible mixer groups are shown here for convenience"); + public GUIContent soloGUIContent = L10n.TextContent("", "Adds this group to set of soloed groups", null, null); + public GUIContent muteGUIContent = L10n.TextContent("", "Mutes this group", null, null); + public GUIContent bypassGUIContent = L10n.TextContent("", "Bypasses the effects on this group", null, null); + public GUIContent effectSlotGUIContent = L10n.TextContent("", "Drag horizontally to change wet mix levels or vertically to change order of effects. Note: Enable wet mixing in the context menu.", null, null); + public GUIContent attenuationSlotGUIContent = L10n.TextContent("", "Place the attenuation slot in the effect stack where attenuation should take effect", null, null); + public GUIContent emptySendSlotGUIContent = L10n.TextContent("", "Connect to a Receive in the context menu or in the inspector", null, null); + public GUIContent returnSlotGUIContent = L10n.TextContent("", "Connect a Send to this Receive", null, null); + public GUIContent duckVolumeSlotGUIContent = L10n.TextContent("", "Connect a Send to this Duck Volume", null, null); + public GUIContent duckingFaderGUIContent = L10n.TextContent("", "Ducking Fader", null, null); + public GUIContent attenuationFader = L10n.TextContent("", "Attenuation fader", null, null); + public GUIContent vuMeterGUIContent = L10n.TextContent("", "The VU meter shows the current level of the mix of all sounds and subgroups.", null, null); + public GUIContent referencedGroups = L10n.TextContent("Referenced groups", "Mixer groups that are hidden but are referenced by the visible mixer groups are shown here for convenience", null, null); public GUIContent sendString = new GUIContent("s"); diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectGUI.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectGUI.cs index 1e2c213e7b..b4c4dcdecc 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectGUI.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectGUI.cs @@ -55,22 +55,22 @@ public static bool Slider(GUIContent label, ref float value, float displayScale, GenericMenu pm = new GenericMenu(); if (!exposed) - pm.AddItem(EditorGUIUtility.TrTextContent("Expose '" + path.ResolveStringPath(false) + "' to script"), false, ExposePopupCallback, new ExposedParamContext(controller, path)); + pm.AddItem(L10n.TextContent("Expose '" + path.ResolveStringPath(false) + "' to script", null, null, null), false, ExposePopupCallback, new ExposedParamContext(controller, path)); else - pm.AddItem(EditorGUIUtility.TrTextContent("Unexpose"), false, UnexposePopupCallback, new ExposedParamContext(controller, path)); + pm.AddItem(L10n.TextContent("Unexpose", null, null, null), false, UnexposePopupCallback, new ExposedParamContext(controller, path)); ParameterTransitionType existingType; bool overrideExists = controller.TargetSnapshot.GetTransitionTypeOverride(path.parameter, out existingType); System.Diagnostics.Debug.Assert(!overrideExists || existingType == ParameterTransitionType.Lerp); pm.AddSeparator(string.Empty); - pm.AddItem(EditorGUIUtility.TrTextContent("Linear Snapshot Transition"), existingType == ParameterTransitionType.Lerp, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Lerp)); - pm.AddItem(EditorGUIUtility.TrTextContent("Smoothstep Snapshot Transition"), existingType == ParameterTransitionType.Smoothstep, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Smoothstep)); - pm.AddItem(EditorGUIUtility.TrTextContent("Squared Snapshot Transition"), existingType == ParameterTransitionType.Squared, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Squared)); - pm.AddItem(EditorGUIUtility.TrTextContent("SquareRoot Snapshot Transition"), existingType == ParameterTransitionType.SquareRoot, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.SquareRoot)); - pm.AddItem(EditorGUIUtility.TrTextContent("BrickwallStart Snapshot Transition"), existingType == ParameterTransitionType.BrickwallStart, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallStart)); - pm.AddItem(EditorGUIUtility.TrTextContent("BrickwallEnd Snapshot Transition"), existingType == ParameterTransitionType.BrickwallEnd, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallEnd)); - pm.AddItem(EditorGUIUtility.TrTextContent("Attenuation Snapshot Transition"), existingType == ParameterTransitionType.Attenuation, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Attenuation)); + pm.AddItem(L10n.TextContent("Linear Snapshot Transition", null, null, null), existingType == ParameterTransitionType.Lerp, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Lerp)); + pm.AddItem(L10n.TextContent("Smoothstep Snapshot Transition", null, null, null), existingType == ParameterTransitionType.Smoothstep, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Smoothstep)); + pm.AddItem(L10n.TextContent("Squared Snapshot Transition", null, null, null), existingType == ParameterTransitionType.Squared, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Squared)); + pm.AddItem(L10n.TextContent("SquareRoot Snapshot Transition", null, null, null), existingType == ParameterTransitionType.SquareRoot, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.SquareRoot)); + pm.AddItem(L10n.TextContent("BrickwallStart Snapshot Transition", null, null, null), existingType == ParameterTransitionType.BrickwallStart, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallStart)); + pm.AddItem(L10n.TextContent("BrickwallEnd Snapshot Transition", null, null, null), existingType == ParameterTransitionType.BrickwallEnd, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallEnd)); + pm.AddItem(L10n.TextContent("Attenuation Snapshot Transition", null, null, null), existingType == ParameterTransitionType.Attenuation, ParameterTransitionOverrideCallback, new ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Attenuation)); pm.AddSeparator(string.Empty); pm.ShowAsContext(); diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectView.cs index 1f8aea4c2c..7be32f3b76 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerEffectView.cs @@ -28,14 +28,14 @@ class AudioMixerEffectView static class Texts { - public static readonly GUIContent editInPlaymode = EditorGUIUtility.TrTextContent("Edit in Playmode"); - public static readonly GUIContent pitch = EditorGUIUtility.TrTextContent("Pitch"); - public static readonly GUIContent addEffect = EditorGUIUtility.TrTextContent("Add Effect"); - public static readonly GUIContent volume = EditorGUIUtility.TrTextContent("Volume"); - public static readonly GUIContent sendLevel = EditorGUIUtility.TrTextContent("Send level"); - public static readonly GUIContent bus = EditorGUIUtility.TrTextContent("Receive"); - public static readonly GUIContent none = EditorGUIUtility.TrTextContent("None"); - public static readonly GUIContent wet = EditorGUIUtility.TrTextContent("Wet", "Enables/disables wet/dry ratio on this effect. Note that this makes the DSP graph more complex and requires additional CPU and memory, so use it only when necessary."); + public static readonly GUIContent editInPlaymode = L10n.TextContent("Edit in Playmode", null, null, null); + public static readonly GUIContent pitch = L10n.TextContent("Pitch", null, null, null); + public static readonly GUIContent addEffect = L10n.TextContent("Add Effect", null, null, null); + public static readonly GUIContent volume = L10n.TextContent("Volume", null, null, null); + public static readonly GUIContent sendLevel = L10n.TextContent("Send level", null, null, null); + public static readonly GUIContent bus = L10n.TextContent("Receive", null, null, null); + public static readonly GUIContent none = L10n.TextContent("None", null, null, null); + public static readonly GUIContent wet = L10n.TextContent("Wet", "Enables/disables wet/dry ratio on this effect. Note that this makes the DSP graph more complex and requires additional CPU and memory, so use it only when necessary.", null, null); public const string dB = "dB"; public const string percentage = "%"; public const string cpuFormatString = " - CPU: {0:#0.00}%"; @@ -372,8 +372,8 @@ private static void ShowEffectContextMenu(AudioMixerGroupController group, Audio { if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume()) { - menu.AddItem(EditorGUIUtility.TrTextContent("Allow Wet Mixing (causes higher memory usage)"), effect.enableWetMix, delegate { AudioMixerUtility.ToggleEffectWetMix(effect); }); - menu.AddItem(EditorGUIUtility.TrTextContent("Bypass"), effect.bypass, delegate() + menu.AddItem(L10n.TextContent("Allow Wet Mixing (causes higher memory usage)", null, null, null), effect.enableWetMix, delegate { AudioMixerUtility.ToggleEffectWetMix(effect); }); + menu.AddItem(L10n.TextContent("Bypass", null, null, null), effect.bypass, delegate() { Undo.RecordObject(effect, "Bypass Effect"); effect.bypass = !effect.bypass; @@ -384,7 +384,7 @@ private static void ShowEffectContextMenu(AudioMixerGroupController group, Audio menu.AddSeparator(""); } - menu.AddItem(EditorGUIUtility.TrTextContent("Copy effect settings to all snapshots"), false, delegate() + menu.AddItem(L10n.TextContent("Copy effect settings to all snapshots", null, null, null), false, delegate() { Undo.RecordObject(controller, "Copy effect settings to all snapshots"); if (effect.IsAttenuation()) @@ -396,7 +396,7 @@ private static void ShowEffectContextMenu(AudioMixerGroupController group, Audio if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume() && effect.enableWetMix) { - menu.AddItem(EditorGUIUtility.TrTextContent("Copy effect settings to all snapshots, including wet level"), false, delegate() + menu.AddItem(L10n.TextContent("Copy effect settings to all snapshots, including wet level", null, null, null), false, delegate() { Undo.RecordObject(controller, "Copy effect settings to all snapshots, including wet level"); controller.CopyEffectSettingsToAllSnapshots(group, effectIndex, controller.TargetSnapshot, true); @@ -414,7 +414,7 @@ private static void ShowEffectContextMenu(AudioMixerGroupController group, Audio if (!effect.IsAttenuation()) { menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Remove this effect"), false, delegate() + menu.AddItem(L10n.TextContent("Remove this effect", null, null, null), false, delegate() { controller.RemoveEffect(effect, group); AudioMixerUtility.RepaintAudioMixerAndInspectors(); @@ -428,13 +428,13 @@ private static void ShowBusPopupMenu(int effectIndex, AudioMixerGroupController { GenericMenu pm = new GenericMenu(); var sendContext = new AudioMixerChannelStripView.ConnectSendContext(group.controller, effect, null); - pm.AddItem(EditorGUIUtility.TrTextContent("None"), false, AudioMixerChannelStripView.ConnectSendPopupCallback, sendContext); + pm.AddItem(L10n.TextContent("None", null, null, null), false, AudioMixerChannelStripView.ConnectSendPopupCallback, sendContext); pm.AddSeparator(""); AudioMixerChannelStripView.AddMenuItemsForReturns(pm, string.Empty, effectIndex, group, allGroups, effectMap, effect, true); if (pm.GetItemCount() == 2) { - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("No valid Receive targets found")); + pm.AddDisabledItem(L10n.TextContent("No valid Receive targets found", null, null, null)); } pm.DropDown(buttonRect); diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParameterView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParameterView.cs index 8c86a45d7a..f92e323aa0 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParameterView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParameterView.cs @@ -71,13 +71,13 @@ public void OnContextClick(int itemIndex) { GenericMenu pm = new GenericMenu(); pm.AddItem( - EditorGUIUtility.TrTextContent("Unexpose"), + L10n.TextContent("Unexpose", null, null, null), false, delegate(object data) { Delete((int)data); }, itemIndex); pm.AddItem( - EditorGUIUtility.TrTextContent("Rename"), + L10n.TextContent("Rename", null, null, null), false, delegate(object data) { m_ReorderableListWithRenameAndScrollView.BeginRename((int)data, 0f); }, itemIndex); diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParametersPopup.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParametersPopup.cs index 2177876d08..2ca624a8d5 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParametersPopup.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerExposedParametersPopup.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEngine; @@ -25,7 +24,7 @@ internal static void Popup(AudioMixerController controller, GUIStyle style, para } // Cache to prevent constructing string on every event - static readonly GUIContent m_ButtonContent = EditorGUIUtility.TrTextContent("", "Audio Mixer parameters can be exposed to scripting. Select an Audio Mixer Group, right click one of its properties in the Inspector and select 'Expose'."); + static readonly GUIContent m_ButtonContent = L10n.TextContent("", "Audio Mixer parameters can be exposed to scripting. Select an Audio Mixer Group, right click one of its properties in the Inspector and select 'Expose'.", null, null); [NoAutoStaticsCleanup] // Display cache invalidation counter compared against controller state; -1 default re-syncs on next access, safe to persist across reload. static int m_LastNumExposedParams = -1; static GUIContent GetButtonContent(AudioMixerController controller) @@ -64,4 +63,3 @@ public override Vector2 GetWindowSize() } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupTreeView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupTreeView.cs index 0f2f2b618a..210f4c222c 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupTreeView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupTreeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using System.Collections.Generic; using System.Linq; @@ -163,8 +162,8 @@ public override bool IsRenamingItemAllowed(TreeViewItem node) internal class AudioGroupTreeViewGUI : TreeViewGUI { readonly float column1Width = 20f; - readonly GUIContent k_VisibleON = EditorGUIUtility.TrIconContent("animationvisibilitytoggleon"); - readonly GUIContent k_VisibleOFF = EditorGUIUtility.TrIconContent("animationvisibilitytoggleoff"); + readonly GUIContent k_VisibleON = L10n.IconContent("animationvisibilitytoggleon", null, null); + readonly GUIContent k_VisibleOFF = L10n.IconContent("animationvisibilitytoggleoff", null, null); public Action NodeWasToggled; public AudioMixerController m_Controller = null; @@ -300,8 +299,8 @@ internal class AudioMixerGroupTreeView class Styles { - public GUIContent header = EditorGUIUtility.TrTextContent("Groups", "An Audio Mixer Group is used by e.g Audio Sources to modify the audio output before it reaches the Audio Listener. An Audio Mixer Group will route its output to another Audio Mixer Group if it is made a child of that group. The Master Group will route its output to the Audio Listener if it doesn't route its output into another Mixer."); - public GUIContent addButton = EditorGUIUtility.TrIconContent("CreateAddNew", "Add child group"); + public GUIContent header = L10n.TextContent("Groups", "An Audio Mixer Group is used by e.g Audio Sources to modify the audio output before it reaches the Audio Listener. An Audio Mixer Group will route its output to another Audio Mixer Group if it is made a child of that group. The Master Group will route its output to the Audio Listener if it doesn't route its output into another Mixer.", null, null); + public GUIContent addButton = L10n.IconContent("CreateAddNew", "Add child group", null); public Texture2D audioMixerGroupIcon = EditorGUIUtility.FindTexture(typeof(UnityEngine.Audio.AudioMixerGroup)); } @@ -476,12 +475,12 @@ public void OnTreeViewContextClick(EntityId index) if (!EditorApplication.isPlaying) { - pm.AddItem(EditorGUIUtility.TrTextContent("Add child group"), false, AddChildGroupPopupCallback, new AudioMixerGroupPopupContext(m_Controller, mixerNode.group)); + pm.AddItem(L10n.TextContent("Add child group", null, null, null), false, AddChildGroupPopupCallback, new AudioMixerGroupPopupContext(m_Controller, mixerNode.group)); if (mixerNode.group != m_Controller.masterGroup) { - pm.AddItem(EditorGUIUtility.TrTextContent("Add sibling group"), false, AddSiblingGroupPopupCallback, new AudioMixerGroupPopupContext(m_Controller, mixerNode.group)); + pm.AddItem(L10n.TextContent("Add sibling group", null, null, null), false, AddSiblingGroupPopupCallback, new AudioMixerGroupPopupContext(m_Controller, mixerNode.group)); pm.AddSeparator(""); - pm.AddItem(EditorGUIUtility.TrTextContent("Rename"), false, RenameGroupCallback, node); + pm.AddItem(L10n.TextContent("Rename", null, null, null), false, RenameGroupCallback, node); // Mastergroup cannot be deleted nor duplicated var selection = GetGroupSelectionWithoutMasterGroup().ToArray(); @@ -491,7 +490,7 @@ public void OnTreeViewContextClick(EntityId index) } else { - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Modifying group topology in play mode is not allowed")); + pm.AddDisabledItem(L10n.TextContent("Modifying group topology in play mode is not allowed", null, null, null)); } pm.ShowAsContext(); @@ -705,4 +704,3 @@ public void OnUndoRedoPerformed(in UndoRedoInfo info) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupViewList.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupViewList.cs index 1f8d11b2b6..6abb9e0642 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupViewList.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerGroupViewList.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using System.Collections.Generic; using System.Linq; @@ -23,8 +22,8 @@ internal class AudioMixerGroupViewList class Styles { - public GUIContent header = EditorGUIUtility.TrTextContent("Views", "A view is the saved visibility state of the current Mixer Groups. Use views to setup often used combinations of Mixer Groups."); - public GUIContent addButton = EditorGUIUtility.TrIconContent("CreateAddNew"); + public GUIContent header = L10n.TextContent("Views", "A view is the saved visibility state of the current Mixer Groups. Use views to setup often used combinations of Mixer Groups.", null, null); + public GUIContent addButton = L10n.IconContent("CreateAddNew", null, null); public Texture2D viewsIcon = EditorGUIUtility.FindTexture("AudioMixerView Icon"); } [NoAutoStaticsCleanup] // Lazy GUIContent/Texture2D style cache rebuilt on demand via null check; assets survive reload, safe to persist. @@ -223,9 +222,9 @@ static public void Show(Rect buttonRect, int viewIndex, AudioMixerGroupViewList { var menu = new GenericMenu(); data input = new data() { viewIndex = viewIndex, list = list }; - menu.AddItem(EditorGUIUtility.TrTextContent("Rename"), false, Rename, input); - menu.AddItem(EditorGUIUtility.TrTextContent("Duplicate"), false, Duplicate, input); - menu.AddItem(EditorGUIUtility.TrTextContent("Delete"), false, Delete, input); + menu.AddItem(L10n.TextContent("Rename", null, null, null), false, Rename, input); + menu.AddItem(L10n.TextContent("Duplicate", null, null, null), false, Duplicate, input); + menu.AddItem(L10n.TextContent("Delete", null, null, null), false, Delete, input); menu.DropDown(buttonRect); } @@ -251,4 +250,3 @@ static void Delete(object userData) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerSnapshotView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerSnapshotView.cs index 1a4d3aaf03..a278dfa3fc 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerSnapshotView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerSnapshotView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using System.Collections.Generic; using System.Linq; @@ -23,9 +22,9 @@ internal class AudioMixerSnapshotListView class Styles { - public GUIContent starIcon = EditorGUIUtility.TrIconContent("Favorite", "Start snapshot"); - public GUIContent header = EditorGUIUtility.TrTextContent("Snapshots", "A snapshot is a set of values for all parameters in the mixer. When using the mixer, you modify parameters in the selected snapshot. Blend between multiple snapshots at runtime."); - public GUIContent addButton = EditorGUIUtility.TrIconContent("CreateAddNew"); + public GUIContent starIcon = L10n.IconContent("Favorite", "Start snapshot", null); + public GUIContent header = L10n.TextContent("Snapshots", "A snapshot is a set of values for all parameters in the mixer. When using the mixer, you modify parameters in the selected snapshot. Blend between multiple snapshots at runtime.", null, null); + public GUIContent addButton = L10n.IconContent("CreateAddNew", null, null); public Texture2D snapshotsIcon = EditorGUIUtility.FindTexture(typeof(UnityEngine.Audio.AudioMixerSnapshot)); } [NoAutoStaticsCleanup] // Lazy GUIContent/Texture2D style cache rebuilt on demand via null check; assets survive reload, safe to persist. @@ -291,11 +290,11 @@ static public void Show(Rect buttonRect, AudioMixerSnapshotController snapshot, { var menu = new GenericMenu(); data input = new data() { snapshot = snapshot, list = list }; - menu.AddItem(EditorGUIUtility.TrTextContent("Set as start Snapshot"), false, SetAsStartupSnapshot, input); + menu.AddItem(L10n.TextContent("Set as start Snapshot", null, null, null), false, SetAsStartupSnapshot, input); menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Rename"), false, Rename, input); - menu.AddItem(EditorGUIUtility.TrTextContent("Duplicate"), false, Duplicate, input); - menu.AddItem(EditorGUIUtility.TrTextContent("Delete"), false, Delete, input); + menu.AddItem(L10n.TextContent("Rename", null, null, null), false, Rename, input); + menu.AddItem(L10n.TextContent("Duplicate", null, null, null), false, Duplicate, input); + menu.AddItem(L10n.TextContent("Delete", null, null, null), false, Delete, input); menu.DropDown(buttonRect); } @@ -331,4 +330,3 @@ public void OnUndoRedoPerformed(in UndoRedoInfo info) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerWindow.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerWindow.cs index 9972c87994..8228b71fba 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerWindow.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using System.Collections.Generic; using System.Linq; @@ -18,10 +17,6 @@ namespace UnityEditor [EditorWindowTitle(title = "Audio Mixer", icon = "Audio Mixer")] internal partial class AudioMixerWindow : EditorWindow, IHasCustomMenu { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public AudioMixerWindow() { } - #pragma warning restore UAL0015 - [AutoStaticsCleanupOnCodeReload] static AudioMixerWindow s_Instance; @@ -120,7 +115,7 @@ class GUIContents public GUIContents() { #pragma warning disable UAL0015 // lazily-loaded icon re-fetched on next access; a stale reference is harmlessly replaced - editSnapShots = EditorGUIUtility.TrTextContent("Edit in Play Mode", "Edit in playmode and your changes are automatically saved. Note when editing is disabled, live values are shown.", EditorGUIUtility.TrIconContent("Animation.Record", "Are scene and inspector changes recorded into the animation curves?").image); + editSnapShots = EditorGUIUtility.TrTextContent("Edit in Play Mode", "Edit in playmode and your changes are automatically saved. Note when editing is disabled, live values are shown.", L10n.IconContent("Animation.Record", "Are scene and inspector changes recorded into the animation curves?", null).image); #pragma warning restore UAL0015 } } @@ -729,31 +724,31 @@ public MixerParameterDefinition ParamDef(string name, string desc, string units, // Add items to the context menu for the AudioMixerWindow (the tree horizontal lines, upper right corner) public virtual void AddItemsToMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Sort groups alphabetically"), m_SortGroupsAlphabetically, delegate { m_SortGroupsAlphabetically = !m_SortGroupsAlphabetically; }); - menu.AddItem(EditorGUIUtility.TrTextContent("Show referenced groups"), m_ShowReferencedBuses, delegate { m_ShowReferencedBuses = !m_ShowReferencedBuses; }); - menu.AddItem(EditorGUIUtility.TrTextContent("Show group connections"), m_ShowBusConnections, delegate { m_ShowBusConnections = !m_ShowBusConnections; }); + menu.AddItem(L10n.TextContent("Sort groups alphabetically", null, null, null), m_SortGroupsAlphabetically, delegate { m_SortGroupsAlphabetically = !m_SortGroupsAlphabetically; }); + menu.AddItem(L10n.TextContent("Show referenced groups", null, null, null), m_ShowReferencedBuses, delegate { m_ShowReferencedBuses = !m_ShowReferencedBuses; }); + menu.AddItem(L10n.TextContent("Show group connections", null, null, null), m_ShowBusConnections, delegate { m_ShowBusConnections = !m_ShowBusConnections; }); if (m_ShowBusConnections) - menu.AddItem(EditorGUIUtility.TrTextContent("Only highlight selected group connections"), m_ShowBusConnectionsOfSelection, delegate { m_ShowBusConnectionsOfSelection = !m_ShowBusConnectionsOfSelection; }); + menu.AddItem(L10n.TextContent("Only highlight selected group connections", null, null, null), m_ShowBusConnectionsOfSelection, delegate { m_ShowBusConnectionsOfSelection = !m_ShowBusConnectionsOfSelection; }); menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Vertical layout"), layoutMode == LayoutMode.Vertical, delegate { layoutMode = LayoutMode.Vertical; }); - menu.AddItem(EditorGUIUtility.TrTextContent("Horizontal layout"), layoutMode == LayoutMode.Horizontal, delegate { layoutMode = LayoutMode.Horizontal; }); + menu.AddItem(L10n.TextContent("Vertical layout", null, null, null), layoutMode == LayoutMode.Vertical, delegate { layoutMode = LayoutMode.Vertical; }); + menu.AddItem(L10n.TextContent("Horizontal layout", null, null, null), layoutMode == LayoutMode.Horizontal, delegate { layoutMode = LayoutMode.Horizontal; }); menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Use RMS metering for display"), EditorPrefs.GetBool(kAudioMixerUseRMSMetering, true), delegate { EditorPrefs.SetBool(kAudioMixerUseRMSMetering, true); }); - menu.AddItem(EditorGUIUtility.TrTextContent("Use peak metering for display"), !EditorPrefs.GetBool(kAudioMixerUseRMSMetering, true), delegate { EditorPrefs.SetBool(kAudioMixerUseRMSMetering, false); }); + menu.AddItem(L10n.TextContent("Use RMS metering for display", null, null, null), EditorPrefs.GetBool(kAudioMixerUseRMSMetering, true), delegate { EditorPrefs.SetBool(kAudioMixerUseRMSMetering, true); }); + menu.AddItem(L10n.TextContent("Use peak metering for display", null, null, null), !EditorPrefs.GetBool(kAudioMixerUseRMSMetering, true), delegate { EditorPrefs.SetBool(kAudioMixerUseRMSMetering, false); }); if (Unsupported.IsDeveloperMode()) { menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Groups Rendered Above"), m_GroupsRenderedAboveSections, delegate { m_GroupsRenderedAboveSections = !m_GroupsRenderedAboveSections; }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build 10 groups"), false, delegate { m_Controller.BuildTestSetup(0, 7, 10); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build 20 groups"), false, delegate { m_Controller.BuildTestSetup(0, 7, 20); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build 40 groups"), false, delegate { m_Controller.BuildTestSetup(0, 7, 40); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build 80 groups"), false, delegate { m_Controller.BuildTestSetup(0, 7, 80); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build 160 groups"), false, delegate { m_Controller.BuildTestSetup(0, 7, 160); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build chain of 10 groups"), false, delegate { m_Controller.BuildTestSetup(1, 1, 10); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build chain of 20 groups "), false, delegate { m_Controller.BuildTestSetup(1, 1, 20); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build chain of 40 groups"), false, delegate { m_Controller.BuildTestSetup(1, 1, 40); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Build chain of 80 groups"), false, delegate { m_Controller.BuildTestSetup(1, 1, 80); }); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Show overlays"), m_ShowDeveloperOverlays, delegate { m_ShowDeveloperOverlays = !m_ShowDeveloperOverlays; }); + menu.AddItem(L10n.TextContent("DEVELOPER/Groups Rendered Above", null, null, null), m_GroupsRenderedAboveSections, delegate { m_GroupsRenderedAboveSections = !m_GroupsRenderedAboveSections; }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build 10 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(0, 7, 10); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build 20 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(0, 7, 20); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build 40 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(0, 7, 40); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build 80 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(0, 7, 80); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build 160 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(0, 7, 160); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build chain of 10 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(1, 1, 10); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build chain of 20 groups ", null, null, null), false, delegate { m_Controller.BuildTestSetup(1, 1, 20); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build chain of 40 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(1, 1, 40); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Build chain of 80 groups", null, null, null), false, delegate { m_Controller.BuildTestSetup(1, 1, 80); }); + menu.AddItem(L10n.TextContent("DEVELOPER/Show overlays", null, null, null), m_ShowDeveloperOverlays, delegate { m_ShowDeveloperOverlays = !m_ShowDeveloperOverlays; }); } } } @@ -779,7 +774,7 @@ static public void Show(Rect buttonRect, string[] classNames, EntityId initialSe } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("No Audio Mixers found in this project")); + menu.AddDisabledItem(L10n.TextContent("No Audio Mixers found in this project", null, null, null)); } menu.DropDown(buttonRect); } @@ -792,4 +787,3 @@ static void SelectCallback(object userData) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixersTreeView.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixersTreeView.cs index 4c5c54e68f..22c8411ff5 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixersTreeView.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixersTreeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System.IO; using UnityEditor.ProjectWindowCallback; using UnityEngine; @@ -536,8 +535,8 @@ internal class AudioMixersTreeView class Styles { - public GUIContent header = EditorGUIUtility.TrTextContent("Mixers", "All mixers in the project are shown here. By default, a mixer outputs to the AudioListener but mixers can also route their output to other mixers. Each mixer shows where it outputs (in parenthesis). To reroute a mixer simply drag the mixer upon another mixer and select a group from the popup."); - public GUIContent addButton = EditorGUIUtility.TrIconContent("CreateAddNew", "Add mixer asset. The asset will be saved in the same folder as the current selected mixer or, if none is selected, saved in the Assets folder."); + public GUIContent header = L10n.TextContent("Mixers", "All mixers in the project are shown here. By default, a mixer outputs to the AudioListener but mixers can also route their output to other mixers. Each mixer shows where it outputs (in parenthesis). To reroute a mixer simply drag the mixer upon another mixer and select a group from the popup.", null, null); + public GUIContent addButton = L10n.IconContent("CreateAddNew", "Add mixer asset. The asset will be saved in the same folder as the current selected mixer or, if none is selected, saved in the Assets folder.", null); public Texture2D audioMixerIcon = EditorGUIUtility.FindTexture(typeof(AudioMixerController)); } [NoAutoStaticsCleanup] // Lazy GUIContent/Texture2D holder loaded by fixed name/type, re-initialized on first access via null-check; safe to persist across reload. @@ -584,9 +583,9 @@ public void OnTreeViewContextClick(EntityId index) if (node != null) { GenericMenu pm = new GenericMenu(); - pm.AddItem(EditorGUIUtility.TrTextContent("Rename"), false, RenameAudioMixerCallback, node); + pm.AddItem(L10n.TextContent("Rename", null, null, null), false, RenameAudioMixerCallback, node); pm.AddSeparator(""); - pm.AddItem(EditorGUIUtility.TrTextContent("Delete AudioMixer"), false, DeleteAudioMixerCallback, node.mixer); + pm.AddItem(L10n.TextContent("Delete AudioMixer", null, null, null), false, DeleteAudioMixerCallback, node.mixer); pm.ShowAsContext(); } } @@ -703,7 +702,7 @@ void OnMixersDroppedOnMixerCallback(AudioMixerController[] draggedMixers, AudioM Object startSelection = draggedMixers.Length == 1 ? draggedMixers[0].outputAudioMixerGroup : null; ObjectSelector.get.Show(startSelection, typeof(AudioMixerGroup), null, false, new List() { droppedUponMixer.GetEntityId() }); ObjectSelector.get.objectSelectorID = kObjectSelectorID; - ObjectSelector.get.titleContent = EditorGUIUtility.TrTextContent("Select Output Audio Mixer Group"); + ObjectSelector.get.titleContent = L10n.TextContent("Select Output Audio Mixer Group", null, null, null); GUIUtility.ExitGUI(); } } @@ -748,4 +747,3 @@ void HandleObjectSelectorResult() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/StreamedAudioClipPreview.cs b/Editor/Mono/Audio/StreamedAudioClipPreview.cs index d7f6e8dedd..d776864ca2 100644 --- a/Editor/Mono/Audio/StreamedAudioClipPreview.cs +++ b/Editor/Mono/Audio/StreamedAudioClipPreview.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using System.Collections.Generic; using System.Reflection; @@ -66,9 +65,9 @@ public ClipPreviewDetails(AudioClip clip, bool isLooping, int size, double local this.clip = clip; - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // ClipPreviewDetails is a per-call descriptor built and consumed inside a single draw; the overview array does not outlive it, and the next draw re-fetches (recomputing it if the cache was dropped) preview = AudioClipMinMaxOverview.GetOverviewFor(clip); - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 if (preview == null) throw new ArgumentException("Clip " + clip + "'s overview preview is null"); @@ -470,4 +469,3 @@ bool OnNewWaveformData(WaveformStreamer streamer, float[] data, int remaining) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/UIElements/AudioContainerElementClipField.cs b/Editor/Mono/Audio/UIElements/AudioContainerElementClipField.cs index e085cdd8a5..30b15608c0 100644 --- a/Editor/Mono/Audio/UIElements/AudioContainerElementClipField.cs +++ b/Editor/Mono/Audio/UIElements/AudioContainerElementClipField.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEditor.UIElements; @@ -115,4 +114,3 @@ static void GenerateVisualContent(MeshGenerationContext context) } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Audio/UIElements/OnAudioFilterReadLevelMeter.cs b/Editor/Mono/Audio/UIElements/OnAudioFilterReadLevelMeter.cs index 8184a9fda6..121fe6ec90 100644 --- a/Editor/Mono/Audio/UIElements/OnAudioFilterReadLevelMeter.cs +++ b/Editor/Mono/Audio/UIElements/OnAudioFilterReadLevelMeter.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: AudioAuthoring not yet converted using UnityEngine; using UnityEngine.UIElements; @@ -24,4 +23,3 @@ public OnAudioFilterReadLevelMeter(MonoBehaviour behaviour) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/BuildPipeline/AssemblyStripper.cs b/Editor/Mono/BuildPipeline/AssemblyStripper.cs index 47a9342b25..1c9356ab63 100644 --- a/Editor/Mono/BuildPipeline/AssemblyStripper.cs +++ b/Editor/Mono/BuildPipeline/AssemblyStripper.cs @@ -279,7 +279,7 @@ public static string WriteEditorData(BuildPostProcessArgs args, NPath linkerInpu typesInScenes = typesInScenes, allNativeTypes = CollectNativeTypeData().ToArray(), forceIncludeModules = forceIncludeModules.ToArray(), - forceExcludeModules = forceExcludeModules.ToArray() + forceExcludeModules = forceExcludeModules.ToArray(), }; var path = linkerInputDirectory.Combine("EditorToUnityLinkerData.json"); @@ -287,6 +287,24 @@ public static string WriteEditorData(BuildPostProcessArgs args, NPath linkerInpu return path.MakeAbsolute().ToString(); } + /// + /// Writes the ManagedCapture config (from ) to + /// its own file and returns the absolute path, or null when no module supplies a config. + /// Passing the config in a dedicated file (via LinkRequest.ManagedCaptureConfigFile) rather + /// than embedding it in the editor-to-linker data isolates it: a bad or oversized capture + /// config can't corrupt the shared editor data the rest of engine stripping depends on. + /// + public static string WriteManagedCaptureConfig(NPath linkerInputDirectory) + { + var config = onProvideManagedCaptureConfig?.Invoke(); + if (string.IsNullOrEmpty(config)) + return null; + + var path = linkerInputDirectory.Combine("ManagedCaptureConfig.json"); + File.WriteAllText(path.ToString(), config); + return path.MakeAbsolute().ToString(); + } + static List GetTypesInScenesInformation(BuildReport report, RuntimeClassRegistry rcr) { var items = new List(); @@ -373,6 +391,14 @@ public bool IsModuleIncluded(string moduleName) [AutoStaticsCleanupOnCodeReload] public static event Action onCollectIncludedModules; + /// + /// Event for modules to provide ManagedCapture configuration JSON. + /// Invoked during WriteManagedCaptureConfig to write the config to its own linker input + /// file, passed to the linker via LinkRequest.ManagedCaptureConfigFile. + /// + [AutoStaticsCleanupOnCodeReload] + public static event Func onProvideManagedCaptureConfig; + static void CollectIncludedAndExcludedModules(out List forceInclude, out List forceExclude) { forceInclude = new List(); diff --git a/Editor/Mono/BuildPipeline/BuildPlatform.cs b/Editor/Mono/BuildPipeline/BuildPlatform.cs index 89e69747a3..6a247b234c 100644 --- a/Editor/Mono/BuildPipeline/BuildPlatform.cs +++ b/Editor/Mono/BuildPipeline/BuildPlatform.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ContentBuild not yet converted using UnityEngine; using System; using System.Collections.Generic; @@ -227,6 +226,8 @@ internal partial class BuildPlatforms // re-created on first access rather than eagerly, so it never runs before native // BuildTargetDiscovery is ready during a build. [AutoStaticsCleanupOnCodeReload] + // Lazy singleton created by the instance property on the next access after cleanup nulls it. + [IgnoreForUAL0015("Lazy singleton recreated by the instance property after cleanup nulls it")] static BuildPlatforms s_Instance; public static BuildPlatforms instance => s_Instance ??= new BuildPlatforms(); @@ -358,4 +359,3 @@ public List GetValidPlatforms() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/BuildPipeline/BuildTarget.cs b/Editor/Mono/BuildPipeline/BuildTarget.cs index 6a2f163a1c..bdb08ecce4 100644 --- a/Editor/Mono/BuildPipeline/BuildTarget.cs +++ b/Editor/Mono/BuildPipeline/BuildTarget.cs @@ -203,6 +203,7 @@ public enum BuildTarget /// Switch2 = 48, + [System.Obsolete("Kepler has been removed in 6000.7")] [ExcludeFromDocs] Kepler = 49, diff --git a/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs b/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs index 1050e57b66..408b9fe6b8 100644 --- a/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs +++ b/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ContentBuild not yet converted using System; using System.IO; using System.Collections.Generic; @@ -96,6 +95,7 @@ public struct DiscoveredTargetInfo static readonly string k_CreateIPlatformProviderFailedError = L10n.Tr("Failed to create IPlatformProvider instance for type '{0}'.", null); static readonly string k_PlatformDeprecatedDefaultWithDisplayName = L10n.Tr("The {0} platform is deprecated.", null); static readonly string k_DerivedPlatformUsesDeprecatedBase = L10n.Tr("This platform is based on {0}, which is deprecated.", null); + static readonly string k_PinnedPackageVersionNotInstalledWarning = L10n.Tr("Package '{0}' is installed at version {1}, but the platform requires version {2}. The installed version was kept.", null); public static extern bool PlatformHasFlag(BuildTarget platform, TargetAttributes flag); @@ -349,6 +349,35 @@ internal class PlatformPackageList public PlatformPackageInfo[] recommendedPackages = Array.Empty(); } + /// + /// Identifies a package to install: a bare package name plus an optional pinned version. + /// The two are kept apart so every lookup and comparison can use + /// directly, and only combines them. + /// + [Serializable] + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal struct PlatformPackageIdentifier + { + public string name; + + /// + /// Pinned package version, or empty when the registry should resolve the latest version. + /// + public string version; + + public PlatformPackageIdentifier(string name, string version = "") + { + this.name = name; + this.version = version; + } + + /// + /// Identifier for a Package Manager installation request. + /// + public string GetInstallIdentifier() => + string.IsNullOrEmpty(version) ? name : $"{name}@{version}"; + } + [Serializable] [VisibleToOtherModules("UnityEditor.BuildProfileModule")] internal class PlatformPackageInfo @@ -371,16 +400,26 @@ internal class PlatformPackageInfo /// public string deprecationMessage; + /// + /// Optional pinned package version. When empty the registry resolves the latest version, + /// which is the behaviour for every package that does not specify one. + /// + public string version; + public PlatformPackageInfo() {} - public PlatformPackageInfo(string displayName, string qualifiedName, string description, string publisher = "", bool hasThumbnail = false) + public PlatformPackageInfo(string displayName, string qualifiedName, string description, string publisher = "", bool hasThumbnail = false, string version = "") { this.displayName = displayName; this.qualifiedName = qualifiedName; this.description = description; this.publisher = publisher; this.hasThumbnail = hasThumbnail; + this.version = version; } + + public PlatformPackageIdentifier GetPackageIdentifier() => + new PlatformPackageIdentifier(qualifiedName, version); } [VisibleToOtherModules("UnityEditor.BuildProfileModule")] @@ -764,6 +803,14 @@ public PlatformGroup() { } new PlatformInfo { displayName = "Unity Render Service for Android™", + downloadLinkName = "Android", + description = L10n.Tr( + "Unity Render Service for Android™ lets you integrate Unity as a service in Android applications developed with Android Studio, " + + "so that Java and Kotlin applications can display Unity's 3D graphics within their own user interface. " + + "A single render service can drive multiple screens, or multiple windows per screen, which helps optimize CPU and memory " + + "consumption for use cases such as automotive dashboards. " + + "This platform offers pre-configured settings for building Unity as a render service." + , null), buildTarget = BuildTarget.Android, iconName = "BuildSettings.Android", internalPackages = new PlatformPackageList @@ -773,7 +820,7 @@ public PlatformGroup() { } new PlatformPackageInfo(L10n.Tr("Unity Render Service for Android™ Support", null), "com.unity.android.render-service", L10n.Tr("Enables building the Unity Render Service for Android™. Contact your sales representative for access.", null)) } }, - flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget | PlatformAttributes.IsDerivedBuildTarget | PlatformAttributes.IsHidden | PlatformAttributes.IsVisibleInPlatformBrowserOnly + flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget | PlatformAttributes.IsDerivedBuildTarget } }, { @@ -848,22 +895,15 @@ public PlatformGroup() { } flags = PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget, buildProfilePlatformBannerBgColorHex = "#FF443A" } - }, - { - new("f8c7649c24f344129a97cf9854e2d582"), - new PlatformInfo - { - displayName = "Kepler", - buildTarget = BuildTarget.Kepler, - iconName = "BuildSettings.EmbeddedLinux", - flags = PlatformAttributes.IsMacBuildTarget | PlatformAttributes.IsNDAPlatform | PlatformAttributes.IsHidden - } } }; [NoAutoStaticsCleanup] // GUID->bool install map, value types only, repopulated by Initialize; no user-code refs static readonly Dictionary k_PlatformInstalledData = new(); - [AutoStaticsCleanupOnCodeReload] + // Filled only from the static constructor below, which runs once per domain and not again on a code + // reload, so emptying this map would make every reader behave as if no SDK platform is installed. + // Same static-constructor path as k_PlatformInstalledData above, so the two are kept consistent. + [NoAutoStaticsCleanup] static readonly Dictionary k_SDKPlatformExtensions = new(); [NoAutoStaticsCleanup] // immutable static platform-group config (strings + GUID arrays), no user-code refs @@ -929,8 +969,7 @@ public PlatformGroup() { } new("f1d7bec2fd7f42f481c66ef512f47845"), // EmbeddedLinux new("f188349a68c441ec9e3eb4c6f59abd41"), // LinuxHeadlessSimulation new("99ef95e1e9b048fa9628d7eed27a8646"), // QNX - // new("1e09bd9b55c8d45e9a11b4727bf18e88"), // Android Render Service will come here, but is hidden until entitlements are available. - new("f8c7649c24f344129a97cf9854e2d582"), // Kepler + new("1e09bd9b55c8d45e9a11b4727bf18e88"), // Unity Render Service for Android™ } }, new PlatformGroup @@ -1650,32 +1689,71 @@ public static string[] GetAllPlatformPackageNames() } /// - /// Returns all required package names for a given platform. A required package - /// is any package (internal or partner) that must be installed for a build to succeed. + /// Warns when a package pins a version but a different one is already installed. Installing + /// the pin would override a version the user may have chosen deliberately, so the installed + /// version is kept and the mismatch is only reported. + /// + /// Only plain version pins are comparable. The version slot may also carry a source such as + /// a "file:" path or a git URL, which has no version to compare against. + /// + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal static void WarnIfPinnedVersionNotInstalled(PlatformPackageIdentifier identifier) + { + var installedVersion = PackageManager.PackageInfo.FindForPackageName(identifier.name)?.version; + if (!ShouldWarnAboutPinnedVersion(identifier.version, installedVersion)) + return; + + Debug.LogWarning(string.Format( + k_PinnedPackageVersionNotInstalledWarning, identifier.name, installedVersion, identifier.version)); + } + + /// + /// True when a pinned version is comparable to what is installed and the two differ. Only a + /// plain version pin is comparable: the version slot may also carry a source such as a + /// "file:" path or a git URL, which has no version to compare against. + /// + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal static bool ShouldWarnAboutPinnedVersion(string pinnedVersion, string installedVersion) + { + if (string.IsNullOrEmpty(pinnedVersion) || !char.IsDigit(pinnedVersion[0])) + return false; + + return !string.IsNullOrEmpty(installedVersion) && installedVersion != pinnedVersion; + } + + /// + /// Returns identifiers for all required packages a given platform is still missing. A + /// required package is any package (internal or partner) that must be installed for a + /// build to succeed. The result feeds a Package Manager installation request, so each + /// identifier carries the package's pinned version when the catalog specifies one. /// /// Platform identifier. - /// Set of required package names. - public static string[] GetAllMissingRequiredPlatformPackageNames(GUID platformId) + /// Set of required package identifiers. + public static PlatformPackageIdentifier[] GetAllMissingRequiredPlatformPackageIdentifiers(GUID platformId) { - var allPackageNames = new HashSet(); + var seenPackageNames = new HashSet(); + var result = new List(); var internalPackages = BuildTargetDiscovery.BuildPlatformInternalPackages(platformId); var partnerPackages = BuildTargetDiscovery.BuildPlatformPartnerPackages(platformId); - foreach (var package in internalPackages.requiredPackages) - { - if (!PackageManager.PackageInfo.IsPackageRegistered(package.qualifiedName)) - allPackageNames.Add(package.qualifiedName); - } + AddMissingRequiredPackages(internalPackages); + AddMissingRequiredPackages(partnerPackages); + + return result.ToArray(); - foreach (var package in partnerPackages.requiredPackages) + void AddMissingRequiredPackages(PlatformPackageList packageList) { - if (!PackageManager.PackageInfo.IsPackageRegistered(package.qualifiedName)) - allPackageNames.Add(package.qualifiedName); - } + foreach (var package in packageList.requiredPackages) + { + if (!seenPackageNames.Add(package.qualifiedName)) + continue; - var result = new string[allPackageNames.Count]; - allPackageNames.CopyTo(result); - return result; + if (PackageManager.PackageInfo.IsPackageRegistered(package.qualifiedName)) + WarnIfPinnedVersionNotInstalled(package.GetPackageIdentifier()); + else + result.Add(package.GetPackageIdentifier()); + } + } } [System.Obsolete("BuildPlatformDescription(BuildTarget) is obsolete. Use BuildPlatformDescription(IBuildTarget) instead.", false)] @@ -1891,4 +1969,3 @@ public static PlatformGroup[] GetPlatformGroups() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/BuildPipeline/BuildTargetGroup.cs b/Editor/Mono/BuildPipeline/BuildTargetGroup.cs index 3d1b2e067a..03c3b2444b 100644 --- a/Editor/Mono/BuildPipeline/BuildTargetGroup.cs +++ b/Editor/Mono/BuildPipeline/BuildTargetGroup.cs @@ -156,6 +156,7 @@ public enum BuildTargetGroup ///Nintendo Switch™ 2 target. Switch2 = 37, + [Obsolete("Kepler has been removed in 6000.7")] [ExcludeFromDocs] Kepler = 38, } diff --git a/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindowExtension.cs b/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindowExtension.cs index ba70cc4b8a..dd25fc7da7 100644 --- a/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindowExtension.cs +++ b/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindowExtension.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ContentBuild not yet converted using System; using System.Collections.Generic; using UnityEditor; @@ -12,8 +11,8 @@ internal abstract class DesktopStandaloneBuildWindowExtension : DefaultBuildWindowExtension { - private GUIContent m_StandaloneTarget = EditorGUIUtility.TrTextContent("Target Platform", "Destination platform for standalone build"); - private GUIContent m_Architecture = EditorGUIUtility.TrTextContent("Architecture", "Build m_Architecture for standalone"); + private GUIContent m_StandaloneTarget = L10n.TextContent("Target Platform", "Destination platform for standalone build", null, null); + private GUIContent m_Architecture = L10n.TextContent("Architecture", "Build m_Architecture for standalone", null, null); private BuildTarget[] m_StandaloneSubtargets; private GUIContent[] m_StandaloneSubtargetStrings; @@ -68,17 +67,17 @@ private void SetupStandaloneSubtargets() if (ModuleManager.IsPlatformSupportLoadedByBuildTarget(BuildTarget.StandaloneWindows)) { standaloneSubtargetsList.Add(BuildTarget.StandaloneWindows); - standaloneSubtargetStringsList.Add(EditorGUIUtility.TrTextContent("Windows")); + standaloneSubtargetStringsList.Add(L10n.TextContent("Windows", null, null, null)); } if (ModuleManager.IsPlatformSupportLoadedByBuildTarget(BuildTarget.StandaloneOSX)) { standaloneSubtargetsList.Add(BuildTarget.StandaloneOSX); - standaloneSubtargetStringsList.Add(EditorGUIUtility.TrTextContent("macOS")); + standaloneSubtargetStringsList.Add(L10n.TextContent("macOS", null, null, null)); } if (ModuleManager.IsPlatformSupportLoadedByBuildTarget(BuildTarget.StandaloneLinux64)) { standaloneSubtargetsList.Add(BuildTarget.StandaloneLinux64); - standaloneSubtargetStringsList.Add(EditorGUIUtility.TrTextContent("Linux")); + standaloneSubtargetStringsList.Add(L10n.TextContent("Linux", null, null, null)); } m_StandaloneSubtargets = standaloneSubtargetsList.ToArray(); @@ -276,4 +275,3 @@ public override bool ShouldDrawWaitForManagedDebugger() return true; } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs b/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs index 6b36e64b80..a6d735c98b 100644 --- a/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs +++ b/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs @@ -54,8 +54,9 @@ public override void UpdateBootConfig(BuildTarget target, BootConfigData config, config.AddKey("nolog"); if (PlayerSettings.GetCaptureStartupLogs(NamedBuildTarget.FromActiveSettings(target))) config.Set("capture-startup-logs", "1"); - if (PlayerSettings.enableDirectStorage) - config.Set("enable-directstorage", PlayerSettings.enableDirectStorage.ToString()); // Shared naming with other DirectStorage supported platforms + + config.Set("enable-directstorage", PlayerSettings.enableDirectStorage.ToString()); // Shared naming with other DirectStorage supported platforms + } public override ILaunchReport LaunchPlayer(BuildLaunchPlayerArgs args) diff --git a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs index 8edd7f926b..a38c9e9949 100644 --- a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs +++ b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs @@ -153,8 +153,6 @@ public static NamedBuildTarget FromBuildTargetGroup(BuildTargetGroup buildTarget return new NamedBuildTarget("GameCoreXboxOne"); case BuildTargetGroup.PS5: return new NamedBuildTarget("PS5"); - case BuildTargetGroup.Kepler: - return new NamedBuildTarget("Kepler"); } throw new ArgumentException($"There is no a valid NamedBuildTarget for BuildTargetGroup '{buildTargetGroup}'"); diff --git a/Editor/Mono/BuildPipeline/Settings/BuildAssetBundlesParameters.bindings.cs b/Editor/Mono/BuildPipeline/Settings/BuildAssetBundlesParameters.bindings.cs index 987e46e690..1aa3ae2466 100644 --- a/Editor/Mono/BuildPipeline/Settings/BuildAssetBundlesParameters.bindings.cs +++ b/Editor/Mono/BuildPipeline/Settings/BuildAssetBundlesParameters.bindings.cs @@ -50,7 +50,6 @@ public struct BuildAssetBundlesParameters /// /// /// - /// public int subtarget { get; set; } ///User-specified preprocessor defines used while compiling assemblies during the AssetBundle build. (optional) ///Preprocessor defines may be used to exclude serialized fields from class definitions, so this can be have an influence on how objects are serialized during the build process. diff --git a/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs b/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs index 513bae79b0..2401ff46cd 100644 --- a/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs +++ b/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs @@ -89,7 +89,6 @@ public struct BuildPlayerOptions /// /// /// - /// public int subtarget { get; set; } ///The flags to apply when building the Player. ///Set this property to a bitwise combination of values before you pass to . For example, set options = BuildOptions.Development | BuildOptions.AutoRunPlayer to create a development build and run it automatically after the build completes. diff --git a/Editor/Mono/BuildPlayerSceneTreeView.cs b/Editor/Mono/BuildPlayerSceneTreeView.cs index 15331c143d..3bd08c62eb 100644 --- a/Editor/Mono/BuildPlayerSceneTreeView.cs +++ b/Editor/Mono/BuildPlayerSceneTreeView.cs @@ -306,7 +306,7 @@ protected override void ContextClicked() if (GetSelection().Count > 0) { GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Remove Selection"), false, RemoveSelection); + menu.AddItem(L10n.TextContent("Remove Selection", null, null, null), false, RemoveSelection); menu.ShowAsContext(); } } diff --git a/Editor/Mono/BuildPlayerWindow.cs b/Editor/Mono/BuildPlayerWindow.cs index 059d3d9908..7586a69eb2 100644 --- a/Editor/Mono/BuildPlayerWindow.cs +++ b/Editor/Mono/BuildPlayerWindow.cs @@ -42,21 +42,21 @@ class Styles public GUIStyle oddRow = "CN EntryBackOdd"; public GUIStyle platformSelector = "PlayerSettingsPlatform"; - public GUIContent platformTitle = EditorGUIUtility.TrTextContent("Platform", "Which platform to build for"); - public GUIContent switchPlatform = EditorGUIUtility.TrTextContent("Switch Platform"); - public GUIContent build = EditorGUIUtility.TrTextContent("Build"); - public GUIContent buildAndRun = EditorGUIUtility.TrTextContent("Build And Run"); - public GUIContent scenesInBuild = EditorGUIUtility.TrTextContent("Scenes In Build", "Which scenes to include in the build"); - public GUIContent checkOut = EditorGUIUtility.TrTextContent("Check out"); - public GUIContent addOpenSource = EditorGUIUtility.TrTextContent("Add Open Scenes"); + public GUIContent platformTitle = L10n.TextContent("Platform", "Which platform to build for", null, null); + public GUIContent switchPlatform = L10n.TextContent("Switch Platform", null, null, null); + public GUIContent build = L10n.TextContent("Build", null, null, null); + public GUIContent buildAndRun = L10n.TextContent("Build And Run", null, null, null); + public GUIContent scenesInBuild = L10n.TextContent("Scenes In Build", "Which scenes to include in the build", null, null); + public GUIContent checkOut = L10n.TextContent("Check out", null, null, null); + public GUIContent addOpenSource = L10n.TextContent("Add Open Scenes", null, null, null); public string noModuleLoaded = L10n.Tr("No {0} module loaded.", null); - public GUIContent openDownloadPage = EditorGUIUtility.TrTextContent("Open Download Page"); - public GUIContent installModuleWithHub = EditorGUIUtility.TrTextContent("Install with Unity Hub"); + public GUIContent openDownloadPage = L10n.TextContent("Open Download Page", null, null, null); + public GUIContent installModuleWithHub = L10n.TextContent("Install with Unity Hub", null, null, null); public string EditorWillNeedToBeReloaded = L10n.Tr("Note: Editor will need to be restarted to load any newly installed modules", null); public string infoText = L10n.Tr("{0} is not included in your Unity Pro license. Your {0} build will include a Unity Personal Edition splash screen.\n\nYou must be eligible to use Unity Personal Edition to use this build option. Please refer to our EULA for further information.", null); - public GUIContent eula = EditorGUIUtility.TrTextContent("Eula"); + public GUIContent eula = L10n.TextContent("Eula", null, null, null); public string addToYourPro = L10n.Tr("Add {0} to your Unity Pro license", null); - public GUIContent installInBuildFolder = EditorGUIUtility.TrTextContent("Install into source code 'build' folder", "Install into source checkout 'build' folder, for debugging with source code"); + public GUIContent installInBuildFolder = L10n.TextContent("Install into source code 'build' folder", "Install into source checkout 'build' folder, for debugging with source code", null, null); public Texture2D activePlatformIcon = EditorGUIUtility.IconContent("BuildSettings.SelectedIcon").image as Texture2D; @@ -70,31 +70,31 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target) } // string and matching enum values for standalone subtarget dropdowm - public GUIContent debugBuild = EditorGUIUtility.TrTextContent("Development Build"); - public GUIContent autoconnectProfiler = EditorGUIUtility.TrTextContent("Autoconnect Profiler", "When the build is started, an open Profiler Window will automatically connect to the Player and start profiling. The \"Build And Run\" option will also automatically open the Profiler Window."); - public GUIContent autoconnectProfilerDisabled = EditorGUIUtility.TrTextContent("Autoconnect Profiler", "Profiling is only enabled in a Development Player."); - public GUIContent buildWithDeepProfiler = EditorGUIUtility.TrTextContent("Deep Profiling Support", "Build Player with Deep Profiling Support. This might affect Player performance."); - public GUIContent buildWithDeepProfilerDisabled = EditorGUIUtility.TrTextContent("Deep Profiling Support", "Profiling is only enabled in a Development Player."); - public GUIContent allowDebugging = EditorGUIUtility.TrTextContent("Script Debugging", "Enable this setting to allow your script code to be debugged."); - public GUIContent waitForManagedDebugger = EditorGUIUtility.TrTextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution. Can also use volume Up or Down button to confirm on Android."); - public GUIContent managedDebuggerFixedPort = EditorGUIUtility.TrTextContent("Managed Debugger Fixed Port", "Use the specified port to attach to the managed debugger. If 0, the port will be automatically selected."); - public GUIContent explicitNullChecks = EditorGUIUtility.TrTextContent("Explicit Null Checks"); - public GUIContent explicitDivideByZeroChecks = EditorGUIUtility.TrTextContent("Divide By Zero Checks"); - public GUIContent explicitArrayBoundsChecks = EditorGUIUtility.TrTextContent("Array Bounds Checks"); - public GUIContent learnAboutUnityCloudBuild = EditorGUIUtility.TrTextContent("Learn about Unity Build Automation"); - public GUIContent compressionMethod = EditorGUIUtility.TrTextContent("Compression Method", "Compression applied to Player data (scenes and resources).\nDefault - none or default platform compression.\nLZ4 - fast compression suitable for Development Builds.\nLZ4HC - higher compression rate variance of LZ4, causes longer build times. Works best for Release Builds."); - - public readonly GUIContent assetImportOverrides = EditorGUIUtility.TrTextContent("Asset Import Overrides", "Asset import overrides for local development. Reducing maximum texture size or compression settings can speed up asset imports and platform switches."); - public readonly GUIContent maxTextureSize = EditorGUIUtility.TrTextContent("Max Texture Size", "Maximum texture import size for local development. Reducing maximum texture size can speed up asset imports and platform switches."); + public GUIContent debugBuild = L10n.TextContent("Development Build", null, null, null); + public GUIContent autoconnectProfiler = L10n.TextContent("Autoconnect Profiler", "When the build is started, an open Profiler Window will automatically connect to the Player and start profiling. The \"Build And Run\" option will also automatically open the Profiler Window.", null, null); + public GUIContent autoconnectProfilerDisabled = L10n.TextContent("Autoconnect Profiler", "Profiling is only enabled in a Development Player.", null, null); + public GUIContent buildWithDeepProfiler = L10n.TextContent("Deep Profiling Support", "Build Player with Deep Profiling Support. This might affect Player performance.", null, null); + public GUIContent buildWithDeepProfilerDisabled = L10n.TextContent("Deep Profiling Support", "Profiling is only enabled in a Development Player.", null, null); + public GUIContent allowDebugging = L10n.TextContent("Script Debugging", "Enable this setting to allow your script code to be debugged.", null, null); + public GUIContent waitForManagedDebugger = L10n.TextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution. Can also use volume Up or Down button to confirm on Android.", null, null); + public GUIContent managedDebuggerFixedPort = L10n.TextContent("Managed Debugger Fixed Port", "Use the specified port to attach to the managed debugger. If 0, the port will be automatically selected.", null, null); + public GUIContent explicitNullChecks = L10n.TextContent("Explicit Null Checks", null, null, null); + public GUIContent explicitDivideByZeroChecks = L10n.TextContent("Divide By Zero Checks", null, null, null); + public GUIContent explicitArrayBoundsChecks = L10n.TextContent("Array Bounds Checks", null, null, null); + public GUIContent learnAboutUnityCloudBuild = L10n.TextContent("Learn about Unity Build Automation", null, null, null); + public GUIContent compressionMethod = L10n.TextContent("Compression Method", "Compression applied to Player data (scenes and resources).\nDefault - none or default platform compression.\nLZ4 - fast compression suitable for Development Builds.\nLZ4HC - higher compression rate variance of LZ4, causes longer build times. Works best for Release Builds.", null, null); + + public readonly GUIContent assetImportOverrides = L10n.TextContent("Asset Import Overrides", "Asset import overrides for local development. Reducing maximum texture size or compression settings can speed up asset imports and platform switches.", null, null); + public readonly GUIContent maxTextureSize = L10n.TextContent("Max Texture Size", "Maximum texture import size for local development. Reducing maximum texture size can speed up asset imports and platform switches.", null, null); public readonly GUIContent[] maxTextureSizeLabels = { - EditorGUIUtility.TrTextContent("No Override", "Use maximum texture size as specified in per-texture import settings."), - EditorGUIUtility.TrTextContent("Max 2048", "Make imported textures never exceed 2048 pixels in width or height."), - EditorGUIUtility.TrTextContent("Max 1024", "Make imported textures never exceed 1024 pixels in width or height."), - EditorGUIUtility.TrTextContent("Max 512", "Make imported textures never exceed 512 pixels in width or height."), - EditorGUIUtility.TrTextContent("Max 256", "Make imported textures never exceed 256 pixels in width or height."), - EditorGUIUtility.TrTextContent("Max 128", "Make imported textures never exceed 128 pixels in width or height."), - EditorGUIUtility.TrTextContent("Max 64", "Make imported textures never exceed 64 pixels in width or height."), + L10n.TextContent("No Override", "Use maximum texture size as specified in per-texture import settings.", null, null), + L10n.TextContent("Max 2048", "Make imported textures never exceed 2048 pixels in width or height.", null, null), + L10n.TextContent("Max 1024", "Make imported textures never exceed 1024 pixels in width or height.", null, null), + L10n.TextContent("Max 512", "Make imported textures never exceed 512 pixels in width or height.", null, null), + L10n.TextContent("Max 256", "Make imported textures never exceed 256 pixels in width or height.", null, null), + L10n.TextContent("Max 128", "Make imported textures never exceed 128 pixels in width or height.", null, null), + L10n.TextContent("Max 64", "Make imported textures never exceed 64 pixels in width or height.", null, null), }; public readonly int[] maxTextureSizeValues = { @@ -108,10 +108,10 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target) }; public readonly GUIContent[] textureCompressionLabels = { - EditorGUIUtility.TrTextContent("No Override", "Do not modify texture import compression settings."), - EditorGUIUtility.TrTextContent("Force Fast Compressor", "Use a faster but lower quality texture compression mode for all compressed textures. Turn off Crunch compression."), - EditorGUIUtility.TrTextContent("Force Uncompressed", "Do not compress textures."), - EditorGUIUtility.TrTextContent("Force No Crunch", "Disable crunch compression on textures.") + L10n.TextContent("No Override", "Do not modify texture import compression settings.", null, null), + L10n.TextContent("Force Fast Compressor", "Use a faster but lower quality texture compression mode for all compressed textures. Turn off Crunch compression.", null, null), + L10n.TextContent("Force Uncompressed", "Do not compress textures.", null, null), + L10n.TextContent("Force No Crunch", "Disable crunch compression on textures.", null, null) }; public readonly int[] textureCompressionValues = { @@ -121,8 +121,8 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target) (int)OverrideTextureCompression.ForceNoCrunchCompression }; - public readonly GUIContent textureCompression = EditorGUIUtility.TrTextContent("Texture Compression", "Texture compression override for local development. Fast or Uncompressed can speed up asset imports and platform switches."); - public readonly GUIContent applyOverrides = EditorGUIUtility.TrTextContent("Apply Overrides", "Apply asset import override settings"); + public readonly GUIContent textureCompression = L10n.TextContent("Texture Compression", "Texture compression override for local development. Fast or Uncompressed can speed up asset imports and platform switches.", null, null); + public readonly GUIContent applyOverrides = L10n.TextContent("Apply Overrides", "Apply asset import override settings", null, null); public Compression[] compressionTypes = { @@ -133,9 +133,9 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target) public GUIContent[] compressionStrings = { - EditorGUIUtility.TrTextContent("Default"), - EditorGUIUtility.TrTextContent("LZ4"), - EditorGUIUtility.TrTextContent("LZ4HC"), + L10n.TextContent("Default", null, null, null), + L10n.TextContent("LZ4", null, null, null), + L10n.TextContent("LZ4HC", null, null, null), }; [NoAutoStaticsCleanup] // GUIStyle wrapping EditorStyles.foldout; survives code reload @@ -240,7 +240,7 @@ public BuildPlayerWindow() s_CurrOverrideMaxTextureSize = -1; minSize = new Vector2(640, 580); position = new Rect(50, 50, minSize.x, minSize.y); - titleContent = EditorGUIUtility.TrTextContent("Build Settings"); + titleContent = L10n.TextContent("Build Settings", null, null, null); } BuildPlayerSceneTreeView m_TreeView; @@ -420,7 +420,7 @@ void ActiveBuildTargetsGUI() // Switch build target BuildTarget selectedTarget = EditorUserBuildSettingsUtils.CalculateSelectedBuildTarget(); GUI.enabled = BuildPipeline.IsBuildPlatformSupported(selectedTarget); - if (GUILayout.Button(EditorGUIUtility.TrTextContent("Player Settings..."), GUILayout.Width(Styles.kButtonWidth))) + if (GUILayout.Button(L10n.TextContent("Player Settings...", null, null, null), GUILayout.Width(Styles.kButtonWidth))) { SettingsService.OpenProjectSettings("Project/Player"); GUIUtility.ExitGUI(); @@ -447,7 +447,7 @@ void ShowAlert() GUILayout.BeginHorizontal(); GUILayout.Space(10); GUILayout.BeginVertical(); - EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("Unable to access Unity services. Please log in, or request membership to this project to use these services.").text, MessageType.Warning); + EditorGUILayout.HelpBox(L10n.TextContent("Unable to access Unity services. Please log in, or request membership to this project to use these services.", null, null, null).text, MessageType.Warning); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.EndHorizontal(); diff --git a/Editor/Mono/BuildProfile/BuildProfile.API.cs b/Editor/Mono/BuildProfile/BuildProfile.API.cs index edb0763f4b..0ed16aab69 100644 --- a/Editor/Mono/BuildProfile/BuildProfile.API.cs +++ b/Editor/Mono/BuildProfile/BuildProfile.API.cs @@ -43,16 +43,12 @@ public static void SetActiveBuildProfile(BuildProfile buildProfile) /// /// Returns the newly created ScriptableObect. /// - /// Thrown when a sub asset of the same type already exists in the build profile. + /// Thrown when a component of the same type already exists in the build profile. /// [VisibleToOtherModules] public T CreateComponent() where T : UnityEngine.Object { - var found = GetComponent(); - if (found != null) - { - throw new ArgumentException($"The component {typeof(T).Name} already exists in the build profile {name}."); - } + ThrowIfComponentExists(typeof(T)); var type = typeof(T); if (type.IsSubclassOf(typeof(ScriptableObject))) @@ -80,27 +76,31 @@ public T GetComponent() where T : UnityEngine.Object return s_GlobalPlayerSettings as T; } - var path = AssetDatabase.GetAssetPath(this); - var objectsFound = AssetDatabase.LoadAllAssetsAtPath(path); - foreach (var obj in objectsFound) - { - if (obj is T component) - { - return component; - } - } + var found = FindComponentObject(typeof(T)); + if (found is null) + return null; - return null; + // A reference component resolves to its referenced asset; an unassigned/orphaned proxy + // resolves to null and is treated as if the component was not added. + return found is ReferencedComponent proxy ? proxy.reference as T : found as T; } /// - /// Adds a given component to the build profile. If the component is not an asset in - /// the project, it will be added as a sub-asset to the build profile. + /// Adds a component to the build profile, either as a subasset or as a reference to an existing project asset. /// - /// Component type - /// - /// Thrown when objectToAdd is null. - /// Thrown if adding a sub-asset of an existing component type. + /// + /// How the component is stored depends on whether already exists as a + /// project asset. An object that isn't a project asset becomes a hidden subasset of the build profile, + /// and the profile owns it. An object that's already a project asset stays where it is, and the profile + /// stores a reference to it instead. + /// + /// A build profile holds at most one component of each type. + /// + /// The type of the component to add. + /// The object to add to the build profile. + /// Thrown when is null. + /// Thrown when the build profile already contains a component of + /// type . public void AddComponent(T objectToAdd) where T : UnityEngine.Object { if (objectToAdd == null) @@ -108,23 +108,19 @@ public void AddComponent(T objectToAdd) where T : UnityEngine.Object throw new ArgumentNullException(nameof(objectToAdd), "The object to add cannot be null."); } - // Don't allow duplicates - var found = GetComponent(); - if (found != null) - { - throw new ArgumentException($"The component {typeof(T).Name} already exists in the build profile {name}."); - } + ThrowIfComponentExists(typeof(T)); - var assetPath = AssetDatabase.GetAssetPath(objectToAdd); - if (string.IsNullOrEmpty(assetPath)) + if (!AssetDatabase.Contains(objectToAdd)) { objectToAdd.hideFlags |= HideFlags.HideInHierarchy; AssetDatabase.AddObjectToAsset(objectToAdd, this); return; } - // TODO: Future API will support build profile components as reference. - throw new InvalidOperationException($"Asset {objectToAdd} has a non-null path. Build profile components should be sub-assets."); + if (objectToAdd is not ScriptableObject referenceAsset) + throw new InvalidOperationException($"Referenced build profile components must be ScriptableObjects; {objectToAdd} is not."); + + CreateReferenceProxy(typeof(T), referenceAsset); } /// @@ -132,22 +128,26 @@ public void AddComponent(T objectToAdd) where T : UnityEngine.Object /// public void RemoveComponent() where T : UnityEngine.Object { - var found = GetComponent(); - if (found == null) + var toRemove = FindComponentObject(typeof(T)); + if (toRemove == null) { Debug.LogWarning($"The component {typeof(T).Name} does not exist in the build profile {name}. "); return; } - if (Array.IndexOf(this.requiredComponents, found) > -1) + if (Array.IndexOf(requiredComponents, toRemove) > -1) throw new ArgumentException($"The component {typeof(T).Name} is required and cannot be removed from the build profile {name}."); - AssetDatabase.RemoveObjectFromAsset(found); + AssetDatabase.RemoveObjectFromAsset(toRemove); } /// /// Removes a specific component from the build profile. /// + /// + /// Passing an object that the profile holds by reference removes the proxy sub-asset linking to + /// it; the referenced object itself stays on disk. + /// /// Object to remove. /// objectToRemove is null. /// objectToRemove is not part of the build profile. @@ -158,35 +158,79 @@ public void RemoveComponent(T objectToRemove) where T : UnityEngine.Object throw new ArgumentNullException(nameof(objectToRemove), "The object to remove cannot be null."); } - var path = AssetDatabase.GetAssetPath(this); - var objectToRemovePath = AssetDatabase.GetAssetPath(objectToRemove); - - if (objectToRemovePath != path) + // A profile holds at most one component per type, so a reference component of type T is the + // proxy pointing at objectToRemove; the proxy is the sub-asset that belongs to the profile. + var toRemove = FindComponentObject(typeof(T)); + if (toRemove is ReferencedComponent proxy) + { + if (proxy.reference != objectToRemove) + { + throw new ArgumentException($"The object {objectToRemove} is not the reference for the build profile component of type {typeof(T).Name}."); + } + } + else if (toRemove != objectToRemove) { + var objectToRemovePath = AssetDatabase.GetAssetPath(objectToRemove); + var path = AssetDatabase.GetAssetPath(this); throw new ArgumentException($"The object {objectToRemove} (path: {objectToRemovePath}) is not part of the build profile {path}."); } - if (Array.IndexOf(this.requiredComponents, objectToRemove) > -1) + if (Array.IndexOf(requiredComponents, objectToRemove) > -1) throw new ArgumentException($"The component {typeof(T).Name} is required and cannot be removed from the build profile {name}."); - AssetDatabase.RemoveObjectFromAsset(objectToRemove); + AssetDatabase.RemoveObjectFromAsset(toRemove); + } + + /// + /// Adds a reference to a standalone on-disk settings asset, or an unassigned reference when + /// is null. + /// + /// Thrown when a component of the same type already exists. + /// Thrown when a non-null reference is not an on-disk asset. + internal void AddReferenceComponent(Type componentType, ScriptableObject reference) + { + ThrowIfComponentExists(componentType); + ThrowIfNotOnDisk(reference); + + CreateReferenceProxy(componentType, reference); + } + + /// + /// Reassigns an existing reference component's source in place, preserving the proxy sub-asset. + /// A null reference leaves the component present but unassigned. The caller is responsible for + /// ensuring the reference component exists; use to add one. + /// + /// + /// Thrown when a non-null reference is not an on-disk asset, or when no reference component of + /// exists. + /// + internal void SetReferenceComponent(Type componentType, ScriptableObject reference) + { + ThrowIfNotOnDisk(reference); + + var proxy = FindReferenceProxy(componentType); + if (proxy == null) + throw new InvalidOperationException($"No reference component of type {componentType.Name} exists in the build profile {name}. Add it before setting its reference."); + + Undo.RecordObject(proxy, "Set Settings Source"); + proxy.reference = reference; + EditorUtility.SetDirty(proxy); } /// /// Forcibly removes the first occurrence of a component of type T from the build profile. - /// For internal use only to accommodate required components. /// [VisibleToOtherModules] internal void ForceRemoveComponent() where T : UnityEngine.Object { - var found = GetComponent(); - if (found == null) + var toRemove = FindComponentObject(typeof(T)); + if (toRemove == null) { Debug.LogWarning($"The component {typeof(T).Name} does not exist in the build profile {name}. "); return; } - AssetDatabase.RemoveObjectFromAsset(found); + AssetDatabase.RemoveObjectFromAsset(toRemove); } /// @@ -206,5 +250,73 @@ public static T GetActiveComponent() where T : UnityEngine.Object return buildProfile.GetComponent(); } + + UnityEngine.Object[] LoadAllComponentObjects() + { + var path = AssetDatabase.GetAssetPath(this); + return AssetDatabase.LoadAllAssetsAtPath(path); + } + + UnityEngine.Object FindComponentObject(Type componentType) + { + foreach (var obj in LoadAllComponentObjects()) + { + if (IsComponentOfType(obj, componentType)) + return obj; + } + + return null; + } + + void ThrowIfComponentExists(Type componentType) + { + if (HasComponentOfType(componentType)) + throw new ArgumentException($"The component {componentType.Name} already exists in the build profile {name}."); + } + + static void ThrowIfNotOnDisk(ScriptableObject reference) + { + if (reference != null && !AssetDatabase.Contains(reference)) + throw new InvalidOperationException($"Expected on-disk asset for {reference}."); + } + + ReferencedComponent CreateReferenceProxy(Type componentType, ScriptableObject reference) + { + var proxy = ScriptableObject.CreateInstance(); + proxy.hideFlags = HideFlags.HideInHierarchy; + proxy.name = componentType.Name; + proxy.reference = reference; + proxy.referenceType = componentType; + AssetDatabase.AddObjectToAsset(proxy, this); + return proxy; + } + + ReferencedComponent FindReferenceProxy(Type componentType) + { + foreach (var obj in LoadAllComponentObjects()) + { + if (obj is ReferencedComponent proxy && proxy.Matches(componentType)) + return proxy; + } + + return null; + } + + bool HasComponentOfType(Type componentType) + { + if (componentType == typeof(PlayerSettings)) + return m_PlayerSettings != null || s_GlobalPlayerSettings != null; + + return FindComponentObject(componentType) is not null; + } + + /// + /// Returns true when a component of type T is present, including an unassigned reference + /// whose source has not been set. + /// + internal bool HasComponent() where T : UnityEngine.Object => HasComponentOfType(typeof(T)); + + static bool IsComponentOfType(UnityEngine.Object obj, Type componentType) => + componentType.IsInstanceOfType(obj) || (obj is ReferencedComponent proxy && proxy.Matches(componentType)); } } diff --git a/Editor/Mono/BuildProfile/BuildProfile.Create.cs b/Editor/Mono/BuildProfile/BuildProfile.Create.cs index e933bac814..d2322150b7 100644 --- a/Editor/Mono/BuildProfile/BuildProfile.Create.cs +++ b/Editor/Mono/BuildProfile/BuildProfile.Create.cs @@ -134,7 +134,7 @@ public static BuildProfile CreateBuildProfile( BuildProfileModuleUtil.EnsureCustomBuildProfileFolderExists(); string assetPath = BuildProfileModuleUtil.GetProfilePathWithProvidedName(platformId, profileName); - var packagesToInstall = BuildTargetDiscovery.GetAllMissingRequiredPlatformPackageNames(platformId); + var packagesToInstall = BuildTargetDiscovery.GetAllMissingRequiredPlatformPackageIdentifiers(platformId); return CreateInstance(platformId, assetPath, -1, packagesToInstall, onProfileReady); } @@ -146,7 +146,7 @@ public static BuildProfile CreateBuildProfile( [VisibleToOtherModules("UnityEditor.BuildProfileModule")] internal static BuildProfile CreateInstance(GUID platformId, string assetPath) { - return CreateInstance(platformId, assetPath, -1, Array.Empty()); + return CreateInstance(platformId, assetPath, -1, Array.Empty()); } [VisibleToOtherModules("UnityEditor.BuildProfileModule")] @@ -154,7 +154,7 @@ internal static BuildProfile CreateInstance( GUID platformId, string assetPath, int preconfiguredSettingsVariant, - string[] packagesToAdd, + BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd, UnityAction onProfileReady = null, GUID selectedPlatformGuid = default) { diff --git a/Editor/Mono/BuildProfile/BuildProfileContext.cs b/Editor/Mono/BuildProfile/BuildProfileContext.cs index 1ef316fcdb..9e70204b06 100644 --- a/Editor/Mono/BuildProfile/BuildProfileContext.cs +++ b/Editor/Mono/BuildProfile/BuildProfileContext.cs @@ -34,6 +34,9 @@ internal sealed partial class BuildProfileContext : ScriptableObject const string k_BuildProfilePath = "Library/BuildProfiles"; const string k_SharedProfilePath = $"{k_BuildProfilePath}/SharedProfile.asset"; [AutoStaticsCleanupOnCodeReload] + // Singleton cache: the instance getter loads or creates the context when this is null, and the + // constructor assigns it back when the ScriptableObject is reconstructed. + [IgnoreForUAL0015("Singleton cache reloaded or recreated on demand by the instance getter")] static BuildProfileContext s_Instance; bool m_Initializing; @@ -326,7 +329,7 @@ internal BuildProfile GetForClassicPlatform(GUID platformGuid) internal void RegisterProfileAwaitingInitialization( BuildProfile profile, - string[] packagesToAdd, + BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd, int preconfiguredSettingsVariant, UnityAction onProfileCreated) { @@ -949,8 +952,11 @@ static string GetActiveProfileDefaultQualityLevel() return activeProfile.qualitySettings.defaultQualityLevel; } + // Every field of the struct has to travel through here, or a native write drops the ones left + // out: the settings are rebuilt from these arguments, not merged into the existing ones. + // Counts and enums cross as int, which is what the proxy generator supports for by-ref values. [RequiredByNativeCode, UsedImplicitly] - static bool SetActiveShaderBuildSettings(ShaderBuildSettings.KeywordDeclarationOverride[] keywordDeclarationOverrides, string[] defines, ShaderBuildSettings.ShaderCompilerSettings[] compilerSettings) + static bool SetActiveShaderBuildSettings(ShaderBuildSettings.KeywordDeclarationOverride[] keywordDeclarationOverrides, string[] defines, int numInternalDefines, ShaderBuildSettings.ShaderCompilerSettings[] compilerSettings, int fastBuildMode) { if (!ActiveProfileHasGraphicsSettings()) return false; @@ -959,26 +965,32 @@ static bool SetActiveShaderBuildSettings(ShaderBuildSettings.KeywordDeclarationO { keywordDeclarationOverrides = keywordDeclarationOverrides, defines = defines, - compilerSettings = compilerSettings + numInternalDefines = (uint)numInternalDefines, + compilerSettings = compilerSettings, + fastBuildMode = (ShaderBuildSettings.FastBuildMode)fastBuildMode }; return true; } [RequiredByNativeCode, UsedImplicitly] - static void GetActiveShaderBuildSettings(out ShaderBuildSettings.KeywordDeclarationOverride[] keywordDeclarationOverrides, out string[] defines, out ShaderBuildSettings.ShaderCompilerSettings[] compilerSettings) + static void GetActiveShaderBuildSettings(out ShaderBuildSettings.KeywordDeclarationOverride[] keywordDeclarationOverrides, out string[] defines, out int numInternalDefines, out ShaderBuildSettings.ShaderCompilerSettings[] compilerSettings, out int fastBuildMode) { if (!ActiveProfileHasGraphicsSettings()) { keywordDeclarationOverrides = null; defines = null; + numInternalDefines = 0; compilerSettings = null; + fastBuildMode = (int)ShaderBuildSettings.FastBuildMode.Off; return; } var shaderBuildSettings = activeProfile.graphicsSettings.shaderBuildSettings; keywordDeclarationOverrides = shaderBuildSettings.keywordDeclarationOverrides; defines = shaderBuildSettings.defines; + numInternalDefines = (int)shaderBuildSettings.numInternalDefines; compilerSettings = shaderBuildSettings.compilerSettings; + fastBuildMode = (int)shaderBuildSettings.fastBuildMode; } // Lets native code check whether its shader build settings snapshot is stale without marshalling the data. diff --git a/Editor/Mono/BuildProfile/BuildProfileEntitlementClaimInfo.cs b/Editor/Mono/BuildProfile/BuildProfileEntitlementClaimInfo.cs new file mode 100644 index 0000000000..6eca386805 --- /dev/null +++ b/Editor/Mono/BuildProfile/BuildProfileEntitlementClaimInfo.cs @@ -0,0 +1,402 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using UnityEditor.Connect; +using UnityEditor.Marketplace; +using UnityEngine; +using UnityEngine.Bindings; + +namespace UnityEditor.Build.Profile +{ + /// + /// Asset Store entitlement claim tracker for build profile initialization. Claims run before the + /// package install request, so a package gated behind an entitlement the user does not hold can + /// still be installed. + /// + [Serializable] + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + class BuildProfileEntitlementClaimInfo + { + public Action OnClaimRequestComplete; + public enum Status + { + Pending, + Processing, + Granted, + Failed, + } + + public enum Failure + { + None, + + /// + /// The product endpoint has no product for the package. Expected for packages + /// that are not Asset Store products or is missing from the endpoint's whitelist. + /// + NoProduct, + + Rejected, + ServiceError, + Transport, + Timeout, + NoOrganization, + } + + [Serializable] + public class Claim + { + public string packageName; + + /// + /// Marketplace product ID to claim against. Empty until the entry is resolved. + /// + public string productId; + + /// + /// Whether the package is classified (e.g., Asset Store vs. registry package). + /// + public bool isClassified; + + public Status status; + public Failure failure; + public string detail; + } + + const int k_SessionTimeoutSeconds = 90; + const int k_RetryDelaySeconds = 1; + const int k_AttemptTimeoutSeconds = 30; + + /// + /// Claims to make, one per package. + /// + [SerializeField] + public Claim[] claims = Array.Empty(); + + /// + /// Wall clock tick the claim session expires at. + /// + [SerializeField] + internal long m_SessionTicks; + + internal long m_NextAttemptTicks; + + Task m_InFlightClaim; + internal Task inFlightClaim => m_InFlightClaim; + CancellationTokenSource m_Cancellation; + + bool m_CallbacksSubscribed; + + IPackageServiceInfoProvider m_Provider; + + /// + /// Only a test-injected provider is stored. The shared one is read through on every access, + /// because UAL0018 forbids capturing it into a field. + /// + internal IPackageServiceInfoProvider provider + { + get => m_Provider ?? BuildProfileContext.packageServiceInfoProvider; + set => m_Provider = value; + } + + internal static BuildProfileEntitlementClaimInfo Create( + BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd, + IPackageServiceInfoProvider providerOverride = null) + { + var provider = providerOverride ?? BuildProfileContext.packageServiceInfoProvider; + var claims = new List(); + + foreach (var package in packagesToAdd) + { + var packageName = package.name; + + if (!provider.HasPackageInfo(packageName)) + { + claims.Add(new Claim { packageName = packageName }); + continue; + } + + if (!provider.IsAssetStorePackage(packageName)) + continue; + + if (provider.HasMarketplaceEntitlement(packageName) == true) + continue; + + claims.Add(new Claim + { + packageName = packageName, + productId = provider.GetMarketplaceProductId(packageName), + isClassified = true, + }); + } + + return claims.Count == 0 + ? null + : new BuildProfileEntitlementClaimInfo { claims = claims.ToArray(), provider = providerOverride }; + } + + /// + /// Begins or resumes claiming entitlements. + /// + public void RequestEntitlementClaims() + { + if (m_CallbacksSubscribed || IsClaimRequestDone()) + return; + + if (m_SessionTicks == 0) + m_SessionTicks = DateTime.UtcNow.Ticks + TimeSpan.FromSeconds(k_SessionTimeoutSeconds).Ticks; + + EditorApplication.update += ProcessClaims; + AssemblyReloadEvents.beforeAssemblyReload += UnsubscribeRequestCallbacks; + m_CallbacksSubscribed = true; + } + + /// + /// Check if all claim requests are completed. + /// + public bool IsClaimRequestDone() => NextOutstandingClaim() == null; + + /// + /// Whether the package is known to be installable: the entitlement is held, + /// the package is not an Asset Store product and so needs none, or it was never + /// classified because the lookup that would have classified it failed. + /// + public bool IsPackageInstallable(string packageName) + { + foreach (var claim in claims) + { + if (claim.packageName != packageName) + continue; + + if (claim.status == Status.Granted) + return true; + + if (claim.status != Status.Failed) + return false; + + return claim.failure == Failure.NoProduct || !claim.isClassified; + } + + return true; + } + + public void Cleanup() + { + UnsubscribeRequestCallbacks(); + OnClaimRequestComplete = null; + } + + /// + /// Detaches the editor update loop and the domain-reload hook, and abandons any request in + /// flight. + /// + void UnsubscribeRequestCallbacks() + { + if (!m_CallbacksSubscribed) + return; + + m_CallbacksSubscribed = false; + AssemblyReloadEvents.beforeAssemblyReload -= UnsubscribeRequestCallbacks; + EditorApplication.update -= ProcessClaims; + m_Cancellation?.Cancel(); + } + + internal void ProcessClaims() + { + var claim = NextOutstandingClaim(); + if (claim == null) + { + FinishClaimRequest(); + return; + } + + // Checked before the deadline, so it cannot fail an entry a running request is about to + // resolve. + if (m_InFlightClaim != null) + return; + + var now = DateTime.UtcNow.Ticks; + if (now >= m_SessionTicks) + { + FailOutstandingClaims(Failure.Timeout); + FinishClaimRequest(); + return; + } + + if (now < m_NextAttemptTicks) + return; + + var attempt = AttemptClaimAsync(claim); + if (!attempt.IsCompleted) + m_InFlightClaim = attempt; + } + + void FinishClaimRequest() + { + UnsubscribeRequestCallbacks(); + OnClaimRequestComplete?.Invoke(); + } + + async Task AttemptClaimAsync(Claim claim) + { + m_Cancellation = new CancellationTokenSource(); + m_Cancellation.CancelAfter(TimeSpan.FromSeconds(k_AttemptTimeoutSeconds)); + + var isClaimAttempt = !string.IsNullOrEmpty(claim.productId); + + try + { + if (isClaimAttempt) + await PostClaimAsync(claim, m_Cancellation.Token); + else + await ResolveProductIdAsync(claim, m_Cancellation.Token); + } + catch (OperationCanceledException) + { + // Timed out, or aborted by a domain reload. Either way the entry is untouched, so the + // next tick retries it until the deadline. + } + catch (NoOrganizationIdException exception) + { + FailOutstandingClaims(Failure.NoOrganization); + Debug.LogError("Could not claim the Asset Store entitlements: " + exception.Message); + FinishClaimRequest(); + } + catch (MarketplaceApiException exception) + { + // Only a claim the service answered can be a refusal. A failed product lookup is the + // metadata call and says nothing about entitlement. + SetClaimFailed(claim, isClaimAttempt && exception.error.status < 500 ? Failure.Rejected : Failure.ServiceError); + claim.detail = exception.Message; + LogClaimFailure(claim); + } + catch (UnityConnectWebRequestException exception) + { + SetClaimFailed(claim, Failure.Transport); + claim.detail = exception.Message; + LogClaimFailure(claim); + } + catch (Exception exception) + { + SetClaimFailed(claim, Failure.ServiceError); + claim.detail = exception.Message; + LogClaimFailure(claim); + } + finally + { + m_Cancellation?.Dispose(); + m_Cancellation = null; + m_InFlightClaim = null; + } + } + + async Task ResolveProductIdAsync(Claim claim, CancellationToken cancellationToken) + { + var productInfo = await AwaitOrAbandon( + provider.GetOrFetchProductInfoAsync(claim.packageName), cancellationToken); + + claim.isClassified = true; + + if (productInfo == null || string.IsNullOrEmpty(productInfo.productId)) + { + SetClaimFailed(claim, Failure.NoProduct); + return; + } + + if (productInfo.entitlement?.hasEntitlement == true) + { + claim.status = Status.Granted; + return; + } + + claim.productId = productInfo.productId; + } + + async Task PostClaimAsync(Claim claim, CancellationToken cancellationToken) + { + var result = await AwaitOrAbandon( + provider.ClaimEntitlementAsync(claim.productId), cancellationToken); + + switch (result.status) + { + case ClaimStatus.Granted: + claim.status = Status.Granted; + break; + + case ClaimStatus.Processing: + claim.status = Status.Processing; + m_NextAttemptTicks = DateTime.UtcNow.Ticks + TimeSpan.FromSeconds(k_RetryDelaySeconds).Ticks; + break; + + default: + SetClaimFailed(claim, Failure.ServiceError); + claim.detail = "The claim service answered with an unrecognized status."; + LogClaimFailure(claim); + break; + } + } + + /// + /// Awaits a gateway request, or abandons it when cancelled. Those requests carry no cancellation + /// token by design, because one may be shared with another caller. Hence, cancel here means + /// leaving the request to finish for whoever else wants it. + /// + static async Task AwaitOrAbandon(Task request, CancellationToken cancellationToken) + { + var cancelled = Task.Delay(Timeout.Infinite, cancellationToken); + if (await Task.WhenAny(request, cancelled) != request) + { + // Once abandoned, nobody may be left to observe a failure on it. + _ = request.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + throw new OperationCanceledException(cancellationToken); + } + + return await request; + } + + static bool IsOutstanding(Claim claim) => claim.status == Status.Pending || claim.status == Status.Processing; + + Claim NextOutstandingClaim() + { + foreach (var claim in claims) + { + if (IsOutstanding(claim)) + return claim; + } + + return null; + } + + void FailOutstandingClaims(Failure failure) + { + foreach (var claim in claims) + { + if (!IsOutstanding(claim)) + continue; + + SetClaimFailed(claim, failure); + LogClaimFailure(claim); + } + } + + static void SetClaimFailed(Claim claim, Failure failure) + { + claim.status = Status.Failed; + claim.failure = failure; + } + + static void LogClaimFailure(Claim claim) + { + if (claim.failure == Failure.NoProduct || claim.failure == Failure.NoOrganization || !claim.isClassified) + return; + + var reason = string.IsNullOrEmpty(claim.detail) ? claim.failure.ToString() : claim.detail; + Debug.LogError($"Could not claim the Asset Store entitlement for '{claim.packageName}': {reason}"); + } + } +} diff --git a/Editor/Mono/BuildProfile/BuildProfileInitialization.cs b/Editor/Mono/BuildProfile/BuildProfileInitialization.cs index c36b8a5dd4..d95751afd4 100644 --- a/Editor/Mono/BuildProfile/BuildProfileInitialization.cs +++ b/Editor/Mono/BuildProfile/BuildProfileInitialization.cs @@ -3,6 +3,7 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; +using System.Collections.Generic; using UnityEngine; using UnityEngine.Bindings; using UnityEngine.Events; @@ -56,6 +57,13 @@ public enum State /// SDK platform extension) is pending. /// AwaitingExtension, + + /// + /// Asset Store entitlements are being claimed for packages that need one before they can + /// install. Entered ahead of , and skipped entirely when + /// there is nothing to claim. + /// + ClaimingEntitlements, } /// @@ -76,6 +84,12 @@ public enum State [SerializeField] public BuildProfilePackageAddInfo packageAddInfo; + /// + /// Asset Store entitlement claim tracker. Null if nothing needs claiming. + /// + [SerializeField] + public BuildProfileEntitlementClaimInfo entitlementClaimInfo; + /// /// Optional callback invoked when the build profile is . /// @@ -110,7 +124,7 @@ public enum State public static BuildProfileInitialization Create( BuildProfile profile, string profileGUID, - string[] packagesToAdd, + BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd, int preconfiguredSettingsVariant, UnityAction onProfileReady) { @@ -126,6 +140,7 @@ public static BuildProfileInitialization Create( { packagesToAdd = packagesToAdd, }; + init.entitlementClaimInfo = BuildProfileEntitlementClaimInfo.Create(packagesToAdd); } if (onProfileReady != null) @@ -194,6 +209,8 @@ public State OnState(BuildProfile profile) { if (RequiresDerivedPlatformActivation(profile)) NextState(State.AwaitingDomainReload, profile); + else if (entitlementClaimInfo != null) + NextState(State.ClaimingEntitlements, profile); else if (packageAddInfo != null) NextState(State.InstallingPackages, profile); else if (!AreRequiredExtensionsAvailable(profile)) @@ -205,6 +222,25 @@ public State OnState(BuildProfile profile) case State.AwaitingDomainReload: if (!m_ReloadPending) { + if (entitlementClaimInfo != null) + NextState(State.ClaimingEntitlements, profile); + else if (packageAddInfo != null) + NextState(State.InstallingPackages, profile); + else if (!AreRequiredExtensionsAvailable(profile)) + NextState(State.AwaitingExtension, profile); + else + NextState(State.Ready, profile); + } + break; + case State.ClaimingEntitlements: + if (entitlementClaimInfo != null && !entitlementClaimInfo.IsClaimRequestDone()) + { + AddEntitlementClaimCallbacks(profile); + entitlementClaimInfo.RequestEntitlementClaims(); + } + else + { + DropPackagesWithoutEntitlements(); if (packageAddInfo != null) NextState(State.InstallingPackages, profile); else if (!AreRequiredExtensionsAvailable(profile)) @@ -282,6 +318,27 @@ static bool RequiresDerivedPlatformActivation(BuildProfile profile) return EditorPrefs.GetInt(platformId.ToString(), 0) == 0; } + /// + /// Removes packages from the install request unless their entitlement is confirmed, or they + /// need none at all. + /// + void DropPackagesWithoutEntitlements() + { + if (packageAddInfo == null || entitlementClaimInfo == null) + return; + + var packages = packageAddInfo.packagesToAdd; + var remaining = new List(packages.Length); + foreach (var package in packages) + { + if (entitlementClaimInfo.IsPackageInstallable(package.name)) + remaining.Add(package); + } + + if (remaining.Count != packages.Length) + packageAddInfo.packagesToAdd = remaining.ToArray(); + } + /// /// Perform one-time actions upon entering a new state. /// @@ -336,6 +393,14 @@ void AddPackageInstallationCallbacks(BuildProfile profile) }; } + /// + /// Sets up the entitlement claim completion callback. Re-attached on domain reload. + /// + void AddEntitlementClaimCallbacks(BuildProfile profile) + { + entitlementClaimInfo.OnClaimRequestComplete = () => BuildProfileContext.instance.UpdateBuildProfileInitialization(profile); + } + /// /// Cleanup internal event handlers and serialized references. /// @@ -346,6 +411,9 @@ void Cleanup() packageAddInfo?.Cleanup(); packageAddInfo = null; + + entitlementClaimInfo?.Cleanup(); + entitlementClaimInfo = null; } bool IsCallbackPersistable(UnityAction callback) => callback.Method.IsStatic || callback.Target is UnityEngine.Object; diff --git a/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs b/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs index 5effe850fa..b6c0c29035 100644 --- a/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs +++ b/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs @@ -49,12 +49,12 @@ internal partial class BuildProfileModuleUtil static readonly string k_DerivedPlatformDisabled = L10n.Tr("{0} was disabled via command-line arguments.", null); static readonly string k_EditorWillNeedToBeReloaded = L10n.Tr("Note: Editor will need to be restarted to load any newly installed modules", null); static readonly string k_BuildProfileRecompileReason = L10n.Tr("Active build profile scripting defines changes.", null); - static readonly GUIContent k_OpenDownloadPage = EditorGUIUtility.TrTextContent("Open Download Page"); - static readonly GUIContent k_InstallModuleWithHub = EditorGUIUtility.TrTextContent("Install with Unity Hub"); + static readonly GUIContent k_OpenDownloadPage = L10n.TextContent("Open Download Page", null, null, null); + static readonly GUIContent k_InstallModuleWithHub = L10n.TextContent("Install with Unity Hub", null, null, null); static readonly string k_ModuleInstalled = L10n.Tr("{0} module has been installed.", null); static readonly string k_RestartNeeded = L10n.Tr("Please restart the Unity Editor to load the module.", null); static readonly string k_RestartEditor = L10n.Tr("Restart Unity Editor", null); - static readonly GUIContent k_ActivateDerivedPlatform = EditorGUIUtility.TrTextContent("Enable Platform"); + static readonly GUIContent k_ActivateDerivedPlatform = L10n.TextContent("Enable Platform", null, null, null); [NoAutoStaticsCleanup] // static config set, allocated once, contains only string literals static readonly HashSet s_BuildProfileIconModules = new() { @@ -405,10 +405,7 @@ public static bool IsStandalonePlatform(BuildTarget buildTarget) => /// public static bool IsBuildTargetSupportedByCoverage(BuildTarget buildTarget) { - if (!IsStandalonePlatform(buildTarget)) - return false; - - if (buildTarget == BuildTarget.StandaloneWindows) + if (!IsPlatformSupportedByCoverage(buildTarget)) return false; var namedBuildTarget = NamedBuildTarget.FromActiveSettings(buildTarget); @@ -417,6 +414,18 @@ public static bool IsBuildTargetSupportedByCoverage(BuildTarget buildTarget) return scriptingBackend == ScriptingImplementation.Mono2x || scriptingBackend == ScriptingImplementation.IL2CPP; } + /// + /// Returns true if the platform can produce coverage instrumented players, + /// regardless of the currently selected scripting backend. + /// + internal static bool IsPlatformSupportedByCoverage(BuildTarget buildTarget) => buildTarget switch + { + // 32-bit Windows standalone is not supported. + BuildTarget.StandaloneWindows => false, + BuildTarget.Android => true, + _ => IsStandalonePlatform(buildTarget) + }; + public static bool IsBuildAutomationSupported(GUID platformGuid) { if (!BuildTargetDiscovery.TryGetBuildTarget(platformGuid, out var iBuildTarget)) @@ -842,7 +851,7 @@ public static void RequestScriptCompilation(BuildProfile profile) /// public static void CreateNewAssetWithName( GUID platformId, string customProfileName, string preconfiguredSettingsVariantName, - int preconfiguredSettingsVariant, string[] packagesToAdd, UnityAction onCreate, + int preconfiguredSettingsVariant, BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd, UnityAction onCreate, GUID selectedPlatformGuid = default) { BuildProfileModuleUtil.EnsureCustomBuildProfileFolderExists(); @@ -937,6 +946,28 @@ internal static void SuppressMissingTypeWarning() SerializationUtility.SuppressMissingTypeWarning(nameof(BuildProfile)); } + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal static void AddReferenceComponent(BuildProfile profile, Type componentType, ScriptableObject reference) + { + profile.AddReferenceComponent(componentType, reference); + } + + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal static bool HasComponent(BuildProfile profile) where T : UnityEngine.Object + { + return profile.HasComponent(); + } + + /// + /// Reassigns an existing reference component's source in place. Throws when the component does + /// not exist; see . + /// + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + internal static void SetReferenceComponent(BuildProfile profile, Type componentType, ScriptableObject reference) + { + profile.SetReferenceComponent(componentType, reference); + } + public static string GetDefaultNewProfilePath(GUID platformGuid) { var platformDisplayName = BuildProfileModuleUtil.GetClassicPlatformDisplayName(platformGuid); @@ -1474,8 +1505,13 @@ public static void InstallRequiredPackagesForClassicProfileIfRequired(BuildProfi var packageName = package.qualifiedName; if (!PackageManager.PackageInfo.IsPackageRegistered(packageName)) { + // The prompt lists bare names; only the install request carries the pinned version. packageStringBuilder.AppendLine().Append(packageName); - neededPackages.Add(packageName); + neededPackages.Add(package.GetPackageIdentifier().GetInstallIdentifier()); + } + else + { + BuildTargetDiscovery.WarnIfPinnedVersionNotInstalled(package.GetPackageIdentifier()); } } diff --git a/Editor/Mono/BuildProfile/BuildProfilePackageAddInfo.cs b/Editor/Mono/BuildProfile/BuildProfilePackageAddInfo.cs index 0040341271..1ce2711fa9 100644 --- a/Editor/Mono/BuildProfile/BuildProfilePackageAddInfo.cs +++ b/Editor/Mono/BuildProfile/BuildProfilePackageAddInfo.cs @@ -30,10 +30,12 @@ public enum ProgressState public record struct ProgressEntry(ProgressState state, string name, int packageCount); /// - /// Packages pending installation. + /// Packages pending installation. Each entry keeps its name and optional pinned version + /// apart, so lookups can match on the name while the install request uses both. /// [field: SerializeField] - public string[] packagesToAdd { get; set; } = Array.Empty(); + public BuildTargetDiscovery.PlatformPackageIdentifier[] packagesToAdd { get; set; } + = Array.Empty(); public Action OnPackageAddProgress; public Action OnPackageAddComplete; @@ -56,7 +58,11 @@ public void RequestPackageInstallation() if (packagesToAdd.Length > 0) { - m_PackageAddRequest = PackageManager.Client.AddAndRemove(packagesToAdd); + var installIdentifiers = new string[packagesToAdd.Length]; + for (int i = 0; i < packagesToAdd.Length; i++) + installIdentifiers[i] = packagesToAdd[i].GetInstallIdentifier(); + + m_PackageAddRequest = PackageManager.Client.AddAndRemove(installIdentifiers); m_PackageAddRequest.progressUpdated += HandlePackageAddProgress; EditorApplication.update += CheckCompletion; @@ -74,7 +80,7 @@ public bool IsPackageRequestDone() { foreach (var package in packagesToAdd) { - if (!PackageManager.PackageInfo.IsPackageRegistered(package)) + if (!PackageManager.PackageInfo.IsPackageRegistered(package.name)) return false; } @@ -121,7 +127,7 @@ bool ContainsPackage(string name) { foreach (var package in packagesToAdd) { - if (package == name) + if (package.name == name) return true; } return false; @@ -137,7 +143,7 @@ void CheckCompletion() if (m_PackageAddRequest.Status >= PackageManager.StatusCode.Failure) Debug.LogError(m_PackageAddRequest.Error.message); - packagesToAdd = Array.Empty(); + packagesToAdd = Array.Empty(); OnPackageAddComplete?.Invoke(); } diff --git a/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.bindings.cs b/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.bindings.cs index 3fa125937d..0c61a0ea4c 100644 --- a/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.bindings.cs +++ b/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.bindings.cs @@ -25,20 +25,31 @@ public BuildProfilePlayerSettings() Internal_Create(this); } - [NativeMethod("GetPlatformGraphicsAPIs")] - internal extern GraphicsDeviceType[] GetGraphicsAPIs(BuildTarget platform); + [NativeMethod("GetPlatformGraphicsAPIsWithUGKVariants")] + internal extern GraphicsDeviceType[] GetGraphicsAPIsWithUGKVariants(BuildTarget platform); + + [NativeMethod("GetPlatformGraphicsAPIUGKFlags")] + internal extern int[] GetGraphicsAPIUGKFlags(BuildTarget platform); [NativeMethod("SetPlatformGraphicsAPIs")] - private extern void SetGraphicsAPIsImpl(BuildTarget platform, GraphicsDeviceType[] apis, bool skipValidation); + private extern void SetGraphicsAPIsImpl(BuildTarget platform, GraphicsDeviceType[] apis, bool skipValidation, int[] ugkFlags); - internal void SetGraphicsAPIs(BuildTarget platform, GraphicsDeviceType[] apis, bool shouldSync) + internal void SetGraphicsAPIs(BuildTarget platform, GraphicsDeviceType[] apis, int[] ugkFlags, bool shouldSync) { - SetGraphicsAPIsImpl(platform, apis, false); + SetGraphicsAPIsImpl(platform, apis, false, ugkFlags); // we do cache api list in player settings editor, so if we update from script we should forcibly update cache if (shouldSync) PlayerSettingsEditor.SyncEditors(platform); } + [NativeMethod("GetPlatformGraphicsAPIs")] + internal extern GraphicsDeviceType[] GetGraphicsAPIs(BuildTarget platform); + + internal void SetGraphicsAPIs(BuildTarget platform, GraphicsDeviceType[] apis, bool shouldSync) + { + SetGraphicsAPIs(platform, apis, null, shouldSync); + } + [NativeMethod("GetPlatformAutomaticGraphicsAPIs")] internal extern bool GetUseDefaultGraphicsAPIs(BuildTarget platform); diff --git a/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.cs b/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.cs index f4931d1d33..90b4f35636 100644 --- a/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.cs +++ b/Editor/Mono/BuildProfile/BuildProfilePlayerSettings.cs @@ -99,6 +99,9 @@ internal void Clear() const string k_ProjectSettingsAssetPath = "ProjectSettings/ProjectSettings.asset"; [AutoStaticsCleanupOnCodeReload] + // Handle to the global player settings object; TryLoadProjectSettingsAssetPlayerSettings fetches + // it again on the next access while it is null. + [IgnoreForUAL0015("Lazily re-fetched by TryLoadProjectSettingsAssetPlayerSettings when null")] static PlayerSettings s_GlobalPlayerSettings; [AutoStaticsCleanupOnCodeReload] diff --git a/Editor/Mono/BuildProfile/BuildProfilePlayerSettingsEditor.cs b/Editor/Mono/BuildProfile/BuildProfilePlayerSettingsEditor.cs index 6c19f7500e..566e14c100 100644 --- a/Editor/Mono/BuildProfile/BuildProfilePlayerSettingsEditor.cs +++ b/Editor/Mono/BuildProfile/BuildProfilePlayerSettingsEditor.cs @@ -21,6 +21,19 @@ public BuildProfilePlayerSettingsAccessor(BuildProfilePlayerSettings playerSetti m_PlayerSettings = playerSettings; } + public GraphicsDeviceType[] GetGraphicsAPIsWithUGKVariants_Internal(BuildTarget platform) + { + return m_PlayerSettings.GetGraphicsAPIsWithUGKVariants(platform); + } + public int[] GetGraphicsAPIUGKFlags_Internal(BuildTarget platform) + { + return m_PlayerSettings.GetGraphicsAPIUGKFlags(platform); + } + public void SetGraphicsAPIs_Internal(BuildTarget platform, GraphicsDeviceType[] apis, int[] ugkFlags, bool shouldSync) + { + m_PlayerSettings.SetGraphicsAPIs(platform, apis, ugkFlags, shouldSync); + } + public GraphicsDeviceType[] GetGraphicsAPIs_Internal(BuildTarget platform) { return m_PlayerSettings.GetGraphicsAPIs(platform); diff --git a/Editor/Mono/BuildProfile/BuildProfileQualitySettingsEditor.cs b/Editor/Mono/BuildProfile/BuildProfileQualitySettingsEditor.cs index 1ce8720f5d..403ead9b24 100644 --- a/Editor/Mono/BuildProfile/BuildProfileQualitySettingsEditor.cs +++ b/Editor/Mono/BuildProfile/BuildProfileQualitySettingsEditor.cs @@ -19,7 +19,7 @@ sealed partial class BuildProfileQualitySettingsEditor : Editor const string k_Uxml = "BuildProfile/UXML/BuildProfileQualitySettings.uxml"; const string k_StyleSheet = "BuildProfile/StyleSheets/BuildProfile.uss"; const string k_QualitySettingsWindow = "Project/Quality"; - static readonly GUIContent k_qualitySettingsWindow = EditorGUIUtility.TrTextContent("Quality..."); + static readonly GUIContent k_qualitySettingsWindow = L10n.TextContent("Quality...", null, null, null); static readonly string k_InvalidQualityLevelWarning = L10n.Tr("The Quality levels in this profile do not match those that exist in the project. This may result in unexpected results on build.", null); static readonly string k_EmptyQualitySettingsWarning = diff --git a/Editor/Mono/BuildProfile/IPackageServiceInfoProvider.cs b/Editor/Mono/BuildProfile/IPackageServiceInfoProvider.cs new file mode 100644 index 0000000000..49dcb46a74 --- /dev/null +++ b/Editor/Mono/BuildProfile/IPackageServiceInfoProvider.cs @@ -0,0 +1,32 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Threading.Tasks; +using UnityEditor.Marketplace; + +namespace UnityEditor.Build.Profile +{ + interface IPackageServiceInfoProvider + { + bool HasPackageInfo(string packageName); + bool IsAssetStorePackage(string packageName); + bool? HasMarketplaceEntitlement(string packageName); + string GetMarketplaceProductId(string packageName); + + Task GetOrFetchProductInfoAsync(string packageName); + + /// No organization ID to claim against. + Task ClaimEntitlementAsync(string productId); + } + + /// + /// Thrown when a claim cannot be made because the project has no organization to claim against. + /// Raised only after waiting: an organization that has not arrived yet is not an absent one. + /// + class NoOrganizationIdException : Exception + { + public NoOrganizationIdException(string message) : base(message) { } + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/IMarketplaceWebRequestSender.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/IMarketplaceWebRequestSender.cs new file mode 100644 index 0000000000..09930f53bf --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/IMarketplaceWebRequestSender.cs @@ -0,0 +1,71 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using UnityEditor.Connect; +using UnityEngine.Networking; + +namespace UnityEditor.Marketplace; + +readonly struct MarketplaceWebResponse +{ + public long responseCode { get; } + public string body { get; } + + public MarketplaceWebResponse(long responseCode, string body) + { + this.responseCode = responseCode; + this.body = body; + } +} + +interface IMarketplaceWebRequestSender +{ + Task GetAsync(string url, string bearerToken, CancellationToken cancellationToken); + Task PostJsonAsync(string url, string jsonBody, string bearerToken, CancellationToken cancellationToken); +} + +class MarketplaceWebRequestSender : IMarketplaceWebRequestSender +{ + const string k_JsonContentType = "application/json"; + const string k_TransportFailureMessage = "Could not reach the marketplace service: {0}"; + + public async Task GetAsync(string url, string bearerToken, CancellationToken cancellationToken) + { + using (var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbGET)) + return await SendAsync(request, bearerToken, cancellationToken); + } + + public async Task PostJsonAsync(string url, string jsonBody, string bearerToken, CancellationToken cancellationToken) + { + using (var request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST)) + { + request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(jsonBody)); + request.SetRequestHeader("Content-Type", k_JsonContentType); + return await SendAsync(request, bearerToken, cancellationToken); + } + } + + static async Task SendAsync(UnityWebRequest request, string bearerToken, CancellationToken cancellationToken) + { + request.downloadHandler = new DownloadHandlerBuffer(); + request.suppressErrorsToConsole = true; + + // No token when signed out; the product endpoint answers unauthenticated calls. + if (!string.IsNullOrEmpty(bearerToken)) + request.SetRequestHeader("AUTHORIZATION", "Bearer " + bearerToken); + + await UnityConnectWebRequestUtils.SendWebRequestAsync(request, cancellationToken); + + if (request.result == UnityWebRequest.Result.ConnectionError) + { + throw UnityConnectWebRequestUtils.CreateUnityWebRequestException( + request, string.Format(k_TransportFailureMessage, request.error)); + } + + return new MarketplaceWebResponse(request.responseCode, request.downloadHandler.text); + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/IServiceTokenProvider.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/IServiceTokenProvider.cs new file mode 100644 index 0000000000..14a6c64574 --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/IServiceTokenProvider.cs @@ -0,0 +1,22 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System.Threading; +using System.Threading.Tasks; + +namespace UnityEditor.Marketplace; + +interface IServiceTokenProvider +{ + Task GetServiceTokenAsync(CancellationToken cancellationToken); +} + +class ServiceTokenProvider : IServiceTokenProvider +{ + // Null when there is no Genesis token to exchange, e.g. when signed out. + public Task GetServiceTokenAsync(CancellationToken cancellationToken) + { + return CloudProjectSettings.GetServiceTokenAsync(cancellationToken); + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceApiError.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceApiError.cs new file mode 100644 index 0000000000..67f49d383f --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceApiError.cs @@ -0,0 +1,98 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; + +namespace UnityEditor.Marketplace; + +/// +/// Problem-details envelope returned by the marketplace editor endpoints. Only +/// and are guaranteed by the schema; the rest may be absent. +/// +readonly struct MarketplaceApiError +{ + /// + /// HTTP status text. + /// + public string title { get; } + + /// + /// HTTP status code. + /// + public int status { get; } + + /// + /// Application-specific error code. Optional. + /// + public int code { get; } + + /// + /// Error type. Optional. + /// + public string type { get; } + + /// + /// Human-readable error message. Optional. + /// + public string detail { get; } + + /// + /// Request ID for tracing. Optional. + /// + public string requestId { get; } + + public MarketplaceApiError(string title, int status, int code, string type, string detail, string requestId) + { + this.title = title; + this.status = status; + this.code = code; + this.type = type; + this.detail = detail; + this.requestId = requestId; + } + + public static MarketplaceApiError FromResponse(MarketplaceWebResponse response) + { + var fields = MarketplaceJson.Parse(response.body); + if (fields == null) + return new MarketplaceApiError(null, (int)response.responseCode, 0, null, null, null); + + return new MarketplaceApiError( + MarketplaceJson.ReadString(fields, "title"), + MarketplaceJson.ReadInt(fields, "status", (int)response.responseCode), + MarketplaceJson.ReadInt(fields, "code", 0), + MarketplaceJson.ReadString(fields, "type"), + MarketplaceJson.ReadString(fields, "detail"), + MarketplaceJson.ReadString(fields, "requestId")); + } + + public static MarketplaceApiError Unparsable(MarketplaceWebResponse response, string url) + { + return new MarketplaceApiError( + null, + (int)response.responseCode, + 0, + null, + "Could not parse the response from " + url, + null); + } + + public override string ToString() + { + var message = !string.IsNullOrEmpty(detail) ? detail : title; + var identifier = !string.IsNullOrEmpty(requestId) ? " (requestId: " + requestId + ")" : string.Empty; + return "[" + status + "] " + message + identifier; + } +} + +class MarketplaceApiException : Exception +{ + public MarketplaceApiError error { get; } + + public MarketplaceApiException(MarketplaceApiError error) + : base(error.ToString()) + { + this.error = error; + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiClient.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiClient.cs new file mode 100644 index 0000000000..5472b8ef5c --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiClient.cs @@ -0,0 +1,100 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using UnityEditor.Connect; + +namespace UnityEditor.Marketplace; + +interface IMarketplaceEditorApiClient +{ + /// + /// Resolves a UPM technical name to product info. Returns null when the service has no product + /// for the name, which covers both a package outside the partner whitelist and one with no + /// published version. + /// + Task GetPackageInfoAsync(string technicalName, CancellationToken cancellationToken = default); + + /// + /// Claims an entitlement, and doubles as the poll for one still processing: the endpoint is + /// idempotent, so calling again with the same arguments returns the current grant status. + /// + Task ClaimEntitlementAsync(EntitlementClaimArgs args, CancellationToken cancellationToken = default); +} + +class MarketplaceEditorApiClient : IMarketplaceEditorApiClient +{ + const string k_ProductsPath = "/api/marketplace/products/editor/v1"; + const string k_EntitlementsPath = "/api/marketplace/entitlements/editor/v1"; + const int k_NotFoundResponseCode = 404; + + readonly string m_BaseUrl; + readonly IMarketplaceWebRequestSender m_RequestSender; + readonly IServiceTokenProvider m_TokenProvider; + + public MarketplaceEditorApiClient() + : this( + UnityConnect.instance.GetConfigurationURL(CloudConfigUrl.ServicesGateway), + new MarketplaceWebRequestSender(), + new ServiceTokenProvider()) + { + } + + public MarketplaceEditorApiClient(string baseUrl, IMarketplaceWebRequestSender requestSender, IServiceTokenProvider tokenProvider) + { + m_BaseUrl = baseUrl; + m_RequestSender = requestSender; + m_TokenProvider = tokenProvider; + } + + public async Task GetPackageInfoAsync(string technicalName, CancellationToken cancellationToken = default) + { + if (string.IsNullOrEmpty(technicalName)) + throw new ArgumentException("A technical name is required.", nameof(technicalName)); + + var url = m_BaseUrl + k_ProductsPath + "/packages/" + Uri.EscapeDataString(technicalName); + var token = await m_TokenProvider.GetServiceTokenAsync(cancellationToken); + var response = await m_RequestSender.GetAsync(url, token, cancellationToken); + + if (response.responseCode == k_NotFoundResponseCode) + return null; + + return MarketplacePackageInfo.FromFields(ReadSuccessBody(response, url)); + } + + public async Task ClaimEntitlementAsync(EntitlementClaimArgs args, CancellationToken cancellationToken = default) + { + if (string.IsNullOrEmpty(args.organizationId)) + throw new ArgumentException("An organization id is required to claim an entitlement.", nameof(args)); + if (string.IsNullOrEmpty(args.productId)) + throw new ArgumentException("A product id is required to claim an entitlement.", nameof(args)); + + var url = m_BaseUrl + k_EntitlementsPath + "/entitlements/claim/product"; + var body = Json.Serialize(new Dictionary + { + { "organizationId", args.organizationId }, + { "productId", args.productId }, + }); + + var token = await m_TokenProvider.GetServiceTokenAsync(cancellationToken); + var response = await m_RequestSender.PostJsonAsync(url, body, token, cancellationToken); + + return EntitlementClaimResult.FromFields(ReadSuccessBody(response, url)); + } + + static Dictionary ReadSuccessBody(MarketplaceWebResponse response, string url) + { + if (response.responseCode < 200 || response.responseCode >= 300) + throw new MarketplaceApiException(MarketplaceApiError.FromResponse(response)); + + var fields = MarketplaceJson.Parse(response.body); + if (fields == null) + throw new MarketplaceApiException(MarketplaceApiError.Unparsable(response, url)); + + return fields; + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiModels.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiModels.cs new file mode 100644 index 0000000000..0135992503 --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceEditorApiModels.cs @@ -0,0 +1,246 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System.Collections.Generic; + +namespace UnityEditor.Marketplace; + +enum ClaimStatus +{ + Unknown, + Granted, + Processing, +} + +readonly struct EntitlementClaimArgs +{ + /// + /// The organization ID claiming the entitlement. + /// + public string organizationId { get; } + + /// + /// The product ID being claimed. + /// + public string productId { get; } + + public EntitlementClaimArgs(string organizationId, string productId) + { + this.organizationId = organizationId; + this.productId = productId; + } +} + +class EntitlementClaimResult +{ + const string k_GrantedStatus = "granted"; + const string k_ProcessingStatus = "processing"; + + /// + /// Opaque stable identifier for this claim (base64url of organizationId:productId). + /// + public string id { get; } + public ClaimStatus status { get; } + + EntitlementClaimResult(string id, ClaimStatus status) + { + this.id = id; + this.status = status; + } + + public static EntitlementClaimResult FromFields(Dictionary fields) + { + return new EntitlementClaimResult( + MarketplaceJson.ReadString(fields, "id"), + ParseStatus(MarketplaceJson.ReadString(fields, "status"))); + } + + static ClaimStatus ParseStatus(string status) + { + switch (status) + { + case k_GrantedStatus: + return ClaimStatus.Granted; + + case k_ProcessingStatus: + return ClaimStatus.Processing; + + default: + return ClaimStatus.Unknown; + } + } +} + +class MarketplacePublisherInfo +{ + /// + /// Publisher ID. + /// + public string id { get; } + + /// + /// Publisher display name. + /// + public string name { get; } + + MarketplacePublisherInfo(string id, string name) + { + this.id = id; + this.name = name; + } + + public static MarketplacePublisherInfo FromFields(Dictionary fields) + { + if (fields == null) + return null; + + return new MarketplacePublisherInfo( + MarketplaceJson.ReadString(fields, "id"), + MarketplaceJson.ReadString(fields, "name")); + } +} + +class MarketplaceLicenseInfo +{ + /// + /// License ID. + /// + public string id { get; } + + /// + /// License display name. + /// + public string name { get; } + + /// + /// URL to the full license text. Optional. + /// + public string url { get; } + + /// + /// Inline license terms. Optional. + /// + public string terms { get; } + + MarketplaceLicenseInfo(string id, string name, string url, string terms) + { + this.id = id; + this.name = name; + this.url = url; + this.terms = terms; + } + + public static MarketplaceLicenseInfo FromFields(Dictionary fields) + { + if (fields == null) + return null; + + return new MarketplaceLicenseInfo( + MarketplaceJson.ReadString(fields, "id"), + MarketplaceJson.ReadString(fields, "name"), + MarketplaceJson.ReadString(fields, "url"), + MarketplaceJson.ReadString(fields, "terms")); + } +} + +class MarketplaceEntitlementInfo +{ + /// + /// Whether the authenticated user is entitled to the product. Optional. Null when the + /// check could not be performed, which is not the same as not being entitled. Callers + /// must treat this as a tri-state and consult . + /// + public bool? hasEntitlement { get; } + + /// + /// Error message when entitlement check could not be performed (e.g. not authenticated). + /// Optional. + /// + public string error { get; } + + MarketplaceEntitlementInfo(bool? hasEntitlement, string error) + { + this.hasEntitlement = hasEntitlement; + this.error = error; + } + + public static MarketplaceEntitlementInfo FromFields(Dictionary fields) + { + if (fields == null) + return null; + + return new MarketplaceEntitlementInfo( + MarketplaceJson.ReadNullableBool(fields, "hasEntitlement"), + MarketplaceJson.ReadString(fields, "error")); + } +} + +class MarketplacePackageInfo +{ + /// + /// Marketplace product ID. Where the package is listed under a product, this is that parent + /// product's ID rather than the one the registry reports for the package itself. + /// + public string productId { get; } + + /// + /// Product display name. + /// + public string name { get; } + + /// + /// Short product summary. + /// + public string summary { get; } + + public string publisherId { get; } + public string licenseId { get; } + + /// + /// Card thumbnail URL. + /// + public string thumbnail { get; } + + public MarketplacePublisherInfo publisher { get; } + public MarketplaceLicenseInfo license { get; } + public MarketplaceEntitlementInfo entitlement { get; } + + MarketplacePackageInfo( + string productId, + string name, + string summary, + string publisherId, + string licenseId, + string thumbnail, + MarketplacePublisherInfo publisher, + MarketplaceLicenseInfo license, + MarketplaceEntitlementInfo entitlement) + { + this.productId = productId; + this.name = name; + this.summary = summary; + this.publisherId = publisherId; + this.licenseId = licenseId; + this.thumbnail = thumbnail; + this.publisher = publisher; + this.license = license; + this.entitlement = entitlement; + } + + public static MarketplacePackageInfo FromFields(Dictionary fields) + { + var expanded = MarketplaceJson.ReadObject(fields, "expanded"); + + return new MarketplacePackageInfo( + MarketplaceJson.ReadString(fields, "productId"), + MarketplaceJson.ReadString(fields, "name"), + MarketplaceJson.ReadString(fields, "summary"), + MarketplaceJson.ReadString(fields, "publisherId"), + MarketplaceJson.ReadString(fields, "licenseId"), + MarketplaceJson.ReadString(fields, "thumbnail"), + MarketplacePublisherInfo.FromFields(MarketplaceJson.ReadObject(expanded, "publisher")), + MarketplaceLicenseInfo.FromFields(MarketplaceJson.ReadObject(expanded, "license")), + MarketplaceEntitlementInfo.FromFields(MarketplaceJson.ReadObject(expanded, "entitlement"))); + } +} diff --git a/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceJson.cs b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceJson.cs new file mode 100644 index 0000000000..cfeb8dc70d --- /dev/null +++ b/Editor/Mono/BuildProfile/MarketplaceEditorApi/MarketplaceJson.cs @@ -0,0 +1,66 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using System.Collections.Generic; + +namespace UnityEditor.Marketplace; + +static class MarketplaceJson +{ + public static Dictionary Parse(string json) + { + if (string.IsNullOrEmpty(json)) + return null; + + try + { + return Json.Deserialize(json) as Dictionary; + } + catch (Exception) + { + return null; + } + } + + public static Dictionary ReadObject(Dictionary fields, string key) + { + if (fields == null) + return null; + + return fields.TryGetValue(key, out var value) ? value as Dictionary : null; + } + + public static string ReadString(Dictionary fields, string key) + { + if (fields == null) + return null; + + return fields.TryGetValue(key, out var value) ? value as string : null; + } + + public static int ReadInt(Dictionary fields, string key, int fallback) + { + if (fields == null || !fields.TryGetValue(key, out var value) || value == null) + return fallback; + + // MiniJson yields long for integral values and double otherwise. + try + { + return Convert.ToInt32(value); + } + catch (Exception) + { + return fallback; + } + } + + public static bool? ReadNullableBool(Dictionary fields, string key) + { + if (fields == null || !fields.TryGetValue(key, out var value)) + return null; + + return value as bool?; + } +} diff --git a/Editor/Mono/BuildProfile/PlatformPackageServiceInfoProvider.cs b/Editor/Mono/BuildProfile/PlatformPackageServiceInfoProvider.cs index 12972b27bd..e5f033d88f 100644 --- a/Editor/Mono/BuildProfile/PlatformPackageServiceInfoProvider.cs +++ b/Editor/Mono/BuildProfile/PlatformPackageServiceInfoProvider.cs @@ -6,15 +6,15 @@ using System.Collections.Generic; using System.Threading.Tasks; using UnityEditor.Connect; +using UnityEditor.Marketplace; using UnityEditor.PackageManager; -using UnityEditor.PackageManager.UI.Internal; using UnityEngine; using UnityEngine.Bindings; namespace UnityEditor.Build.Profile; [VisibleToOtherModules] -internal class PlatformPackageServiceInfoProvider +internal class PlatformPackageServiceInfoProvider : IPackageServiceInfoProvider { public event Action OnPackageInfoUpdated; public event Action OnUserLoginStateChanged; @@ -27,29 +27,35 @@ public enum RequestState Timeout } - List m_PackageServiceInfoList = new List(); - readonly HttpClientFactory m_HttpClientFactory = new HttpClientFactory(); - readonly DateTimeProxy m_DateTimeProxy = new DateTimeProxy(); - readonly UnityConnectProxy m_UnityConnectProxy = new UnityConnectProxy(); - readonly UnityOAuthProxy m_UnityOAuthProxy = new UnityOAuthProxy(); - readonly AssetStoreOAuth m_AssetStoreOAuth; + readonly Dictionary m_PackageServiceInfos = new Dictionary(); + + /// + /// Product info requests in flight keyed by package name. + /// + readonly Dictionary> m_InFlightProductInfo = new Dictionary>(); + + /// + /// Claims in flight, keyed by organization and product. + /// + readonly Dictionary> m_InFlightClaims = new Dictionary>(); + + Task m_InFlightOrganizationIdWait; + + IMarketplaceEditorApiClient m_ApiClient; + IMarketplaceEditorApiClient apiClient => m_ApiClient ??= new MarketplaceEditorApiClient(); public bool isUserLoggedIn => UnityConnect.instance.loggedIn; public void ShowLogin() => UnityConnect.instance.ShowLogin(); - string m_Host = string.Empty; - string host - { - get - { - if (string.IsNullOrEmpty(m_Host)) - m_Host = m_UnityConnectProxy.GetConfigurationURL(Connect.CloudConfigUrl.CloudPackagesApi); - return m_Host; - } - } - const int k_TimeoutSeconds = 30; - const string k_ProductInfoUri = "/-/api/product"; + + /// + /// Must stay below BuildProfileEntitlementClaimInfo.k_AttemptTimeoutSeconds. The wait runs inside a + /// claim attempt, so if the attempt times out first the caller sees a cancellation instead of + /// NoOrganizationIdException, and the stage reports a timeout rather than the missing organization. + /// + const int k_OrganizationIdTimeoutSeconds = 20; + const int k_OrganizationIdPollMilliseconds = 250; class PlatformPackageServiceInfo { @@ -57,6 +63,7 @@ class PlatformPackageServiceInfo public long productId { get; } public PackageManager.PackageInfo packageInfo { get; } public Texture thumbnail; + public MarketplacePackageInfo marketplaceInfo; public PlatformPackageServiceInfo(PackageManager.PackageInfo packageInfo) { @@ -78,14 +85,13 @@ public void Dispose() internal PlatformPackageServiceInfoProvider() { - m_AssetStoreOAuth = new AssetStoreOAuth(m_DateTimeProxy, m_UnityConnectProxy, m_UnityOAuthProxy, m_HttpClientFactory); UnityConnect.instance.StateChanged += OnStateChanged; } public void Dispose() { UnityConnect.instance.StateChanged -= OnStateChanged; - foreach (var packageInfo in m_PackageServiceInfoList) + foreach (var packageInfo in m_PackageServiceInfos.Values) packageInfo.Dispose(); } @@ -108,18 +114,36 @@ public bool FetchInfo() return true; } + public bool HasPackageInfo(string packageName) => GetPackageInfo(packageName) != null; + public PackageManager.PackageInfo GetPackageInfo(string packageName) { - var packageServiceInfo = m_PackageServiceInfoList.Find(p => p.name == packageName); - return packageServiceInfo?.packageInfo; + return m_PackageServiceInfos.TryGetValue(packageName, out var packageServiceInfo) ? packageServiceInfo.packageInfo : null; } public Texture GetThumbnail(string packageName) { - var packageServiceInfo = m_PackageServiceInfoList.Find(p => p.name == packageName); - return packageServiceInfo?.thumbnail; + return m_PackageServiceInfos.TryGetValue(packageName, out var packageServiceInfo) ? packageServiceInfo.thumbnail : null; } + public string GetMarketplaceProductId(string packageName) => GetMarketplaceInfo(packageName)?.productId; + + /// + /// Whether the user already holds the entitlement for the package. Null means unknown, which is not the same + /// as not entitled and must not be collapsed into it. + /// + public bool? HasMarketplaceEntitlement(string packageName) => GetMarketplaceInfo(packageName)?.entitlement?.hasEntitlement; + + /// + /// URL of the license the package is distributed under. Null when the product names no license. + /// + public string GetLicenseUrl(string packageName) => GetMarketplaceInfo(packageName)?.license?.url; + + /// + /// Short name to label with. + /// + public string GetLicenseName(string packageName) => GetMarketplaceInfo(packageName)?.license?.name; + /// /// True when the package uses the Enterprise licensing model, meaning access is granted by an entitlement. /// @@ -128,6 +152,128 @@ public bool IsEnterprisePackage(string packageName) return GetPackageInfo(packageName)?.entitlements?.licensingModel == EntitlementLicensingModel.Enterprise; } + /// + /// True when the package uses the Asset Store licensing model, meaning access depends on an + /// entitlement the user can claim. + /// + public bool IsAssetStorePackage(string packageName) + { + return GetPackageInfo(packageName)?.entitlements?.licensingModel == EntitlementLicensingModel.AssetStore; + } + + public Task GetOrFetchProductInfoAsync(string packageName) + { + var resolved = GetMarketplaceInfo(packageName); + if (resolved != null) + return Task.FromResult(resolved); + + if (m_InFlightProductInfo.TryGetValue(packageName, out var inFlight)) + return inFlight; + + var request = FetchProductInfoCoreAsync(packageName); + if (!request.IsCompleted) + m_InFlightProductInfo[packageName] = request; + + return request; + } + + public async Task ClaimEntitlementAsync(string productId) + { + var claimOrganizationId = await GetOrganizationIdAsync(); + var key = claimOrganizationId + ":" + productId; + + if (m_InFlightClaims.TryGetValue(key, out var inFlight)) + return await inFlight; + + var request = ClaimEntitlementCoreAsync(key, claimOrganizationId, productId); + if (!request.IsCompleted) + m_InFlightClaims[key] = request; + + return await request; + } + + MarketplacePackageInfo GetMarketplaceInfo(string packageName) + { + return m_PackageServiceInfos.TryGetValue(packageName, out var packageServiceInfo) ? packageServiceInfo.marketplaceInfo : null; + } + + async Task FetchProductInfoCoreAsync(string packageName) + { + try + { + var productInfo = await apiClient.GetPackageInfoAsync(packageName); + if (productInfo != null && m_PackageServiceInfos.TryGetValue(packageName, out var packageServiceInfo)) + packageServiceInfo.marketplaceInfo = productInfo; + + return productInfo; + } + finally + { + m_InFlightProductInfo.Remove(packageName); + } + } + + async Task ClaimEntitlementCoreAsync(string key, string claimOrganizationId, string productId) + { + try + { + return await apiClient.ClaimEntitlementAsync(new EntitlementClaimArgs(claimOrganizationId, productId)); + } + finally + { + m_InFlightClaims.Remove(key); + } + } + + /// + /// The project-linked organization's Genesis ID, which is what the services gateway expects an + /// entitlement to be claimed against. Empty until the project state machine has resolved it. + /// + string organizationId => CloudProjectSettings.organizationKey; + + Task GetOrganizationIdAsync() + { + if (m_InFlightOrganizationIdWait != null) + return m_InFlightOrganizationIdWait; + + var request = WaitForOrganizationIdAsync(); + if (!request.IsCompleted) + m_InFlightOrganizationIdWait = request; + + return request; + } + + /// + /// Polls until the organization ID resolves or it is clear that none is coming. + /// Required for claiming entitlements for + /// at project start up and batch mode. + /// + async Task WaitForOrganizationIdAsync() + { + try + { + var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(k_OrganizationIdTimeoutSeconds); + while (true) + { + var resolved = organizationId; + if (!string.IsNullOrEmpty(resolved)) + return resolved; + + if (UnityConnect.instance.isUserInfoReady && !UnityConnect.instance.loggedIn) + throw new NoOrganizationIdException("No user is signed in."); + + if (UnityConnect.instance.projectInfo.valid || DateTime.UtcNow >= deadline) + throw new NoOrganizationIdException("The project's organization could not be determined."); + + await Task.Delay(k_OrganizationIdPollMilliseconds); + } + } + finally + { + m_InFlightOrganizationIdWait = null; + } + } + async void FetchPackageServiceInfo() { var packageInfoSearchTasks = new List>(); @@ -138,11 +284,10 @@ async void FetchPackageServiceInfo() var packageInfo = PackageManager.PackageInfo.FindForPackageName(name); if (packageInfo != null) { - var packageServiceInfo = new PlatformPackageServiceInfo(packageInfo); - m_PackageServiceInfoList.Add(packageServiceInfo); + var packageServiceInfo = Store(packageInfo); if (packageServiceInfo.productId != -1) - packageInfoSearchTasks.Add(FetchThumbnailFromAssetStoreAsync(packageServiceInfo.productId)); + packageInfoSearchTasks.Add(FetchProductInfoAsync(packageServiceInfo.name)); } else packageInfoSearchTasks.Add(FetchPackageServiceInfoFromServerAsync(name)); @@ -157,7 +302,7 @@ async void FetchPackageServiceInfo() var searchTask = Task.WhenAll(packageInfoSearchTasks); var timeoutTask = Task.Delay(TimeSpan.FromSeconds(k_TimeoutSeconds)); - + var completedTask = await Task.WhenAny(searchTask, timeoutTask); if (completedTask == timeoutTask) @@ -205,13 +350,11 @@ async void OnUpdate() try { - var packageInformation = new PlatformPackageServiceInfo(packageInfo); - m_PackageServiceInfoList.Add(packageInformation); - + var packageInformation = Store(packageInfo); if (packageInformation.productId != -1) { - var thumbnailResult = await FetchThumbnailFromAssetStoreAsync(packageInformation.productId); - if (!thumbnailResult) + var productInfoResult = await FetchProductInfoAsync(packageInformation.name); + if (!productInfoResult) { tcs.SetResult(false); return; @@ -234,64 +377,39 @@ async void OnUpdate() return tcs.Task; } - Task FetchThumbnailFromAssetStoreAsync(long productId) + async Task FetchProductInfoAsync(string packageName) { - var tcs = new TaskCompletionSource(); - FetchProductInfoFromAssetStore(productId, async result => + try { - try - { - if (result == null || result.ContainsKey("errorMessage")) - { - tcs.SetResult(false); - return; - } - - var imageUrl = GetThumbnailUrlFromProductDetails(result); - if (string.IsNullOrEmpty(imageUrl)) - { - tcs.SetResult(false); - return; - } + var productInfo = await GetOrFetchProductInfoAsync(packageName); + if (productInfo == null || !m_PackageServiceInfos.TryGetValue(packageName, out var packageServiceInfo)) + return false; - var image = await DownloadImageByUrlAsync(imageUrl); - if (image == null) - { - tcs.SetResult(false); - return; - } + if (string.IsNullOrEmpty(productInfo.thumbnail)) + return false; - var packageServiceInfo = m_PackageServiceInfoList.Find(p => p.productId == productId); - if (packageServiceInfo == null) - { - tcs.SetResult(false); - return; - } + var image = await DownloadImageByUrlAsync(productInfo.thumbnail); + if (image == null) + return false; - image.hideFlags = HideFlags.HideAndDontSave; - packageServiceInfo.thumbnail = image; - tcs.SetResult(true); - } - catch - { - tcs.SetResult(false); - } - }); - return tcs.Task; + image.hideFlags = HideFlags.HideAndDontSave; + packageServiceInfo.thumbnail = image; + return true; + } + catch + { + return false; + } } - string GetThumbnailUrlFromProductDetails(IDictionary productDetail) + PlatformPackageServiceInfo Store(PackageManager.PackageInfo packageInfo) { - if (productDetail == null) - return string.Empty; - - var mainImageDictionary = productDetail.GetDictionary("mainImage"); - var thumbnailUrl = mainImageDictionary?.GetString("small_v2"); - if (string.IsNullOrEmpty(thumbnailUrl)) - return string.Empty; + var packageServiceInfo = new PlatformPackageServiceInfo(packageInfo); + if (m_PackageServiceInfos.TryGetValue(packageServiceInfo.name, out var existing)) + existing.Dispose(); - thumbnailUrl = thumbnailUrl.Replace("//d2ujflorbtfzji.cloudfront.net/", "//assetstorev1-prd-cdn.unity3d.com/"); - return "http:" + thumbnailUrl; + m_PackageServiceInfos[packageServiceInfo.name] = packageServiceInfo; + return packageServiceInfo; } Task DownloadImageByUrlAsync(string url) @@ -304,7 +422,7 @@ Task DownloadImageByUrlAsync(string url) return tcs.Task; } - var httpRequest = m_HttpClientFactory.GetASyncHTTPClient(url); + var httpRequest = new AsyncHTTPClient(url); httpRequest.doneCallback = httpClient => { if (httpClient.IsSuccess() && httpClient.texture != null) @@ -316,33 +434,4 @@ Task DownloadImageByUrlAsync(string url) return tcs.Task; } - - void FetchProductInfoFromAssetStore(long productId, Action> value) - { - var url = $"{host}{k_ProductInfoUri}/{productId}"; - var httpRequest = m_HttpClientFactory.GetASyncHTTPClient(url); - m_AssetStoreOAuth.FetchAccessToken( - token => - { - httpRequest.tag = $"GetPlatformPackageProductDetail{productId}"; - httpRequest.header["Content-Type"] = "application/json"; - httpRequest.header["Authorization"] = "Bearer " + token.accessToken; - httpRequest.doneCallback = request => - { - if (!request.IsSuccess()) - { - value?.Invoke(null); - return; - } - - var parsedResult = m_HttpClientFactory.ParseResponseAsDictionary(request); - value?.Invoke(parsedResult); - }; - httpRequest.Begin(); - }, - error => - { - value?.Invoke(null); - }); - } } diff --git a/Editor/Mono/BuildProfile/ReferencedComponent.cs b/Editor/Mono/BuildProfile/ReferencedComponent.cs new file mode 100644 index 0000000000..d203b2ad5e --- /dev/null +++ b/Editor/Mono/BuildProfile/ReferencedComponent.cs @@ -0,0 +1,36 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +using System; +using UnityEngine; +using UnityEngine.Bindings; + +namespace UnityEditor.Build.Profile +{ + /// + /// Proxy sub-asset linking a build profile to a standalone on-disk settings asset instead of an + /// embedded settings object. Resolved by . + /// + [VisibleToOtherModules("UnityEditor.BuildProfileModule")] + sealed class ReferencedComponent : ScriptableObject + { + [SerializeField] ScriptableObject m_Reference; + [SerializeField] MonoScript m_ReferenceType; + + public ScriptableObject reference + { + get => m_Reference; + set => m_Reference = value; + } + + public Type referenceType + { + get => m_ReferenceType != null ? m_ReferenceType.GetClass() : null; + set => m_ReferenceType = value != null ? MonoScript.FromType(value) : null; + } + + public bool Matches(Type componentType) => + componentType.IsInstanceOfType(reference) || componentType.IsAssignableFrom(referenceType); + } +} diff --git a/Editor/Mono/BuildProfile/SharedPlatformSettings.cs b/Editor/Mono/BuildProfile/SharedPlatformSettings.cs index 7b0cb4d176..8a17bf7b87 100644 --- a/Editor/Mono/BuildProfile/SharedPlatformSettings.cs +++ b/Editor/Mono/BuildProfile/SharedPlatformSettings.cs @@ -491,7 +491,7 @@ public void CopySharedSettingsToBuildProfile(BuildProfile profile) platformSettings.development = development; platformSettings.connectProfiler = connectProfiler; platformSettings.buildWithDeepProfilingSupport = buildWithDeepProfilingSupport; - if (!BuildProfileModuleUtil.IsStandalonePlatform(buildTarget)) + if (!BuildProfileModuleUtil.IsPlatformSupportedByCoverage(buildTarget)) platformSettings.buildWithCodeCoverage = false; else platformSettings.buildWithCodeCoverage = buildWithCodeCoverage; diff --git a/Editor/Mono/Clipboard/Clipboard.cs b/Editor/Mono/Clipboard/Clipboard.cs index bc9be4774e..54321cd4cd 100644 --- a/Editor/Mono/Clipboard/Clipboard.cs +++ b/Editor/Mono/Clipboard/Clipboard.cs @@ -19,6 +19,10 @@ namespace UnityEditor internal static partial class Clipboard { [AutoStaticsCleanupOnCodeReload] + // Parse cache of the system clipboard string: FetchState compares it against + // EditorGUIUtility.systemCopyBuffer and rebuilds the state whenever they differ, so the clipboard + // contents themselves are never held here. + [IgnoreForUAL0015("Parse cache of the system clipboard, rebuilt by FetchState on the next access")] static ClipboardState m_State = new ClipboardState(); public static bool hasLong diff --git a/Editor/Mono/Clipboard/ClipboardContextMenu.cs b/Editor/Mono/Clipboard/ClipboardContextMenu.cs index f2ac0e2e1e..74a447dfa7 100644 --- a/Editor/Mono/Clipboard/ClipboardContextMenu.cs +++ b/Editor/Mono/Clipboard/ClipboardContextMenu.cs @@ -316,20 +316,20 @@ internal static void SetupPropertyCopyPaste(SerializedProperty property, Generic } } - static readonly GUIContent kCopyContent = EditorGUIUtility.TrTextContent("Copy"); - static readonly GUIContent kPasteContent = EditorGUIUtility.TrTextContent("Paste"); - static readonly GUIContent kCopyEulerContent = EditorGUIUtility.TrTextContent("Copy Euler Angles"); - static readonly GUIContent kCopyQuatContent = EditorGUIUtility.TrTextContent("Copy Quaternion"); - static readonly GUIContent kCopyPathContent = EditorGUIUtility.TrTextContent("Copy Path"); - static readonly GUIContent kCopyGuidContent = EditorGUIUtility.TrTextContent("Copy GUID"); - static readonly GUIContent kPasteMinColorContent = EditorGUIUtility.TrTextContent("Paste Min Color"); - static readonly GUIContent kPasteMaxColorContent = EditorGUIUtility.TrTextContent("Paste Max Color"); - static readonly GUIContent kPasteMinGradientContent = EditorGUIUtility.TrTextContent("Paste Min Gradient"); - static readonly GUIContent kPasteMaxGradientContent = EditorGUIUtility.TrTextContent("Paste Max Gradient"); - static readonly GUIContent kPasteMinScalarContent = EditorGUIUtility.TrTextContent("Paste Min Scalar"); - static readonly GUIContent kPasteMaxScalarContent = EditorGUIUtility.TrTextContent("Paste Max Scalar"); - static readonly GUIContent kPasteMinCurveContent = EditorGUIUtility.TrTextContent("Paste Min Curve"); - static readonly GUIContent kPasteMaxCurveContent = EditorGUIUtility.TrTextContent("Paste Max Curve"); + static readonly GUIContent kCopyContent = L10n.TextContent("Copy", null, null, null); + static readonly GUIContent kPasteContent = L10n.TextContent("Paste", null, null, null); + static readonly GUIContent kCopyEulerContent = L10n.TextContent("Copy Euler Angles", null, null, null); + static readonly GUIContent kCopyQuatContent = L10n.TextContent("Copy Quaternion", null, null, null); + static readonly GUIContent kCopyPathContent = L10n.TextContent("Copy Path", null, null, null); + static readonly GUIContent kCopyGuidContent = L10n.TextContent("Copy GUID", null, null, null); + static readonly GUIContent kPasteMinColorContent = L10n.TextContent("Paste Min Color", null, null, null); + static readonly GUIContent kPasteMaxColorContent = L10n.TextContent("Paste Max Color", null, null, null); + static readonly GUIContent kPasteMinGradientContent = L10n.TextContent("Paste Min Gradient", null, null, null); + static readonly GUIContent kPasteMaxGradientContent = L10n.TextContent("Paste Max Gradient", null, null, null); + static readonly GUIContent kPasteMinScalarContent = L10n.TextContent("Paste Min Scalar", null, null, null); + static readonly GUIContent kPasteMaxScalarContent = L10n.TextContent("Paste Max Scalar", null, null, null); + static readonly GUIContent kPasteMinCurveContent = L10n.TextContent("Paste Min Curve", null, null, null); + static readonly GUIContent kPasteMaxCurveContent = L10n.TextContent("Paste Max Curve", null, null, null); static void AddSeparator(GenericMenu menu) { diff --git a/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs b/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs index 6cbc36ba63..b3d1ea2b07 100644 --- a/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs +++ b/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs @@ -15,7 +15,7 @@ namespace UnityEditor { internal class DefaultExternalCodeEditor : IExternalCodeEditor { - static readonly GUIContent k_ResetArguments = EditorGUIUtility.TrTextContent("Reset argument"); + static readonly GUIContent k_ResetArguments = L10n.TextContent("Reset argument", null, null, null); static readonly string[] supportedExtensions = { "json", "asmdef", "log", "cs", "uxml", "uss", "shader", "compute", "cginc", "hlsl", "glslinc", "template", "raytrace" }; static bool IsOSX => Application.platform == RuntimePlatform.OSXEditor; static bool IsWindows => Application.platform == RuntimePlatform.WindowsEditor; diff --git a/Editor/Mono/CompilationPipeline.bindings.cs b/Editor/Mono/CompilationPipeline.bindings.cs index fd6c8b2922..710bbf215b 100644 --- a/Editor/Mono/CompilationPipeline.bindings.cs +++ b/Editor/Mono/CompilationPipeline.bindings.cs @@ -28,6 +28,7 @@ public static partial class CompilationPipeline [FreeFunction] internal static extern bool IsScriptDebugInfoEnabled(); + [VisibleToOtherModules("UnityEditor.BurstModule")] [FreeFunction] internal static extern bool IsUsingMSBuild(); } diff --git a/Editor/Mono/ConsoleWindow.cs b/Editor/Mono/ConsoleWindow.cs index 1a2ead37d2..711e011c94 100644 --- a/Editor/Mono/ConsoleWindow.cs +++ b/Editor/Mono/ConsoleWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Kernel not yet converted using System; using System.Globalization; using System.Collections.Generic; @@ -99,16 +98,16 @@ internal class Constants [NoAutoStaticsCleanup] // lazy shared GUIStyle, safe to persist public static GUIStyle ConsoleSearchNoResult; - public static readonly GUIContent Clear = EditorGUIUtility.TrTextContent("Clear", "Clear console entries"); - public static readonly GUIContent ClearOnPlay = EditorGUIUtility.TrTextContent("Clear on Play"); - public static readonly GUIContent ClearOnBuild = EditorGUIUtility.TrTextContent("Clear on Build"); - public static readonly GUIContent ClearOnRecompile = EditorGUIUtility.TrTextContent("Clear on Recompile"); - public static readonly GUIContent Collapse = EditorGUIUtility.TrTextContent("Collapse", "Collapse identical entries"); - public static readonly GUIContent ErrorPause = EditorGUIUtility.TrTextContent("Error Pause", "Pause Play Mode on error"); - public static readonly GUIContent StopForAssert = EditorGUIUtility.TrTextContent("Stop for Assert"); - public static readonly GUIContent StopForError = EditorGUIUtility.TrTextContent("Stop for Error"); - public static readonly GUIContent UseMonospaceFont = EditorGUIUtility.TrTextContent("Use Monospace font"); - public static readonly GUIContent StripLoggingCallstack = EditorGUIUtility.TrTextContent("Strip logging callstack"); + public static readonly GUIContent Clear = L10n.TextContent("Clear", "Clear console entries", null, null); + public static readonly GUIContent ClearOnPlay = L10n.TextContent("Clear on Play", null, null, null); + public static readonly GUIContent ClearOnBuild = L10n.TextContent("Clear on Build", null, null, null); + public static readonly GUIContent ClearOnRecompile = L10n.TextContent("Clear on Recompile", null, null, null); + public static readonly GUIContent Collapse = L10n.TextContent("Collapse", "Collapse identical entries", null, null); + public static readonly GUIContent ErrorPause = L10n.TextContent("Error Pause", "Pause Play Mode on error", null, null); + public static readonly GUIContent StopForAssert = L10n.TextContent("Stop for Assert", null, null, null); + public static readonly GUIContent StopForError = L10n.TextContent("Stop for Error", null, null, null); + public static readonly GUIContent UseMonospaceFont = L10n.TextContent("Use Monospace font", null, null, null); + public static readonly GUIContent StripLoggingCallstack = L10n.TextContent("Strip logging callstack", null, null, null); public static int LogStyleLineCount { @@ -1252,10 +1251,10 @@ public void ToggleLogStackTracesForAll(object userData) public void AddItemsToMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Open Player Log"), false, UnityEditorInternal.InternalEditorUtility.OpenPlayerConsole); - menu.AddItem(EditorGUIUtility.TrTextContent("Open Editor Log"), false, UnityEditorInternal.InternalEditorUtility.OpenEditorConsole); + menu.AddItem(L10n.TextContent("Open Player Log", null, null, null), false, UnityEditorInternal.InternalEditorUtility.OpenPlayerConsole); + menu.AddItem(L10n.TextContent("Open Editor Log", null, null, null), false, UnityEditorInternal.InternalEditorUtility.OpenEditorConsole); - menu.AddItem(EditorGUIUtility.TrTextContent("Show Timestamp"), HasFlag(ConsoleFlags.ShowTimestamp), SetTimestamp); + menu.AddItem(L10n.TextContent("Show Timestamp", null, null, null), HasFlag(ConsoleFlags.ShowTimestamp), SetTimestamp); if (m_DevBuild) { @@ -1381,7 +1380,7 @@ private void AddStackTraceLoggingMenu(GenericMenu menu) data.logType = logType; data.stackTraceLogType = stackTraceLogType; - menu.AddItem(EditorGUIUtility.TrTextContent("Stack Trace Logging/" + logType + "/" + stackTraceLogType), PlayerSettings.GetStackTraceLogType(logType) == stackTraceLogType, + menu.AddItem(L10n.TextContent("Stack Trace Logging/" + logType + "/" + stackTraceLogType, null, null, null), PlayerSettings.GetStackTraceLogType(logType) == stackTraceLogType, ToggleLogStackTraces, data); } } @@ -1398,7 +1397,7 @@ private void AddStackTraceLoggingMenu(GenericMenu menu) foreach (StackTraceLogType stackTraceLogType in Enum.GetValues(typeof(StackTraceLogType))) { - menu.AddItem(EditorGUIUtility.TrTextContent("Stack Trace Logging/All/" + stackTraceLogType), (StackTraceLogType)stackTraceLogTypeForAll == stackTraceLogType, + menu.AddItem(L10n.TextContent("Stack Trace Logging/All/" + stackTraceLogType, null, null, null), (StackTraceLogType)stackTraceLogTypeForAll == stackTraceLogType, ToggleLogStackTracesForAll, stackTraceLogType); } } @@ -1571,4 +1570,3 @@ public void Dispose() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ConsoleWindowUtility.cs b/Editor/Mono/ConsoleWindowUtility.cs index e0b17caf4f..e1126477df 100644 --- a/Editor/Mono/ConsoleWindowUtility.cs +++ b/Editor/Mono/ConsoleWindowUtility.cs @@ -10,6 +10,9 @@ namespace UnityEditor public static partial class ConsoleWindowUtility { [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static event Action consoleLogsChanged; public static void GetConsoleLogCounts(out int error, out int warn, out int log) diff --git a/Editor/Mono/ContainerWindow.cs b/Editor/Mono/ContainerWindow.cs index 5b1b8fa026..1cb84c6f17 100644 --- a/Editor/Mono/ContainerWindow.cs +++ b/Editor/Mono/ContainerWindow.cs @@ -50,11 +50,27 @@ internal static class NativeHandleMarshaller static internal bool macEditor => Application.platform == RuntimePlatform.OSXEditor; [AutoStaticsCleanupOnCodeReload] + // Flag that is only true inside a modal window loop and set back to false when it ends, so false + // is the correct resting value; the next modal window sets it again. + [IgnoreForUAL0015("Transient modal-loop flag, set again by the next modal window")] static internal bool s_Modal = false; [AutoStaticsCleanupOnCodeReload] + // Cache of the window that Show(ShowMode.MainWindow) registered. Cleared on code reload, but the + // native window outlives the scope, so the getter below rediscovers it on the next access. + [IgnoreForUAL0015("Main-window cache rediscovered on demand by the mainWindow getter after cleanup")] private static ContainerWindow s_MainWindow; - static internal ContainerWindow mainWindow { get => s_MainWindow; } + static internal ContainerWindow mainWindow + { + get + { + // A code reload clears the cache without re-running Show(), so recover the still-live + // main window the way WindowLayout does rather than reporting that there is none. + if (!s_MainWindow) + s_MainWindow = WindowLayout.FindMainWindow(); + return s_MainWindow; + } + } static readonly string s_ContextMenuID = "UnityEditor.UIElements.EditorMenuExtensions+ContextMenu"; @@ -81,6 +97,9 @@ public ContainerWindow() } [AutoStaticsCleanupOnCodeReload] + // Callback installed by SetMppmCanCloseCallback from the multiplayer clone systems, which are + // recreated on load and install it again; a null slot means the default "can close" answer. + [IgnoreForUAL0015("Callback reinstalled by SetMppmCanCloseCallback when the clone systems are recreated")] private static Func MppmCloseCallback; internal void __internalAwake() @@ -182,7 +201,9 @@ public void Show(ShowMode showMode, bool loadPosition, bool displayImmediately, { try { - if (showMode == ShowMode.MainWindow && s_MainWindow && s_MainWindow != this) + // Read through the mainWindow getter so the guard still sees a live main window after a + // code reload has cleared the s_MainWindow cache. + if (showMode == ShowMode.MainWindow && mainWindow && mainWindow != this) throw new InvalidOperationException("Trying to create a second main window from layout when one already exists."); bool useMousePos = showMode == ShowMode.AuxWindow; diff --git a/Editor/Mono/CutBoard.cs b/Editor/Mono/CutBoard.cs index dfbd484a2e..76173044c8 100644 --- a/Editor/Mono/CutBoard.cs +++ b/Editor/Mono/CutBoard.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEngine; @@ -109,7 +108,9 @@ internal static void PasteAsChildren(Transform parent, bool worldPositionStays) } } +#pragma warning disable UAL0018 // hands the cut selection back to the user's selection, which owns objects that exist independently of the cut board; the cut board's own copy is dropped by Reset() on the next line Selection.objects = m_SelectedObjects; +#pragma warning restore UAL0018 // Reset cutBoard and greyed out gameObject list after paste Reset(); } @@ -127,7 +128,9 @@ private static void PasteAsSiblings(Transform target, bool worldPositionStays) } } +#pragma warning disable UAL0018 // hands the cut selection back to the user's selection, which owns objects that exist independently of the cut board; the cut board's own copy is dropped by Reset() on the next line Selection.objects = m_SelectedObjects; +#pragma warning restore UAL0018 // Reset cutBoard and greyed out gameObject list after paste Reset(); } @@ -142,7 +145,9 @@ internal static void PasteToScene(Scene targetScene, Transform targetGO) } } +#pragma warning disable UAL0018 // hands the cut selection back to the user's selection, which owns objects that exist independently of the cut board; the cut board's own copy is dropped by Reset() on the next line Selection.objects = m_SelectedObjects; +#pragma warning restore UAL0018 // Reset cutBoard and greyed out gameObject list after paste Reset(); } @@ -223,4 +228,3 @@ private static bool CanSetParent(Transform transform, Transform target) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/DragAndDrop.bindings.cs b/Editor/Mono/DragAndDrop.bindings.cs index 36e92e0796..1446fe68cf 100644 --- a/Editor/Mono/DragAndDrop.bindings.cs +++ b/Editor/Mono/DragAndDrop.bindings.cs @@ -53,6 +53,9 @@ public struct DragAndDropWindowTarget public partial class DragAndDrop { [AutoStaticsCleanupOnCodeReload] + // Drag payload for the gesture in progress: PrepareStartDrag clears it and SetGenericData refills it + // at the start of every drag, and a code reload ends any drag, so nothing is left to lose. + [IgnoreForUAL0015("Per-gesture drag payload, cleared and refilled at the start of every drag")] private static Hashtable s_GenericData; [AutoStaticsCleanupOnCodeReload] private static Dictionary> m_DropHandlers; diff --git a/Editor/Mono/DrivenRectTransformUndo.cs b/Editor/Mono/DrivenRectTransformUndo.cs index 43baf0f3c2..114ddedf50 100644 --- a/Editor/Mono/DrivenRectTransformUndo.cs +++ b/Editor/Mono/DrivenRectTransformUndo.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Kernel not yet converted using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -10,6 +9,9 @@ namespace UnityEditor { internal partial class DrivenRectTransformUndo { + // Both undo events are cleared on code reload, so these subscriptions have to be re-established on + // every load. A static constructor would only run once per domain, and driven RectTransform values + // would stop being refreshed around undo/redo after the first reload. [OnCodeLoaded] static void Initialize() { @@ -36,4 +38,3 @@ static void OnUndoRedoPerformed(in UndoRedoInfo info) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/EditorApplication.cs b/Editor/Mono/EditorApplication.cs index d622a3822d..5912d3d19f 100644 --- a/Editor/Mono/EditorApplication.cs +++ b/Editor/Mono/EditorApplication.cs @@ -205,6 +205,9 @@ public static void DirtyHierarchyWindowSorting() // Delegate for generic updates. [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static CallbackFunction update; [AutoStaticsCleanupOnCodeReload] @@ -212,6 +215,9 @@ public static void DirtyHierarchyWindowSorting() [VisibleToOtherModules("UnityEditor.UIToolkitAuthoringModule")] [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static event CallbackFunction tick; public static event Func wantsToQuit @@ -220,6 +226,9 @@ public static event Func wantsToQuit remove => m_WantsToQuitEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing store for the wantsToQuit event: subscribers attach through their own lifecycle - main view + // and window OnEnable, search and scenario initialization - so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker> m_WantsToQuitEvent = new EventWithPerformanceTracker>($"{nameof(EditorApplication)}.{nameof(wantsToQuit)}"); public static event Action quitting @@ -228,9 +237,15 @@ public static event Action quitting remove => m_QuittingEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing store for the quitting event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_QuittingEvent = new EventWithPerformanceTracker($"{nameof(EditorApplication)}.{nameof(quitting)}"); [AutoStaticsCleanupOnCodeReload] + // One-shot delegate slot: it is read and set back to null on every tick, and callers re-add + // themselves whenever they need another delayed call, so nothing persists here by design. + [IgnoreForUAL0015("One-shot delayed-call slot, nulled on every tick and re-added by callers")] public static CallbackFunction delayCall; [AutoStaticsCleanupOnCodeReload] private static DelegateWithPerformanceTracker m_DelayCallEvent = new DelegateWithPerformanceTracker($"{nameof(EditorApplication)}.{nameof(delayCall)}"); @@ -261,6 +276,9 @@ public static event Action hierarchyChanged remove => m_HierarchyChangedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing list for the hierarchyChanged event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared list refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_HierarchyChangedEvent = new EventWithPerformanceTracker($"{nameof(EditorApplication)}.{nameof(hierarchyChanged)}"); [Obsolete("Use EditorApplication.hierarchyChanged")] @@ -273,6 +291,9 @@ public static event Action projectChanged remove => m_ProjectChangedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing list for the projectChanged event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared list refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_ProjectChangedEvent = new EventWithPerformanceTracker($"{nameof(EditorApplication)}.{nameof(projectChanged)}"); [Obsolete("Use EditorApplication.projectChanged")] @@ -290,6 +311,10 @@ public static event Action projectChanged [VisibleToOtherModules("UnityEditor.UIBuilderModule", "UnityEditor.GraphToolkitModule", "UnityEditor.UIToolkitAuthoringModule")] [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle - an [OnCodeLoaded] initializer in the UI asset + // registry, the UI Builder scoped class constructor and clients calling RegisterFileSavedCallback - + // so the cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static CallbackFunction fileMenuSaved; [AutoStaticsCleanupOnCodeReload] @@ -303,6 +328,9 @@ internal static void Internal_FrameAndRenameNewGameObject() // Delegate for changed keyboard modifier keys. [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static CallbackFunction modifierKeysChanged; public static event Action pauseStateChanged @@ -311,6 +339,9 @@ public static event Action pauseStateChanged remove => m_PauseStateChangedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing store for the pauseStateChanged event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker> m_PauseStateChangedEvent = new EventWithPerformanceTracker>($"{nameof(EditorApplication)}.{nameof(pauseStateChanged)}"); public static event Action playModeStateChanged @@ -319,6 +350,9 @@ public static event Action playModeStateChanged remove => m_PlayModeStateChangedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload] + // Backing list for the playModeStateChanged event: subscribers attach through their own lifecycle + // and re-subscribe after a code reload, so the cleared list refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker> m_PlayModeStateChangedEvent = new EventWithPerformanceTracker>($"{nameof(EditorApplication)}.{nameof(playModeStateChanged)}"); [VisibleToOtherModules] @@ -337,15 +371,24 @@ internal static event Action enterPlayModePreStart // Global key up/down or mouse up/down/drag events that were not handled by anyone [VisibleToOtherModules("UnityEditor.UIToolkitAuthoringModule")] [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle: ShortcutIntegration re-adds its handler when the + // enabled flag is set again while lazily recreating its controller. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static CallbackFunction globalEventHandler; [AutoStaticsCleanupOnCodeReload] internal static CallbackFunction shortcutHelperBarEventHandler; // Returns true when the pressed keys are defined in the Trigger [AutoStaticsCleanupOnCodeReload] + // ShortcutIntegration re-adds its handler from InitializeController, which runs again the first + // time the shortcut controller is accessed after a code reload. + [IgnoreForUAL0015("Handler re-added by ShortcutIntegration when its controller is lazily recreated")] internal static Func doPressedKeysTriggerAnyShortcut; [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle - ShortcutIntegration re-subscribes when its + // controller is lazily recreated - so the cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static event Action focusChanged; // Windows were reordered @@ -354,6 +397,10 @@ internal static event Action enterPlayModePreStart // Global contextual menus for inspector values [AutoStaticsCleanupOnCodeReload] + // Subscribers re-register through their own lifecycle after a code load: the animation menu goes + // through AnimationPropertyContextualMenu.Instance, which recreates itself on next use, and the + // inspector-side subscribers re-attach from OnEnable. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code load")] public static SerializedPropertyCallbackFunction contextualPropertyMenu; [AutoStaticsCleanupOnCodeReload] diff --git a/Editor/Mono/EditorGUI.cs b/Editor/Mono/EditorGUI.cs index a8df067918..de3bd32121 100644 --- a/Editor/Mono/EditorGUI.cs +++ b/Editor/Mono/EditorGUI.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -40,9 +39,15 @@ namespace UnityEditor public sealed partial class EditorGUI { [AutoStaticsCleanupOnCodeReload] + // Points at the text editor currently being edited: BeginEditing assigns it when a field takes + // focus and EndEditing clears it, so the next edited field repopulates it. + [IgnoreForUAL0015("Active text editor slot, reassigned by BeginEditing on the next edited field")] private static RecycledTextEditor activeEditor; [AutoStaticsCleanupOnCodeReload] + // Shared delayed text editor, re-created by the s_DelayedTextEditor accessor on the next access once + // the text system is ready. + [IgnoreForUAL0015("Shared delayed text editor re-created on the next access when null")] internal static DelayedTextEditor s_DelayedTextEditorInternal; internal static DelayedTextEditor s_DelayedTextEditor { @@ -55,6 +60,9 @@ internal static DelayedTextEditor s_DelayedTextEditor } [AutoStaticsCleanupOnCodeReload] + // Shared scratch text editor, re-created by the s_RecycledEditor accessor on the next access once the + // text system is ready. + [IgnoreForUAL0015("Shared scratch text editor re-created on the next access when null")] internal static RecycledTextEditor s_RecycledEditorInternal; internal static RecycledTextEditor s_RecycledEditor { @@ -207,14 +215,14 @@ private enum DragCandidateState private static readonly GUIContent[] s_WHLabels = {EditorGUIUtility.TextContent("W"), EditorGUIUtility.TextContent("H")}; - private static readonly GUIContent s_CenterLabel = EditorGUIUtility.TrTextContent("Center"); - private static readonly GUIContent s_ExtentLabel = EditorGUIUtility.TrTextContent("Extent"); - private static readonly GUIContent s_PositionLabel = EditorGUIUtility.TrTextContent("Position"); - private static readonly GUIContent s_SizeLabel = EditorGUIUtility.TrTextContent("Size"); - internal static readonly GUIContent s_PleasePressAKey = EditorGUIUtility.TrTextContent("[Please press a key]"); + private static readonly GUIContent s_CenterLabel = L10n.TextContent("Center", null, null, null); + private static readonly GUIContent s_ExtentLabel = L10n.TextContent("Extent", null, null, null); + private static readonly GUIContent s_PositionLabel = L10n.TextContent("Position", null, null, null); + private static readonly GUIContent s_SizeLabel = L10n.TextContent("Size", null, null, null); + internal static readonly GUIContent s_PleasePressAKey = L10n.TextContent("[Please press a key]", null, null, null); - internal static readonly GUIContent s_ClipingPlanesLabel = EditorGUIUtility.TrTextContent("Clipping Planes", "The distances from the Camera where rendering starts and stops."); - internal static readonly GUIContent[] s_NearAndFarLabels = { EditorGUIUtility.TrTextContent("Near", "The closest point to the Camera where drawing occurs."), EditorGUIUtility.TrTextContent("Far", "The furthest point from the Camera that drawing occurs.") }; + internal static readonly GUIContent s_ClipingPlanesLabel = L10n.TextContent("Clipping Planes", "The distances from the Camera where rendering starts and stops.", null, null); + internal static readonly GUIContent[] s_NearAndFarLabels = { L10n.TextContent("Near", "The closest point to the Camera where drawing occurs.", null, null), L10n.TextContent("Far", "The furthest point from the Camera that drawing occurs.", null, null) }; internal const float kNearFarLabelsWidth = 35f; [NoAutoStaticsCleanup] // transient control id; value type @@ -273,7 +281,7 @@ private enum DragCandidateState [NoAutoStaticsCleanup] // auto-prop; transient bool state public static bool showMixedValue { get; set; } - private static readonly GUIContent s_MixedValueContent = EditorGUIUtility.TrTextContent("\u2014", "Mixed Values"); + private static readonly GUIContent s_MixedValueContent = L10n.TextContent("\u2014", "Mixed Values", null, null); internal static GUIContent mixedValueContent => s_MixedValueContent; @@ -882,21 +890,21 @@ static void ShowTextEditorPopupMenu() if (RecycledTextEditor.s_AllowContextCutOrPaste) { if ((s_RecycledEditor.hasSelection || s_DelayedTextEditor.hasSelection) && !s_RecycledEditor.isPasswordField && enabled && !EditorGUI.showMixedValue) - pm.AddItem(EditorGUIUtility.TrTextContent("Cut"), false, new PopupMenuEvent(EventCommandNames.Cut, GUIView.current).SendEvent); + pm.AddItem(L10n.TextContent("Cut", null, null, null), false, new PopupMenuEvent(EventCommandNames.Cut, GUIView.current).SendEvent); else - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Cut")); + pm.AddDisabledItem(L10n.TextContent("Cut", null, null, null)); } // Copy -- when GUI is disabled, allow Copy even with no selection (will copy everything) if (((s_RecycledEditor.hasSelection || s_DelayedTextEditor.hasSelection) || !enabled) && !s_RecycledEditor.isPasswordField && !EditorGUI.showMixedValue) - pm.AddItem(EditorGUIUtility.TrTextContent("Copy"), false, new PopupMenuEvent(EventCommandNames.Copy, GUIView.current).SendEvent); + pm.AddItem(L10n.TextContent("Copy", null, null, null), false, new PopupMenuEvent(EventCommandNames.Copy, GUIView.current).SendEvent); else - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Copy")); + pm.AddDisabledItem(L10n.TextContent("Copy", null, null, null)); // Paste if (s_RecycledEditor.CanPaste() && RecycledTextEditor.s_AllowContextCutOrPaste && enabled) { - pm.AddItem(EditorGUIUtility.TrTextContent("Paste"), false, new PopupMenuEvent(EventCommandNames.Paste, GUIView.current).SendEvent); + pm.AddItem(L10n.TextContent("Paste", null, null, null), false, new PopupMenuEvent(EventCommandNames.Paste, GUIView.current).SendEvent); } else { @@ -3513,7 +3521,7 @@ internal static GenericMenu FillPropertyContextMenu(SerializedProperty property, pm.AddSeparator(""); } - pm.AddItem(EditorGUIUtility.TrTextContent("Duplicate Array Element"), false, (a) => + pm.AddItem(L10n.TextContent("Duplicate Array Element", null, null, null), false, (a) => { var list = ReorderableList.GetReorderableListFromSerializedProperty(parentArrayProperty); @@ -3572,7 +3580,7 @@ internal static GenericMenu FillPropertyContextMenu(SerializedProperty property, } EditorGUIUtility.editingTextField = false; }, propertyWithPath); - pm.AddItem(EditorGUIUtility.TrTextContent("Delete Array Element"), false, (a) => + pm.AddItem(L10n.TextContent("Delete Array Element", null, null, null), false, (a) => { var list = ReorderableList.GetReorderableListFromSerializedProperty(parentArrayProperty); @@ -3646,7 +3654,7 @@ internal static GenericMenu FillPropertyContextMenu(SerializedProperty property, { if (pm.GetItemCount() > 0) pm.AddSeparator(""); - pm.AddItem(EditorGUIUtility.TrTextContent("Print Property Path"), false, e => Debug.Log(((SerializedProperty)e).propertyPath), propertyWithPath); + pm.AddItem(L10n.TextContent("Print Property Path", null, null, null), false, e => Debug.Log(((SerializedProperty)e).propertyPath), propertyWithPath); } // If property is a reference and we're using VCS, add item to check it out @@ -4184,8 +4192,14 @@ internal static void Popup(Rect position, SerializedProperty property, GUIConten } [AutoStaticsCleanupOnCodeReload] + // Scratch slot for one enum popup: assigned right before PopupInternal and cleared right after, so it + // is repopulated by the next enum popup. + [IgnoreForUAL0015("Per-call scratch slot, assigned and cleared around each enum popup")] private static Func s_CurrentCheckEnumEnabled; [AutoStaticsCleanupOnCodeReload] + // Enum data for the popup currently being shown; reassigned from the cached enum data on every enum + // popup call. + [IgnoreForUAL0015("Per-call enum data, reassigned on every enum popup call")] private static EnumData s_CurrentEnumData; private static bool CheckCurrentEnumTypeEnabled(int value) @@ -4340,6 +4354,9 @@ internal sealed partial class PopupCallbackInfo { // The global shared popup state [AutoStaticsCleanupOnCodeReload] + // In-flight popup state: a fresh instance is created every time a popup menu is displayed, and it is + // nulled once the selection has been handed back to OnGUI. + [IgnoreForUAL0015("Transient popup state recreated each time a popup menu is displayed")] public static PopupCallbackInfo instance = null; // Name of the command event sent from the popup menu to OnGUI when user has changed selection @@ -7513,8 +7530,14 @@ internal static void DrawLivePropertyBackground(Rect position, bool fixupRectFor } [AutoStaticsCleanupOnCodeReload] + // Deferred keyboard command for the property being drawn: set by BeginProperty and consumed and + // nulled again by EndProperty in the same GUI pass, so nothing needs to survive a reload. + [IgnoreForUAL0015("Per-GUI-pass slot, set on BeginProperty and consumed by EndProperty")] private static SerializedProperty s_PendingPropertyKeyboardHandling = null; [AutoStaticsCleanupOnCodeReload] + // Deferred delete command for the property being drawn: set while handling the event and executed and + // nulled once the property stack unwinds in the same GUI pass. + [IgnoreForUAL0015("Per-GUI-pass slot, set while handling the event and executed as the property stack unwinds")] private static SerializedProperty s_PendingPropertyDelete = null; private static void DoPropertyFieldKeyboardHandling(SerializedProperty property) @@ -7965,7 +7988,7 @@ internal static bool PropertyFieldInternal(Rect position, SerializedProperty pro return ScriptAttributeUtility.GetHandler(property).OnGUI(position, property, label, includeChildren); } - static readonly string s_ArrayMultiInfoFormatString = EditorGUIUtility.TrTextContent("This field cannot display arrays with more than {0} elements when multiple objects are selected.").text; + static readonly string s_ArrayMultiInfoFormatString = L10n.TextContent("This field cannot display arrays with more than {0} elements when multiple objects are selected.", null, null, null).text; static readonly GUIContent s_ArrayMultiInfoContent = new GUIContent(); static readonly ProfilerMarker s_EvalExpressionMarker = new ProfilerMarker("Inspector.EvaluateMultiExpression"); @@ -9497,15 +9520,17 @@ public static bool PropertyField(Rect position, SerializedProperty property, GUI // Cleanup is registered manually below instead of via [AutoStaticsCleanupOnCodeReload]. internal static class EnumNamesCache { - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + // Each cache below is reset by the hand-written __AutoStaticsCleanup() further down rather + // than by generated cleanup, so the analyzer must not manage them. + [NoAutoStaticsCleanup] static Dictionary s_EnumTypeLocalizedGUIContents = new(); - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + [NoAutoStaticsCleanup] static Dictionary s_SerializedPropertyEnumLocalizedGUIContents = new(); - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + [NoAutoStaticsCleanup] static Dictionary s_IsEnumTypeUsingFlagsAttribute = new(); - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + [NoAutoStaticsCleanup] static Dictionary s_SerializedPropertyEnumDisplayNames = new(); - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + [NoAutoStaticsCleanup] static Dictionary s_SerializedPropertyEnumNames = new(); [System.Runtime.CompilerServices.CompilerGenerated] @@ -9612,9 +9637,10 @@ internal static bool IsEnumTypeUsingFlagsAttribute(Type type) // Not partial: same compiler PDB bug as EnumNamesCache above. static class HelpButtonCache { - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + // Reset by the hand-written __AutoStaticsCleanup() below rather than generated cleanup. + [NoAutoStaticsCleanup] static Dictionary s_TypeIsPartOfTargetAssembliesMap = new(); - [NoAutoStaticsCleanup] // cleared manually by __AutoStaticsCleanup via the __autoCleanup registration below + [NoAutoStaticsCleanup] static Dictionary s_ObjectHasHelp = new(); [System.Runtime.CompilerServices.CompilerGenerated] @@ -9681,4 +9707,3 @@ internal static bool IsObjectPartOfTargetAssemblies(Object obj) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/EditorGUILayout.cs b/Editor/Mono/EditorGUILayout.cs index 29d5bb6a16..d7aa34fa60 100644 --- a/Editor/Mono/EditorGUILayout.cs +++ b/Editor/Mono/EditorGUILayout.cs @@ -29,7 +29,7 @@ sealed partial class EditorGUILayout internal static readonly SavedBool s_SelectedDefault = new SavedBool("Platform.ShownDefaultTab", true); - // Keep in sync with Tests/EditModeAndPlayModeTests/PlayerSettings/Assets/Editor/PlayerSettingsApplicationIdentifierTests.cs. + // Keep in sync with Modules/Core/Tests/UTFTests/PlayerSettings/Editor/PlayerSettingsApplicationIdentifierTests.cs. static readonly GUIStyle s_TabOnlyOne = "Tab onlyOne"; static readonly GUIStyle s_TabFirst = "Tab first"; static readonly GUIStyle s_TabMiddle = "Tab middle"; diff --git a/Editor/Mono/EditorGUIUtility.bindings.cs b/Editor/Mono/EditorGUIUtility.bindings.cs index c8795fc960..d2ec7882f5 100644 --- a/Editor/Mono/EditorGUIUtility.bindings.cs +++ b/Editor/Mono/EditorGUIUtility.bindings.cs @@ -119,7 +119,7 @@ internal static extern int skinIndex public static extern bool IsDisplayReferencedByCameras(int displayIndex); // Send an input event into the game. - public static extern void QueueGameViewInputEvent(Event evt); + public static extern void QueueGameViewInputEvent([NotNull] Event evt); [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [Obsolete("RenderGameViewCameras is no longer supported.Consider rendering cameras manually.", true)] diff --git a/Editor/Mono/EditorGUIUtility.cs b/Editor/Mono/EditorGUIUtility.cs index 5d14ac497d..49e9ddbf8d 100644 --- a/Editor/Mono/EditorGUIUtility.cs +++ b/Editor/Mono/EditorGUIUtility.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using System.Collections; using System.Collections.Generic; @@ -138,29 +137,6 @@ internal static Material GUITextureBlitSceneGUIMaterial [NoAutoStaticsCleanup] // GUIContent cache; re-populated on demand after reload static Hashtable s_TextGUIContents = new Hashtable(); - [NoAutoStaticsCleanup] // GUIContent cache; re-populated on demand after reload - static Hashtable s_GUIContents = new Hashtable(); - // Named groups get their own tables. The ungrouped ones are keyed on caller-supplied strings, - // including raw icon names and tooltips, so no prefix scheme can be proven not to collide. - [NoAutoStaticsCleanup] // GUIContent cache; re-populated on demand after reload - static Dictionary<(string group, string key), GUIContent> s_GroupGUIContents = new Dictionary<(string, string), GUIContent>(); - [NoAutoStaticsCleanup] // GUIContent cache; re-populated on demand after reload - static Dictionary<(string group, string key), GUIContent> s_GroupIconGUIContents = new Dictionary<(string, string), GUIContent>(); - - static GUIContent GetCachedContent(Hashtable ungrouped, Dictionary<(string, string), GUIContent> grouped, string groupName, string key) - { - if (groupName == null) - return key == null ? null : (GUIContent)ungrouped[key]; - return grouped.TryGetValue((groupName, key), out var gc) ? gc : null; - } - - static void SetCachedContent(Hashtable ungrouped, Dictionary<(string, string), GUIContent> grouped, string groupName, string key, GUIContent gc) - { - if (groupName == null) - ungrouped[key] = gc; - else - grouped[(groupName, key)] = gc; - } [NoAutoStaticsCleanup] // GUIContent icon cache; re-populated on demand after reload static Hashtable s_IconGUIContents = new Hashtable(); [NoAutoStaticsCleanup] // skinned icon cache; re-populated on demand after reload @@ -192,6 +168,11 @@ static void Initialize() [AutoStaticsCleanupOnCodeReload] internal static event Action contextualPropertyMenu; [AutoStaticsCleanupOnCodeReload] + // Subscribers re-register on their own: PropertyCallbackScope subscribes in its constructor and + // unsubscribes on dispose, the trail renderer and preset editors subscribe per enable/preview, + // and the localization package subscribes from an [InitializeOnLoad] cctor that re-runs when its + // assembly reloads, so the cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register from short-lived scopes or [InitializeOnLoad]")] internal static event Action beginProperty; internal static void BeginPropertyCallback(Rect totalRect, SerializedProperty property) @@ -589,58 +570,31 @@ public static GUIContent TrTextContent(string key, string text, string tooltip, return TrTextContent(key, text, tooltip, icon, null); } + // L10n owns the content cache, so everything here hands over to it. The key taking overload is + // the exception: it is public, and its caller chose the key, so that key has to be honoured. public static GUIContent TrTextContent(string key, string text, string tooltip, Texture icon, string groupName) { - GUIContent gc = GetCachedContent(s_GUIContents, s_GroupGUIContents, groupName, key); - if (gc == null) - { - gc = new GUIContent(L10n.Tr(text, groupName)); - if (tooltip != null) - { - gc.tooltip = L10n.Tr(tooltip, groupName); - } - if (icon != null) - { - gc.image = icon; - } - SetCachedContent(s_GUIContents, s_GroupGUIContents, groupName, key, gc); - } - return gc; + return L10n.CachedTextContent(groupName, key, text, tooltip, icon); } public static GUIContent TrTextContent(string text, string tooltip = null, Texture icon = null) { - string key = string.Format("{0}|{1}", text ?? "", tooltip ?? ""); - return TrTextContent(key, text, tooltip, icon, null); - } - - // The ungrouped keys have never included the texture, so two icons sharing a tooltip return - // each other's content. That is long standing, and changing it would move behaviour callers - // may rely on, so it stays. The grouped tables are new and do not inherit it. - static string WithIconIdentity(string groupName, string key, Texture icon) - { - if (groupName == null || icon == null) - return key; - return string.Format("{0}|{1}", key, icon.GetEntityId()); + return L10n.TextContentCore(null, text, tooltip, icon); } public static GUIContent TrTextContent(string text, string tooltip, string iconName) { - string key = iconName == null ? string.Format("{0}|{1}", text ?? "", tooltip ?? "") : - string.Format("{0}|{1}|{2}|{3}", text ?? "", tooltip ?? "", iconName, pixelsPerPoint); - return TrTextContent(key, text, tooltip, LoadIconRequired(iconName), null); + return L10n.TextContent(text, tooltip, iconName, null); } public static GUIContent TrTextContent(string text, Texture icon) { - return TrTextContent(text, null, icon); + return L10n.TextContent(text, icon, null); } public static GUIContent TrTextContent(string text, Texture icon, string groupName) { - string tooltip = null; - string key = string.Format("{0}|{1}", text ?? "", tooltip ?? ""); - return TrTextContent(WithIconIdentity(groupName, key, icon), text, tooltip, icon, groupName); + return L10n.TextContent(text, icon, groupName); } public static GUIContent TrTextContentWithIcon(string text, Texture icon) @@ -665,9 +619,7 @@ public static GUIContent TrTextContentWithIcon(string text, string tooltip, stri public static GUIContent TrTextContentWithIcon(string text, string tooltip, string iconName, string groupName) { - string key = iconName == null ? string.Format("{0}|{1}", text ?? "", tooltip ?? "") : - string.Format("{0}|{1}|{2}|{3}", text ?? "", tooltip ?? "", iconName, pixelsPerPoint); - return TrTextContent(key, text, tooltip, LoadIconRequired(iconName), groupName); + return L10n.TextContentWithIcon(text, tooltip, iconName, groupName); } public static GUIContent TrTextContentWithIcon(string text, string tooltip, Texture icon) @@ -677,8 +629,7 @@ public static GUIContent TrTextContentWithIcon(string text, string tooltip, Text public static GUIContent TrTextContentWithIcon(string text, string tooltip, Texture icon, string groupName) { - string key = string.Format("{0}|{1}", text ?? "", tooltip ?? ""); - return TrTextContent(WithIconIdentity(groupName, key, icon), text, tooltip, icon, groupName); + return L10n.TextContentWithIcon(text, tooltip, icon, groupName); } public static GUIContent TrTextContentWithIcon(string text, string tooltip, MessageType messageType) @@ -744,24 +695,7 @@ internal static GUIContent TrIconContent(string iconName, string tooltip, bool l internal static GUIContent TrIconContent(string iconName, string tooltip, bool lightenTexture, string groupName) { - string key = tooltip == null ? string.Format("{0}|{1}", iconName, pixelsPerPoint) : - string.Format("{0}|{1}|{2}", iconName, tooltip, pixelsPerPoint); - GUIContent gc = GetCachedContent(s_IconGUIContents, s_GroupIconGUIContents, groupName, key); - if (gc != null) - { - return gc; - } - gc = new GUIContent(); - - if (tooltip != null) - { - gc.tooltip = L10n.Tr(tooltip, groupName); - } - gc.image = LoadIconRequired(iconName); - if (lightenTexture && gc.image is Texture2D tex2D) - gc.image = LightenTexture(tex2D); - SetCachedContent(s_IconGUIContents, s_GroupIconGUIContents, groupName, key, gc); - return gc; + return L10n.IconContentNamed(groupName, iconName, tooltip, lightenTexture); } public static GUIContent TrIconContent(Texture icon, string tooltip = null) @@ -771,20 +705,7 @@ public static GUIContent TrIconContent(Texture icon, string tooltip = null) public static GUIContent TrIconContent(Texture icon, string tooltip, string groupName) { - string key = tooltip == null ? null : WithIconIdentity(groupName, tooltip, icon); - GUIContent gc = GetCachedContent(s_IconGUIContents, s_GroupIconGUIContents, groupName, key); - if (gc != null) - { - return gc; - } - gc = new GUIContent { image = icon }; - if (tooltip != null) - { - gc.tooltip = L10n.Tr(tooltip, groupName); - SetCachedContent(s_IconGUIContents, s_GroupIconGUIContents, groupName, key, gc); - } - - return gc; + return L10n.IconContent(icon, tooltip, groupName); } [ExcludeFromDocs] @@ -1005,7 +926,10 @@ static Texture2D InnerLoadGeneratedIconOrNormalIcon(string name) return tex; } - [NoAutoStaticsCleanup] // pure deterministic name+skinIndex -> prefixed-name string transform; no user-code or ALC references + [Unity.Scripting.LifecycleManagement.AutoStaticsCleanupOnCodeReload] + // Memo of derived icon names: GetIconNameForSkin re-derives and re-adds any missing entry on the + // next lookup, so the cache emptied on reload refills on demand. + [IgnoreForUAL0015("Derived icon-name memo, re-derived on the next miss by GetIconNameForSkin")] private static readonly Dictionary<(string, int), string> s_IconNamePerSkinCache = new(32); internal static string GetIconNameForSkin(string name, int in_SkinIndex) @@ -1042,6 +966,9 @@ internal static Texture2D LoadIconForSkin(string name, int in_SkinIndex) // Cache for icon paths from IconAttribute - avoids repeated reflection // Key is (Type, inherit) to handle both inherit=true and inherit=false cases correctly [Unity.Scripting.LifecycleManagement.AutoStaticsCleanupOnCodeReload] + // Reflection memo for IconAttribute paths: GetIconPathFromAttribute re-reads the attribute and + // re-adds a missing entry, so the cache emptied on reload refills on demand. + [IgnoreForUAL0015("IconAttribute reflection memo, re-read on the next miss")] private static Dictionary<(Type, bool), string> s_IconPathCache = new Dictionary<(Type, bool), string>(); [UsedByNativeCode] @@ -1427,10 +1354,7 @@ internal static GUIStyle GetBasicTextureStyle(Texture2D tex) internal static void NotifyLanguageChanged(SystemLanguage newLanguage) { s_TextGUIContents = new Hashtable(); - s_GUIContents = new Hashtable(); s_IconGUIContents = new Hashtable(); - s_GroupGUIContents.Clear(); - s_GroupIconGUIContents.Clear(); L10n.ClearCache(); EditorUtility.Internal_UpdateMenuTitleForLanguage(newLanguage); LocalizationDatabase.currentEditorLanguage = newLanguage; @@ -1551,6 +1475,12 @@ internal static void ResetGUIState() GUI.color = EditorUtility.activePlayModeTint; GUI.enabled = true; GUI.changed = false; + ResetPerPassState(); + } + + // The per-pass state not covered by the native GUIState; SavedEditorGUIState snapshots exactly this set. + internal static void ResetPerPassState() + { EditorGUI.indentLevel = 0; EditorGUI.ClearStacks(); fieldWidth = 0; diff --git a/Editor/Mono/EditorMode/ModeService.cs b/Editor/Mono/EditorMode/ModeService.cs index d0cc46c7f6..0697da52a7 100644 --- a/Editor/Mono/EditorMode/ModeService.cs +++ b/Editor/Mono/EditorMode/ModeService.cs @@ -133,6 +133,9 @@ public struct ModeChangedArgs public static string currentId => currentIndex == -1 || modes.Length == 0 ? k_DefaultModeId : modes[currentIndex].id; [AutoStaticsCleanupOnCodeReload] + // Re-derived on code load: Initialize calls LoadModes, which resolves the mode from session and + // project prefs and calls SetModeIndex again. + [IgnoreForUAL0015("Current mode index re-derived by LoadModes on every code load")] public static int currentIndex { get; private set; } [AutoStaticsCleanupOnCodeReload] private static ModeEntry[] modes { get; set; } = Array.Empty(); @@ -145,6 +148,9 @@ private static bool initialModeChanged } [AutoStaticsCleanupOnCodeReload] + // Initialize re-adds the mode service handlers on every code load and other subscribers attach + // through their own lifecycle, so the cleared invocation list refills itself. + [IgnoreForUAL0015("Event re-subscribed by Initialize on code load and by subscribers own lifecycle")] public static event Action modeChanged; [OnCodeLoaded] diff --git a/Editor/Mono/EditorPrefs.bindings.cs b/Editor/Mono/EditorPrefs.bindings.cs index eb1a6bce82..1f95ea094a 100644 --- a/Editor/Mono/EditorPrefs.bindings.cs +++ b/Editor/Mono/EditorPrefs.bindings.cs @@ -17,6 +17,9 @@ public sealed partial class EditorPrefs // long term solution is to make editor prefs read/writes threadsafe internal delegate void ValueWasUpdated(string key); [AutoStaticsCleanupOnCodeReload] + // PlayModeTintResolver re-subscribes from its [OnCodeLoaded] Initialize() on every code load, so + // the invocation list cleared here is repopulated before any pref can change. + [IgnoreForUAL0015("Event re-subscribed on every code load by PlayModeTintResolver.Initialize()")] internal static event ValueWasUpdated onValueWasUpdated; // Sets the value of the preference identified by /key/. diff --git a/Editor/Mono/EditorSceneManager.cs b/Editor/Mono/EditorSceneManager.cs index 4baa315e33..e73c030de6 100644 --- a/Editor/Mono/EditorSceneManager.cs +++ b/Editor/Mono/EditorSceneManager.cs @@ -31,6 +31,9 @@ public static event UnityAction activeSceneChangedInEditMode } [AutoStaticsCleanupOnCodeReload(CleanupStrategy = CleanupStrategy.Clear)] + // Backing store for the activeSceneChangedInEditMode event: subscribers attach through their own + // lifecycle and re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker> m_ActiveSceneChangedInEditModeEvent = new EventWithPerformanceTracker>($"{nameof(EditorSceneManager)}.{nameof(activeSceneChangedInEditMode)}"); private static void PlayModeStateChangedCallback(PlayModeStateChange state) diff --git a/Editor/Mono/EditorSettings.bindings.cs b/Editor/Mono/EditorSettings.bindings.cs index 603c410867..b32d6fa7c0 100644 --- a/Editor/Mono/EditorSettings.bindings.cs +++ b/Editor/Mono/EditorSettings.bindings.cs @@ -366,6 +366,10 @@ internal static bool useLegacyHierarchy [VisibleToOtherModules] [AutoStaticsCleanupOnCodeReload] + // The hierarchy windows subscribe in OnEnable and unsubscribe in OnDisable, and the + // HierarchyPreferences relay re-subscribes from its [OnCodeLoaded] Initialize() on every code + // load, so all handlers are restored after a reload. + [IgnoreForUAL0015("Subscribers re-register via OnEnable or [OnCodeLoaded] after a code reload")] internal static Action useLegacyHierarchyChanged; [StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)] diff --git a/Editor/Mono/EditorUserBuildSettingsQNX.bindings.cs b/Editor/Mono/EditorUserBuildSettingsQNX.bindings.cs index 005c73de10..fd7eca9290 100644 --- a/Editor/Mono/EditorUserBuildSettingsQNX.bindings.cs +++ b/Editor/Mono/EditorUserBuildSettingsQNX.bindings.cs @@ -14,4 +14,29 @@ public enum QNXOsVersion [UnityEngine.InspectorName("Neutrino RTOS 8.0")] Neutrino80 = 2, } + + /// + /// The network stack to build a QNX 7.1 player against. + /// + /// + /// QNX 7.1 provides two network stacks, and Unity builds a separate player variation for each one. + /// QNX 8.0 provides only io-sock, so it ignores this setting. + /// + /// requires a QNX 7.1 SDK that provides the io-sock headers. + /// A build against an SDK without them fails and names the SDK path in the error. + /// + public enum QNX71NetworkStack + { + /// + /// Uses the io-pkt network stack, which is the default on QNX 7.1. + /// + [UnityEngine.InspectorName("io-pkt (QNX 7.1 default)")] + IoPkt = 0, + + /// + /// Uses the io-sock network stack, which requires an io-sock enabled QNX 7.1 SDK. + /// + [UnityEngine.InspectorName("io-sock")] + IoSock = 1, + } } diff --git a/Editor/Mono/EditorUtility.cs b/Editor/Mono/EditorUtility.cs index cc4937480a..b0e983084b 100644 --- a/Editor/Mono/EditorUtility.cs +++ b/Editor/Mono/EditorUtility.cs @@ -74,6 +74,9 @@ public static string GetDialogOptOutMessage(DialogOptOutDecisionType dialogOptOu public delegate void SelectMenuItemFunction(object userData, string[] options, int selected); [AutoStaticsCleanupOnCodeReload] + // EditorContextualMenuManager re-registers its pointer-reset handler on every code load from its + // static constructor. + [IgnoreForUAL0015("Event re-subscribed on every code load by EditorContextualMenuManager's static constructor")] internal static event Action onResetMouseDown; public static bool LoadWindowLayout(string path) diff --git a/Editor/Mono/EditorWindow.cs b/Editor/Mono/EditorWindow.cs index b55e6b2adb..759be7a909 100644 --- a/Editor/Mono/EditorWindow.cs +++ b/Editor/Mono/EditorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: EditorWindowManagement not yet converted using UnityEngine; using Unity.Scripting.LifecycleManagement; using System.Linq; @@ -120,7 +119,9 @@ internal SerializableJsonDictionary viewDataDictionary if (m_EnableViewDataPersistence && m_ViewDataDictionary == null) { string editorPrefFileName = this.GetType().ToString(); +#pragma warning disable UAL0018 // m_ViewDataDictionary lives on the EditorWindow instance, which a code reload recreates along with this cache; the fresh window re-resolves its entry from the new view-data singleton on first access m_ViewDataDictionary = UIElements.EditorWindowViewData.instance[editorPrefFileName]; +#pragma warning restore UAL0018 } return m_ViewDataDictionary; } @@ -307,7 +308,7 @@ internal static GUIContent GetLocalizedTitleContentFromType(Type t) return EditorGUIUtility.TrTextContentWithIcon(attr.title, iconName); } - return EditorGUIUtility.TrTextContent(attr.title); + return L10n.TextContent(attr.title, null, null, null); } // Fallback to type name (Do not localize type name) @@ -466,6 +467,9 @@ static public EditorWindow focusedWindow static public Action focusedWindowChanged; [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] static public event Action windowFocusChanged; static internal void OnWindowFocusChanged() @@ -1333,9 +1337,7 @@ public EditorWindow() titleContent.text = GetType().ToString(); saveChangesMessage = $"{GetType()} has unsaved changes."; - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced UpdateWindowMenuListing(); - #pragma warning restore UAL0015 } void InitializeOverlayCanvas() @@ -1716,4 +1718,3 @@ public static int GetAntiAliasing(this EditorWindow window) } } } //namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ExternalPlayModeView/ExternalPlayModeView.cs b/Editor/Mono/ExternalPlayModeView/ExternalPlayModeView.cs index 0f4cdc781c..ad65a18eeb 100644 --- a/Editor/Mono/ExternalPlayModeView/ExternalPlayModeView.cs +++ b/Editor/Mono/ExternalPlayModeView/ExternalPlayModeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: PlayModeFramework not yet converted using System; using UnityEngine; using UnityEngine.Internal; @@ -170,4 +169,3 @@ public bool vSyncEnabled } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/FileUtil.cs b/Editor/Mono/FileUtil.cs index 1ce8c52c96..ca4a503ffd 100644 --- a/Editor/Mono/FileUtil.cs +++ b/Editor/Mono/FileUtil.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; using System.Text.RegularExpressions; using UnityEngine; using UnityEngine.Bindings; @@ -301,6 +302,82 @@ internal static string NiceWinPath(string unityPath) return Application.platform == RuntimePlatform.WindowsEditor ? unityPath.Replace("/", @"\") : unityPath; } + const int k_WindowsMaxPath = 260; + const string k_WindowsExtendedPathPrefix = @"\\?\"; + const string k_WindowsExtendedUncPathPrefix = @"\\?\UNC\"; + + /// + /// Returns in a form the platform file APIs accept regardless of its + /// length, by applying the Windows extended-length prefix to paths that would otherwise exceed + /// MAX_PATH. A no-op off Windows, and for paths that already fit. + /// + /// + /// Managed System.IO calls are not long-path aware, unlike the native file system layer, + /// so a deeply nested asset otherwise fails to open with . + /// + internal static string ToExtendedLengthPath(string path) + { + if (string.IsNullOrEmpty(path) || path.Length < k_WindowsMaxPath) + return path; + + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + return path; + + ReadOnlySpan span = path.AsSpan(); + + // The prefix suppresses normalisation, so it only works on a fully qualified, backslash-separated path. + if (span.Length >= 4 && IsSlash(span[0]) && IsSlash(span[1]) && span[2] == '?' && IsSlash(span[3])) + { + if (span.IndexOf('/') < 0) + return path; + + return string.Create(path.Length, path, static (dest, src) => + { + CopyReplacingSlashes(src.AsSpan(), dest); + }); + } + + if (span.Length >= 2 && IsSlash(span[0]) && IsSlash(span[1])) + { + return string.Create(k_WindowsExtendedUncPathPrefix.Length + path.Length - 2, path, static (dest, src) => + { + k_WindowsExtendedUncPathPrefix.AsSpan().CopyTo(dest); + CopyReplacingSlashes(src.AsSpan(2), dest.Slice(k_WindowsExtendedUncPathPrefix.Length)); + }); + } + + if (span.Length >= 3 && char.IsLetter(span[0]) && span[1] == ':' && IsSlash(span[2])) + { + return string.Create(k_WindowsExtendedPathPrefix.Length + path.Length, path, static (dest, src) => + { + k_WindowsExtendedPathPrefix.AsSpan().CopyTo(dest); + CopyReplacingSlashes(src.AsSpan(), dest.Slice(k_WindowsExtendedPathPrefix.Length)); + }); + } + + return path; + + static bool IsSlash(char c) => c == '\\' || c == '/'; + + static void CopyReplacingSlashes(ReadOnlySpan source, Span destination) + { + for (int i = 0; i < source.Length; i++) + destination[i] = source[i] == '/' ? '\\' : source[i]; + } + } + + /// + /// Resolves as does, but returns a + /// result that stays usable with managed System.IO calls when it exceeds MAX_PATH. + /// Note that such a result uses Windows path separators rather than Unity ones. + /// + /// The file or directory for which to obtain absolute path information. + [VisibleToOtherModules("UnityEditor.UIElementsModule")] + internal static string PathToAbsolutePathForFileIO(string path) + { + return ToExtendedLengthPath(PathToAbsolutePath(path)); + } + internal static string UnityGetFileNameWithoutExtension(string path) { // this is because on Windows \\ means network path, in unity all \ are converted to / diff --git a/Editor/Mono/GUI/AboutWindow.cs b/Editor/Mono/GUI/AboutWindow.cs index a24c226444..97d59511c0 100644 --- a/Editor/Mono/GUI/AboutWindow.cs +++ b/Editor/Mono/GUI/AboutWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: EditorWindowManagement not yet converted using System; using UnityEngine; using UnityEngine.Scripting; @@ -15,10 +14,6 @@ namespace UnityEditor { internal partial class AboutWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public AboutWindow() { } - #pragma warning restore UAL0015 - // s_Instance is nulled when the window is closed (OnDestroy) [AutoStaticsCleanupOnCodeReload] static AboutWindow s_Instance; @@ -286,4 +281,3 @@ private string FormatExtensionVersionString() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/AppStatusBar.cs b/Editor/Mono/GUI/AppStatusBar.cs index 50b128bc2e..1546554d7e 100644 --- a/Editor/Mono/GUI/AppStatusBar.cs +++ b/Editor/Mono/GUI/AppStatusBar.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ProgressWindow not yet converted using System; using System.Globalization; using System.Linq; @@ -39,8 +38,8 @@ internal static class Styles public static readonly GUIContent[] statusWheel; public static readonly GUIContent assemblyLock = EditorGUIUtility.IconContent("AssemblyLock", "|Assemblies are currently locked. Compilation will resume once they are unlocked"); - public static readonly GUIContent progressIcon = EditorGUIUtility.TrIconContent("Progress", "Show progress details"); - public static readonly GUIContent progressHideIcon = EditorGUIUtility.TrIconContent("Progress", "Hide progress details"); + public static readonly GUIContent progressIcon = L10n.IconContent("Progress", "Show progress details", null); + public static readonly GUIContent progressHideIcon = L10n.IconContent("Progress", "Hide progress details", null); static Styles() { @@ -492,4 +491,3 @@ internal static void StatusChangedImmediate() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/AssetPopupBackend.cs b/Editor/Mono/GUI/AssetPopupBackend.cs index 2e80cec370..51e1adfa50 100644 --- a/Editor/Mono/GUI/AssetPopupBackend.cs +++ b/Editor/Mono/GUI/AssetPopupBackend.cs @@ -130,7 +130,7 @@ public override void Cancelled(EntityId entityId, string pathName, string resour { // Create item gm.AddSeparator(""); - gm.AddItem(EditorGUIUtility.TrTextContent("Create New..."), false, delegate + gm.AddItem(L10n.TextContent("Create New...", null, null, null), false, delegate { var newAsset = Activator.CreateInstance(); var doCreate = ScriptableObject.CreateInstance(); diff --git a/Editor/Mono/GUI/AssetSaveDialog.cs b/Editor/Mono/GUI/AssetSaveDialog.cs index 95dd88994c..6d28974f83 100644 --- a/Editor/Mono/GUI/AssetSaveDialog.cs +++ b/Editor/Mono/GUI/AssetSaveDialog.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor; using UnityEditorInternal; @@ -21,10 +20,10 @@ class Styles public GUIStyle box = "OL Box"; public GUIStyle button = "LargeButton"; public GUIStyle labelHeight = "Label"; - public GUIContent saveSelected = EditorGUIUtility.TrTextContent("Save Selected"); - public GUIContent saveAll = EditorGUIUtility.TrTextContent("Save All"); - public GUIContent dontSave = EditorGUIUtility.TrTextContent("Don't Save"); - public GUIContent close = EditorGUIUtility.TrTextContent("Close"); + public GUIContent saveSelected = L10n.TextContent("Save Selected", null, null, null); + public GUIContent saveAll = L10n.TextContent("Save All", null, null, null); + public GUIContent dontSave = L10n.TextContent("Don't Save", null, null, null); + public GUIContent close = L10n.TextContent("Close", null, null, null); public float buttonWidth; public Styles() { @@ -81,7 +80,7 @@ public static void ShowWindow(string[] inAssets, out string[] assetsThatShouldBe } AssetSaveDialog win = EditorWindow.GetWindowDontShow(); - win.titleContent = EditorGUIUtility.TrTextContent("Save Assets"); + win.titleContent = L10n.TextContent("Save Assets", null, null, null); win.SetAssets(assets); win.minSize = new Vector2(400, 100); @@ -248,4 +247,3 @@ void RebuildLists(bool selected) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/CacheServerToggle.cs b/Editor/Mono/GUI/CacheServerToggle.cs index 0340edc8f3..63ec769325 100644 --- a/Editor/Mono/GUI/CacheServerToggle.cs +++ b/Editor/Mono/GUI/CacheServerToggle.cs @@ -2,29 +2,33 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor.Experimental; +using Unity.Scripting.LifecycleManagement; namespace UnityEditor { - internal class CacheServerToggle + internal partial class CacheServerToggle { private readonly GUIContent m_CacheServerNotEnabledContent; private readonly GUIContent m_CacheServerDisconnectedContent; private readonly GUIContent m_CacheServerConnectedContent; private readonly PopupLocation[] m_PopupLocation; - static CacheServerToggle() + // cacheServerConnectionChanged is cleared on code reload, so this subscription has to be + // re-established on every load. A static constructor would only run once per domain, and the status + // bar would stop repainting on cache server connection changes after the first reload. + [OnCodeLoaded] + static void Initialize() { AssetDatabase.cacheServerConnectionChanged += OnCacherServerConnectionChanged; } public CacheServerToggle() { - m_CacheServerNotEnabledContent = EditorGUIUtility.TrIconContent("CacheServerDisabled", "Cache Server disabled"); - m_CacheServerDisconnectedContent = EditorGUIUtility.TrIconContent("CacheServerDisconnected", "Cache Server disconnected"); - m_CacheServerConnectedContent = EditorGUIUtility.TrIconContent("CacheServerConnected", "Cache Server connected"); + m_CacheServerNotEnabledContent = L10n.IconContent("CacheServerDisabled", "Cache Server disabled", null); + m_CacheServerDisconnectedContent = L10n.IconContent("CacheServerDisconnected", "Cache Server disconnected", null); + m_CacheServerConnectedContent = L10n.IconContent("CacheServerConnected", "Cache Server connected", null); m_PopupLocation = new[] { PopupLocation.AboveAlignRight }; } @@ -61,4 +65,3 @@ private static void OnCacherServerConnectionChanged(CacheServerConnectionChanged } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/CacheServerWindow.cs b/Editor/Mono/GUI/CacheServerWindow.cs index 97667e0a30..25aa20d858 100644 --- a/Editor/Mono/GUI/CacheServerWindow.cs +++ b/Editor/Mono/GUI/CacheServerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor.Experimental; using System; @@ -30,14 +29,14 @@ internal class CacheServerWindow : PopupWindowContent public CacheServerWindow() { - m_StatusMessageDisabled = EditorGUIUtility.TrTextContent("No cache server connected"); - m_StatusMessageConnected = EditorGUIUtility.TrTextContent("Connected"); - m_StatusMessageError = EditorGUIUtility.TrTextContent("Attempting to reconnect"); - m_OpenProjectSettings = EditorGUIUtility.TrTextContent("Open Project Settings..."); + m_StatusMessageDisabled = L10n.TextContent("No cache server connected", null, null, null); + m_StatusMessageConnected = L10n.TextContent("Connected", null, null, null); + m_StatusMessageError = L10n.TextContent("Attempting to reconnect", null, null, null); + m_OpenProjectSettings = L10n.TextContent("Open Project Settings...", null, null, null); m_UploadArtifacts = EditorGUIUtility.TrTextContent("Upload Artifacts", m_UploadArtifactsDefaultToolip); m_UploadShaderCache = EditorGUIUtility.TrTextContent("Upload Shader Cache", m_UploadShaderCacheDefaultToolip); m_UploadAllRevisions = EditorGUIUtility.TrTextContent("Upload All Revisions", m_UploadAllRevisionsDefaultToolip); - m_RefreshIcon = EditorGUIUtility.TrIconContent("Refresh", "Refresh connection"); + m_RefreshIcon = L10n.IconContent("Refresh", "Refresh connection", null); m_WindowStyle = new GUIStyle { padding = new RectOffset(6, 6, 6, 6) }; } @@ -204,4 +203,3 @@ public override Vector2 GetWindowSize() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/ColorPicker.cs b/Editor/Mono/GUI/ColorPicker.cs index 653cc5ca17..4866b1eec7 100644 --- a/Editor/Mono/GUI/ColorPicker.cs +++ b/Editor/Mono/GUI/ColorPicker.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEditorInternal; @@ -15,10 +14,6 @@ namespace UnityEditor [VisibleToOtherModules("UnityEditor.GraphToolkitModule")] internal class ColorPicker : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal ColorPicker() {} - #pragma warning restore UAL0015 - private const string k_HeightPrefKey = "CPickerHeight"; private const string k_ShowDefaultsPrefKey = "CPDefaultsShow"; private const string k_ShowPresetsPrefKey = "CPPresetsShow"; @@ -500,12 +495,12 @@ static class Styles public static readonly GUIStyle selectedExposureSwatchStroke = "ColorPickerCurrentExposureSwatchBorder"; #pragma warning disable UAL0015 // only populates EditorGUIUtility's icon-name-per-skin cache, which repopulates on demand from a fixed icon name - public static readonly GUIContent eyeDropper = EditorGUIUtility.TrIconContent("EyeDropper.Large", "Pick a color from the screen."); + public static readonly GUIContent eyeDropper = L10n.IconContent("EyeDropper.Large", "Pick a color from the screen.", null); #pragma warning restore UAL0015 - public static readonly GUIContent exposureValue = EditorGUIUtility.TrTextContent("Intensity", "Number of stops to over- or under-expose the color. The intensity calculates each time based on the predefined max color component of 191 (0.749) when Color Picker opens."); - public static readonly GUIContent hexLabel = EditorGUIUtility.TrTextContent("Hexadecimal"); - public static readonly GUIContent presetsToggle = EditorGUIUtility.TrTextContent("Swatches"); - public static readonly GUIContent defaultsToggle = EditorGUIUtility.TrTextContent("Defaults"); + public static readonly GUIContent exposureValue = L10n.TextContent("Intensity", "Number of stops to over- or under-expose the color. The intensity calculates each time based on the predefined max color component of 191 (0.749) when Color Picker opens.", null, null); + public static readonly GUIContent hexLabel = L10n.TextContent("Hexadecimal", null, null, null); + public static readonly GUIContent presetsToggle = L10n.TextContent("Swatches", null, null, null); + public static readonly GUIContent defaultsToggle = L10n.TextContent("Defaults", null, null, null); public static readonly ScalableGUIContent originalColorSwatchFill = new ScalableGUIContent(string.Empty, "The original color. Click this swatch to reset the color picker to this value.", "ColorPicker-OriginalColor"); @@ -517,10 +512,10 @@ static class Styles public static readonly Texture2D alphaSliderCheckerBackground = EditorGUIUtility.LoadRequired("Previews/Textures/textureChecker.png") as Texture2D; - public static readonly GUIContent RGB0_255Mode = EditorGUIUtility.TrTextContent("RGB 0-255"); - public static readonly GUIContent RGB0_1Mode = EditorGUIUtility.TrTextContent("RGB 0-1.0"); - public static readonly GUIContent RGB0_InfMode = EditorGUIUtility.TrTextContent("RGB 0-Inf"); - public static readonly GUIContent RGBHSVMode = EditorGUIUtility.TrTextContent("HSV"); + public static readonly GUIContent RGB0_255Mode = L10n.TextContent("RGB 0-255", null, null, null); + public static readonly GUIContent RGB0_1Mode = L10n.TextContent("RGB 0-1.0", null, null, null); + public static readonly GUIContent RGB0_InfMode = L10n.TextContent("RGB 0-Inf", null, null, null); + public static readonly GUIContent RGBHSVMode = L10n.TextContent("HSV", null, null, null); public static readonly GUIContent[] sliderLDRModeLabels = new[] { @@ -1299,7 +1294,7 @@ static void Show(GUIView viewToUpdate, Action colorChangedCallback, Color cp.m_Color.exposureValue = 0; } - cp.titleContent = hdr ? EditorGUIUtility.TrTextContent("HDR Color") : EditorGUIUtility.TrTextContent("Color"); + cp.titleContent = hdr ? L10n.TextContent("HDR Color", null, null, null) : L10n.TextContent("Color", null, null, null); float height = EditorPrefs.GetInt(k_HeightPrefKey, (int)cp.position.height); cp.minSize = new Vector2(Styles.fixedWindowWidth, height); cp.maxSize = new Vector2(Styles.fixedWindowWidth, height); @@ -1376,6 +1371,9 @@ internal partial class EyeDropper : GUIView GUIView m_DelegateView; Texture2D m_Preview; [AutoStaticsCleanupOnCodeReload] + // Lazy singleton: the instance getter creates an EyeDropper when this is null and the constructor + // assigns it back, so the next eye-dropper session recreates it. + [IgnoreForUAL0015("Lazy singleton recreated by the instance getter after cleanup nulls it")] static EyeDropper s_Instance; [NoAutoStaticsCleanup] // value type, safe to persist; overwritten at start of each EyeDropper session private static Vector2 s_PickCoordinates = Vector2.zero; @@ -1635,4 +1633,3 @@ protected override bool OnFocus() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/DockArea.cs b/Editor/Mono/GUI/DockArea.cs index 64e5162438..2a9918404d 100644 --- a/Editor/Mono/GUI/DockArea.cs +++ b/Editor/Mono/GUI/DockArea.cs @@ -702,20 +702,20 @@ protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow vie if (view) { if (parent.window.showMode == ShowMode.MainWindow && view.CanMaximize()) - menu.AddItem(EditorGUIUtility.TrTextContent("Maximize"), !(parent is SplitView), Maximize, view); + menu.AddItem(L10n.TextContent("Maximize", null, null, null), !(parent is SplitView), Maximize, view); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Maximize")); + menu.AddDisabledItem(L10n.TextContent("Maximize", null, null, null)); } bool closeAllowed = (window.showMode != ShowMode.MainWindow || AllowTabAction()); if (closeAllowed) - menu.AddItem(EditorGUIUtility.TrTextContent("Close Tab"), false, Close, view); + menu.AddItem(L10n.TextContent("Close Tab", null, null, null), false, Close, view); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Close Tab")); + menu.AddDisabledItem(L10n.TextContent("Close Tab", null, null, null)); menu.AddSeparator(""); IEnumerable types = GetPaneTypes(); - GUIContent baseContent = EditorGUIUtility.TrTextContent("Add Tab"); + GUIContent baseContent = L10n.TextContent("Add Tab", null, null, null); foreach (Type t in types) { if (t == null) @@ -1396,12 +1396,12 @@ protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow win { base.AddDefaultItemsToMenu(menu, window); - menu.AddItem(EditorGUIUtility.TrTextContent("Maximize"), !(parent is SplitView), Unmaximize, window); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Close Tab")); + menu.AddItem(L10n.TextContent("Maximize", null, null, null), !(parent is SplitView), Unmaximize, window); + menu.AddDisabledItem(L10n.TextContent("Close Tab", null, null, null)); menu.AddSeparator(""); IEnumerable types = GetPaneTypes(); - GUIContent baseContent = EditorGUIUtility.TrTextContent("Add Tab"); + GUIContent baseContent = L10n.TextContent("Add Tab", null, null, null); foreach (Type t in types) { if (t == null) diff --git a/Editor/Mono/GUI/EditorGUIInternal.cs b/Editor/Mono/GUI/EditorGUIInternal.cs index 88848f4295..bd568bbe2d 100644 --- a/Editor/Mono/GUI/EditorGUIInternal.cs +++ b/Editor/Mono/GUI/EditorGUIInternal.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using Unity.Scripting.LifecycleManagement; using UnityEngine; using Object = UnityEngine.Object; @@ -23,7 +22,7 @@ static internal GUIStyle mixedToggleStyle private static GUIStyle s_MixedToggleStyle = EditorStyles.toggleMixed; const float kExposureSliderAbsoluteMax = 23.0f; - static readonly GUIContent s_ExposureIcon = EditorGUIUtility.TrIconContent("Exposure", "Controls the number of stops to over or under expose the texture."); + static readonly GUIContent s_ExposureIcon = L10n.IconContent("Exposure", "Controls the number of stops to over or under expose the texture.", null); static internal Rect GetTooltipRect() { return tooltipRect; } static internal string GetMouseTooltip() { return mouseTooltip; } @@ -110,4 +109,3 @@ internal sealed class EditorGUILayoutUtilityInternal : GUILayoutUtility } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/EditorStyles.cs b/Editor/Mono/GUI/EditorStyles.cs index f8a2415f88..63a10ea836 100644 --- a/Editor/Mono/GUI/EditorStyles.cs +++ b/Editor/Mono/GUI/EditorStyles.cs @@ -401,6 +401,30 @@ internal static GUIStyle searchFieldCancelButton internal static GUIStyle dropDownList { get { return s_Current.m_DropDownList; } } private GUIStyle m_DropDownList; + internal static GUIStyle advancedDropdownItem => s_Current.m_AdvancedDropdownItem; + private GUIStyle m_AdvancedDropdownItem; + + internal static GUIStyle advancedDropdownItemFaint => s_Current.m_AdvancedDropdownItemFaint; + private GUIStyle m_AdvancedDropdownItemFaint; + + internal static GUIStyle advancedDropdownBackground => s_Current.m_AdvancedDropdownBackground; + private GUIStyle m_AdvancedDropdownBackground; + + internal static GUIStyle advancedDropdownHeader => s_Current.m_AdvancedDropdownHeader; + private GUIStyle m_AdvancedDropdownHeader; + + internal static GUIStyle advancedDropdownCheckmark => s_Current.m_AdvancedDropdownCheckmark; + private GUIStyle m_AdvancedDropdownCheckmark; + + internal static GUIStyle defaultLineSeparator => s_Current.m_DefaultLineSeparator; + private GUIStyle m_DefaultLineSeparator; + + internal static GUIStyle arrowNavigationRight => s_Current.m_ArrowNavigationRight; + private GUIStyle m_ArrowNavigationRight; + + internal static GUIStyle arrowNavigationLeft => s_Current.m_ArrowNavigationLeft; + private GUIStyle m_ArrowNavigationLeft; + internal static GUIStyle dropDownToggleButton { get { return s_Current.m_DropDownToggleButton; } } private GUIStyle m_DropDownToggleButton; internal static GUIStyle minMaxStateDropdown { get { return s_Current.m_MinMaxStateDropdown; } } @@ -532,6 +556,21 @@ private void InitSharedStyles() m_ToolbarSlider = GetStyle("ToolbarSlider"); m_MinMaxHorizontalSliderThumb = GetStyle("MinMaxHorizontalSliderThumb"); m_DropDownList = GetStyle("DropDownButton"); + m_AdvancedDropdownItem = GetStyle("DD ItemStyle"); + var faintColor = EditorGUIUtility.isProSkin ? new Color(0.5f, 0.5f, 0.5f, 1f) : new Color(0.25f, 0.25f, 0.25f, 1f); + m_AdvancedDropdownItemFaint = new GUIStyle(m_AdvancedDropdownItem); + m_AdvancedDropdownItemFaint.normal.textColor = faintColor; + m_AdvancedDropdownItemFaint.hover.textColor = faintColor; + m_AdvancedDropdownItemFaint.active.textColor = faintColor; + m_AdvancedDropdownItemFaint.focused.textColor = faintColor; + m_AdvancedDropdownBackground = GetStyle("DD Background"); + // A copy: the ellipsis and padding tweaks must not mutate the skin's own style instance. + m_AdvancedDropdownHeader = new GUIStyle(GetStyle("DD HeaderStyle")) { clipping = TextClipping.Ellipsis }; + m_AdvancedDropdownHeader.padding.left = 20; + m_AdvancedDropdownCheckmark = GetStyle("DD ItemCheckmark"); + m_DefaultLineSeparator = GetStyle("DefaultLineSeparator"); + m_ArrowNavigationRight = GetStyle("ArrowNavigationRight"); + m_ArrowNavigationLeft = GetStyle("ArrowNavigationLeft"); m_DropDownToggleButton = GetStyle("DropDownToggleButton"); m_MinMaxStateDropdown = GetStyle("IN MinMaxStateDropdown"); m_ProgressBarBack = GetStyle("ProgressBarBack"); diff --git a/Editor/Mono/GUI/FallbackEditorWindow.cs b/Editor/Mono/GUI/FallbackEditorWindow.cs index 3d00404864..5773ac9365 100644 --- a/Editor/Mono/GUI/FallbackEditorWindow.cs +++ b/Editor/Mono/GUI/FallbackEditorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor; using System.Collections; @@ -18,7 +17,7 @@ internal class FallbackEditorWindow : EditorWindow void OnEnable() { - titleContent = EditorGUIUtility.TrTextContent("Failed to load"); + titleContent = L10n.TextContent("Failed to load", null, null, null); } void OnGUI() @@ -37,4 +36,3 @@ void OnGUI() } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/FlexibleMenu/FlexibleMenu.cs b/Editor/Mono/GUI/FlexibleMenu/FlexibleMenu.cs index 3e76a3d2b8..9d9e0911f4 100644 --- a/Editor/Mono/GUI/FlexibleMenu/FlexibleMenu.cs +++ b/Editor/Mono/GUI/FlexibleMenu/FlexibleMenu.cs @@ -13,7 +13,7 @@ internal partial class FlexibleMenu : PopupWindowContent class Styles { public GUIStyle menuItem = "MenuItem"; - public GUIContent plusButtonText = EditorGUIUtility.TrTextContent("", "Add New Item"); + public GUIContent plusButtonText = L10n.TextContent("", "Add New Item", null, null); } [NoAutoStaticsCleanup] // lazy GUIStyle/GUIContent cache; re-created on first access, safe to persist static Styles s_Styles; @@ -307,8 +307,8 @@ static public void Show(int itemIndex, FlexibleMenu caller) { s_Caller = caller; GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Edit..."), false, Edit, itemIndex); - menu.AddItem(EditorGUIUtility.TrTextContent("Delete"), false, Delete, itemIndex); + menu.AddItem(L10n.TextContent("Edit...", null, null, null), false, Edit, itemIndex); + menu.AddItem(L10n.TextContent("Delete", null, null, null), false, Delete, itemIndex); menu.ShowAsContext(); EditorGUIUtility.ExitGUI(); } diff --git a/Editor/Mono/GUI/GradientEditor.cs b/Editor/Mono/GUI/GradientEditor.cs index 684a814a91..547e2f5322 100644 --- a/Editor/Mono/GUI/GradientEditor.cs +++ b/Editor/Mono/GUI/GradientEditor.cs @@ -18,10 +18,10 @@ class Styles public GUIStyle downSwatch = "Grad Down Swatch"; public GUIStyle downSwatchOverlay = "Grad Down Swatch Overlay"; - public GUIContent modeText = EditorGUIUtility.TrTextContent("Mode"); - public GUIContent alphaText = EditorGUIUtility.TrTextContent("Alpha"); - public GUIContent colorText = EditorGUIUtility.TrTextContent("Color"); - public GUIContent locationText = EditorGUIUtility.TrTextContent("Location"); + public GUIContent modeText = L10n.TextContent("Mode", null, null, null); + public GUIContent alphaText = L10n.TextContent("Alpha", null, null, null); + public GUIContent colorText = L10n.TextContent("Color", null, null, null); + public GUIContent locationText = L10n.TextContent("Location", null, null, null); public GUIContent percentText = new GUIContent("%"); static GUIStyle GetStyle(string name) @@ -32,9 +32,9 @@ static GUIStyle GetStyle(string name) public readonly GUIContent[] modeTexts = { - EditorGUIUtility.TrTextContent("Blend (Classic)"), - EditorGUIUtility.TrTextContent("Blend (Perceptual)"), - EditorGUIUtility.TrTextContent("Fixed") + L10n.TextContent("Blend (Classic)", null, null, null), + L10n.TextContent("Blend (Perceptual)", null, null, null), + L10n.TextContent("Fixed", null, null, null) }; public readonly int[] modeValues = { diff --git a/Editor/Mono/GUI/GradientPicker.cs b/Editor/Mono/GUI/GradientPicker.cs index 78ae1a2721..21a8d2443d 100644 --- a/Editor/Mono/GUI/GradientPicker.cs +++ b/Editor/Mono/GUI/GradientPicker.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEditorInternal; using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -27,6 +26,9 @@ protected override void DrawPreset(PresetLibrary lib, Rect rect, object presetOb internal partial class GradientPicker : EditorWindow { [AutoStaticsCleanupOnCodeReload] + // Shared window cache: PrepareShow re-acquires the gradient editor window through GetWindow whenever + // this is null, so the next Show call restores it. + [IgnoreForUAL0015("Shared window cache re-acquired by PrepareShow through GetWindow")] private static GradientPicker s_GradientPicker; public static string presetsEditorPrefID { get { return "Gradient"; } } @@ -320,4 +322,3 @@ private void OnUndoPerformed(in UndoRedoInfo info) } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/ManagedDebuggerToggle.cs b/Editor/Mono/GUI/ManagedDebuggerToggle.cs index 54dc30a566..1f9766bccc 100644 --- a/Editor/Mono/GUI/ManagedDebuggerToggle.cs +++ b/Editor/Mono/GUI/ManagedDebuggerToggle.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor.Compilation; using UnityEditor.Scripting; @@ -18,9 +17,9 @@ internal class ManagedDebuggerToggle public ManagedDebuggerToggle() { - m_DebuggerAttachedContent = EditorGUIUtility.TrIconContent("DebuggerAttached", "Debugger Attached"); - m_DebuggerDisabledContent = EditorGUIUtility.TrIconContent("DebuggerDisabled", "Debugger Disabled"); - m_DebuggerEnabledContent = EditorGUIUtility.TrIconContent("DebuggerEnabled", "Debugger Enabled"); + m_DebuggerAttachedContent = L10n.IconContent("DebuggerAttached", "Debugger Attached", null); + m_DebuggerDisabledContent = L10n.IconContent("DebuggerDisabled", "Debugger Disabled", null); + m_DebuggerEnabledContent = L10n.IconContent("DebuggerEnabled", "Debugger Enabled", null); m_PopupLocation = new[] { PopupLocation.AboveAlignRight }; } @@ -55,4 +54,3 @@ private GUIContent GetDebuggerContent(bool debuggerAttached, CodeOptimization op } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/ManagedDebuggerWindow.cs b/Editor/Mono/GUI/ManagedDebuggerWindow.cs index 4603508424..62264cefdb 100644 --- a/Editor/Mono/GUI/ManagedDebuggerWindow.cs +++ b/Editor/Mono/GUI/ManagedDebuggerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor.Compilation; using UnityEditor.Scripting; @@ -29,7 +28,9 @@ internal class ManagedDebuggerWindow : PopupWindowContent static ManagedDebuggerWindow() { +#pragma warning disable UAL0015 // Mono-only subscription (this whole block is compiled out under CoreCLR): a Mono domain reload re-runs this static constructor, so the cleared invocation list refills; the CoreCLR code-reload cleanup never sees this subscriber SubscribeToDebuggerAttached(); +#pragma warning restore UAL0015 } public ManagedDebuggerWindow(CodeOptimization codeOptimization) @@ -38,16 +39,16 @@ public ManagedDebuggerWindow(CodeOptimization codeOptimization) if (CodeOptimization.Debug == m_CodeOptimization) { - m_CodeOptimizationTitleContent = EditorGUIUtility.TrTextContent("Mode: Debug"); - m_CodeOptimizationButtonContent = EditorGUIUtility.TrTextContent("Switch to release mode"); + m_CodeOptimizationTitleContent = L10n.TextContent("Mode: Debug", null, null, null); + m_CodeOptimizationButtonContent = L10n.TextContent("Switch to release mode", null, null, null); m_CodeOptimizationTextContent = (!EditorUtility.scriptCompilationFailed) ? EditorGUIUtility.TrTextContentWithIcon("Release mode disables C# debugging but improves C# performance.\nSwitching to release mode will recompile and reload all scripts.", EditorGUIUtility.GetHelpIcon(MessageType.Info)) : EditorGUIUtility.TrTextContentWithIcon("All compiler errors must be fixed before switching to release mode.", EditorGUIUtility.GetHelpIcon(MessageType.Error)); } else { - m_CodeOptimizationTitleContent = EditorGUIUtility.TrTextContent("Mode: Release"); - m_CodeOptimizationButtonContent = EditorGUIUtility.TrTextContent("Switch to debug mode"); + m_CodeOptimizationTitleContent = L10n.TextContent("Mode: Release", null, null, null); + m_CodeOptimizationButtonContent = L10n.TextContent("Switch to debug mode", null, null, null); m_CodeOptimizationTextContent = (!EditorUtility.scriptCompilationFailed) ? EditorGUIUtility.TrTextContentWithIcon("Debug mode enables C# debugging but reduces C# performance.\nSwitching to debug mode will recompile and reload all scripts.", EditorGUIUtility.GetHelpIcon(MessageType.Info)) : EditorGUIUtility.TrTextContentWithIcon("All compiler errors must be fixed before switching to debug mode.", EditorGUIUtility.GetHelpIcon(MessageType.Error)); @@ -165,4 +166,3 @@ private static void ToggleDebugState(CodeOptimization codeOptimization) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/MaskFieldGUI.cs b/Editor/Mono/GUI/MaskFieldGUI.cs index b6eab44518..b740a02d4c 100644 --- a/Editor/Mono/GUI/MaskFieldGUI.cs +++ b/Editor/Mono/GUI/MaskFieldGUI.cs @@ -20,6 +20,9 @@ private partial class MaskCallbackInfo { // The global shared popup state [AutoStaticsCleanupOnCodeReload] + // In-flight mask dropdown state: a fresh instance is created every time the mask menu is displayed and + // is only read while that menu hands its selection back to OnGUI. + [IgnoreForUAL0015("Transient mask-dropdown state recreated each time the menu is displayed")] public static MaskCallbackInfo m_Instance; // Name of the command event sent from the popup menu to OnGUI when user has changed selection diff --git a/Editor/Mono/GUI/ObjectField.cs b/Editor/Mono/GUI/ObjectField.cs index 80b16cb7ad..01b8b2521d 100644 --- a/Editor/Mono/GUI/ObjectField.cs +++ b/Editor/Mono/GUI/ObjectField.cs @@ -13,9 +13,9 @@ namespace UnityEditor { public sealed partial class EditorGUI { - static private readonly GUIContent s_SceneMismatch = EditorGUIUtility.TrTextContent("Scene mismatch (cross scene references not supported)"); - static private readonly GUIContent s_TypeMismatch = EditorGUIUtility.TrTextContent("Type mismatch"); - static private readonly GUIContent s_Select = EditorGUIUtility.TrTextContent("Select"); + static private readonly GUIContent s_SceneMismatch = L10n.TextContent("Scene mismatch (cross scene references not supported)", null, null, null); + static private readonly GUIContent s_TypeMismatch = L10n.TextContent("Type mismatch", null, null, null); + static private readonly GUIContent s_Select = L10n.TextContent("Select", null, null, null); const float k_NullObjectReferenceOpacity = 0.7f; diff --git a/Editor/Mono/GUI/PopupWindow.cs b/Editor/Mono/GUI/PopupWindow.cs index cc01f6c41e..3859438251 100644 --- a/Editor/Mono/GUI/PopupWindow.cs +++ b/Editor/Mono/GUI/PopupWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEngine.UIElements; using Unity.Scripting.LifecycleManagement; @@ -246,4 +245,3 @@ static PopupWindow FindExistingPopupWindow(PopupWindowContent windowContent) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/PopupWindowWithoutFocus.cs b/Editor/Mono/GUI/PopupWindowWithoutFocus.cs index 6406e0fc5a..299ffedec6 100644 --- a/Editor/Mono/GUI/PopupWindowWithoutFocus.cs +++ b/Editor/Mono/GUI/PopupWindowWithoutFocus.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEngine.Scripting; using UnityEditor; @@ -16,6 +15,9 @@ namespace UnityEditor partial class PopupWindowWithoutFocus : PopupWindow { [AutoStaticsCleanupOnCodeReload] + // Points at the popup window that is currently open; OnEnable assigns it and OnDisable clears it, and + // Show creates a new popup when it is null. + [IgnoreForUAL0015("Open-popup reference reassigned by OnEnable and recreated by Show when null")] static PopupWindowWithoutFocus s_PopupWindowWithoutFocus; bool hasBeenFocused = false; @@ -108,4 +110,3 @@ static bool OnGlobalMouseOrKeyEvent(EventType type, KeyCode keyCode, float mouse } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerIMGUI.cs b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerIMGUI.cs index f77ac7614c..8b6d60357f 100644 --- a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerIMGUI.cs +++ b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerIMGUI.cs @@ -2,12 +2,11 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted -#pragma warning disable UAL0010,UAL0011,UAL0012,UAL0013,UAL0014 // AutoStaticsCleanup: IMGUIControls not yet converted using System; using System.Collections.Generic; using System.Reflection; using UnityEngine; +using UnityEngine.Pool; using UnityEngine.UIElements; using UnityEditor.IMGUI.Controls; using UnityEditor.UIElements; @@ -91,6 +90,7 @@ static class Styles public const float k_EmptyLabelIndent = 18f; public const float k_IgnoredHelpBoxTopMargin = 4f; public const float k_IgnoredHelpBoxBottomMargin = 4f; + public const float k_FoldoutInfoRightInset = 4f; public static readonly GUIStyle headerBackground = "RL Header"; public static readonly GUIStyle boxBackground = "RL Background"; @@ -99,8 +99,8 @@ static class Styles public static readonly GUIStyle columnLabel = "MultiColumnHeader"; public static readonly GUIStyle columnLabelClipped = new GUIStyle(columnLabel) { clipping = TextClipping.Ellipsis }; - public static readonly GUIContent iconPlus = EditorGUIUtility.TrIconContent("Toolbar Plus"); - public static readonly GUIContent iconMinus = EditorGUIUtility.TrIconContent("Toolbar Minus"); + public static readonly GUIContent iconPlus = L10n.IconContent("Toolbar Plus", null, null); + public static readonly GUIContent iconMinus = L10n.IconContent("Toolbar Minus", null, null); public static readonly Texture2D sortAscIcon = EditorGUIUtility.LoadIconRequired("UIPackageResources/Images/scrollup_uielements.png"); public static readonly Texture2D sortDescIcon = EditorGUIUtility.LoadIconRequired("UIPackageResources/Images/scrolldown_uielements.png"); @@ -1151,8 +1151,19 @@ void DrawIgnoredHelpBox(Rect position, float startY, float helpBoxHeight, string float helpBoxY = startY + Styles.k_IgnoredHelpBoxTopMargin; var helpBoxRect = new Rect(position.x, helpBoxY, position.width, helpBoxHeight); - if (DrawerEditorGUI.HelpBoxWithButton(helpBoxRect, MessageType.Warning, helpBoxText, Texts.SelectFirstIgnoredButtonLabel)) + if (duplicateEntryIndices.Count + nullKeyEntryIndices.Count == 1) + { + if (DrawerEditorGUI.HelpBoxWithButton(helpBoxRect, MessageType.Warning, helpBoxText, Texts.SelectIgnoredButtonLabel)) + SelectFirstIgnored(); + return; + } + + int pressedIndex = DrawerEditorGUI.HelpBoxWithButtons(helpBoxRect, MessageType.Warning, helpBoxText, + Texts.SelectFirstIgnoredButtonLabel, Texts.SelectAllIgnoredButtonLabel); + if (pressedIndex == 0) SelectFirstIgnored(); + else if (pressedIndex == 1) + SelectAllIgnored(); } void SelectFirstIgnored() @@ -1168,6 +1179,22 @@ void SelectFirstIgnored() treeView.SetFocus(); } + void SelectAllIgnored() + { + if (treeView == null) + return; + + using (ListPool.Get(out var displayIndices)) + { + CollectIgnoredDisplayIndices(duplicateEntryIndices, nullKeyEntryIndices, sortedIndices, displayIndices); + if (displayIndices.Count == 0) + return; + + treeView.SetSelection(displayIndices, TreeViewSelectionOptions.RevealAndFrame); + treeView.SetFocus(); + } + } + void DrawFoldoutHeader(Rect rect, SerializedProperty property, GUIContent label) { int duplicateCount = duplicateEntryIndices?.Count ?? 0; @@ -1188,9 +1215,15 @@ void DrawFoldoutHeader(Rect rect, SerializedProperty property, GUIContent label) } var infoSize = EditorStyles.miniLabel.CalcSize(new GUIContent(infoText)); - var infoRect = new Rect(rect.xMax - infoSize.x - 4f, rect.y, infoSize.x, rect.height); + float infoRight = rect.xMax - Styles.k_FoldoutInfoRightInset; + float minInfoX = rect.x + EditorStyles.foldout.CalcSize(label).x; + float infoX = Mathf.Max(minInfoX, infoRight - infoSize.x); + var infoRect = new Rect(infoX, rect.y, infoRight - infoX, rect.height); property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, label, true); + if (infoRect.width <= 0f) + return; + using (new EditorGUI.DisabledScope(true)) EditorGUI.LabelField(infoRect, infoText, EditorStyles.miniLabel); } @@ -1655,7 +1688,7 @@ static void HandleContextMenu(Rect headerRect, DrawerInstanceIMGUI instance) var menu = new GenericMenu(); // The three layouts form a radio group (the active one is checked), - // followed by a separator and the "Reset to Defaults" action. + // followed by a separator and the "Reset Layout" action. AddLayoutItem(menu, Texts.TwoColumnsLayoutLabel, DictionaryLayout.TwoColumns, instance); AddLayoutItem(menu, Texts.OneColumnWithValueFoldoutLayoutLabel, DictionaryLayout.OneColumnWithValueFoldout, instance); AddLayoutItem(menu, Texts.OneColumnWithValueVisibleLayoutLabel, DictionaryLayout.OneColumnWithValueVisible, instance); @@ -1667,14 +1700,14 @@ static void HandleContextMenu(Rect headerRect, DrawerInstanceIMGUI instance) if (instance.header.HasCachedState) { - menu.AddItem(new GUIContent(Texts.ResetToDefaultsLabel), false, () => + menu.AddItem(new GUIContent(Texts.ResetLayoutLabel), false, () => { instance.ResetToDefaults(); }); } else { - menu.AddDisabledItem(new GUIContent(Texts.ResetToDefaultsLabel)); + menu.AddDisabledItem(new GUIContent(Texts.ResetLayoutLabel)); } menu.ShowAsContext(); @@ -2325,6 +2358,10 @@ internal static class DrawerEditorGUI const float k_HelpBoxButtonHeight = 20f; const float k_HelpBoxButtonMinWidth = 60f; const float k_HelpBoxButtonInset = 4f; + const float k_HelpBoxButtonSpacing = 2f; + // EditorStyles.helpBox scales its icon down by whatever room is left after the text, so the + // icon would otherwise change size with the message and feed back into the text height. + static readonly Vector2 k_HelpBoxIconSize = new Vector2(16f, 16f); // EditorStyles.helpBox uses MiddleLeft vertical alignment, which would vertically // center the icon+text inside the (intentionally taller-than-text) HelpBoxWithButton @@ -2350,8 +2387,11 @@ static GUIStyle helpBoxUpperLeft public static float GetHelpBoxWithButtonHeight(MessageType messageType, string message, float width) { var content = EditorGUIUtility.TempContent(message, EditorGUIUtility.GetHelpIcon(messageType)); - float textHeight = helpBoxUpperLeft.CalcHeight(content, width); - return textHeight + k_HelpBoxButtonGap + k_HelpBoxButtonHeight; + using (new EditorGUIUtility.IconSizeScope(k_HelpBoxIconSize)) + { + float textHeight = helpBoxUpperLeft.CalcHeight(content, width); + return textHeight + k_HelpBoxButtonGap + k_HelpBoxButtonHeight; + } } // Draws an EditorGUI.HelpBox-styled box (with the icon for the given MessageType) @@ -2359,17 +2399,39 @@ public static float GetHelpBoxWithButtonHeight(MessageType messageType, string m // button is pressed. Button width auto-fits the button text (clamped to k_HelpBoxButtonMinWidth) // using the same style we draw it with, so longer labels stay readable without truncation. public static bool HelpBoxWithButton(Rect position, MessageType messageType, string message, string buttonText) + { + return HelpBoxWithButtons(position, messageType, message, buttonText, null) == 0; + } + + public static int HelpBoxWithButtons( + Rect position, MessageType messageType, string message, string firstButtonText, string secondButtonText) { var content = EditorGUIUtility.TempContent(message, EditorGUIUtility.GetHelpIcon(messageType)); - GUI.Label(position, content, helpBoxUpperLeft); + using (new EditorGUIUtility.IconSizeScope(k_HelpBoxIconSize)) + GUI.Label(position, content, helpBoxUpperLeft); + + float rightEdge = position.xMax - k_HelpBoxButtonInset; + float minX = position.x + helpBoxUpperLeft.padding.left; + float buttonY = position.yMax - k_HelpBoxButtonHeight - k_HelpBoxButtonInset; + + int pressedIndex = -1; + if (DrawHelpBoxButton(secondButtonText, buttonY, minX, ref rightEdge)) + pressedIndex = 1; + if (DrawHelpBoxButton(firstButtonText, buttonY, minX, ref rightEdge)) + pressedIndex = 0; + return pressedIndex; + } + + static bool DrawHelpBoxButton(string buttonText, float buttonY, float minX, ref float rightEdge) + { + if (string.IsNullOrEmpty(buttonText) || rightEdge <= minX) + return false; var buttonContent = EditorGUIUtility.TempContent(buttonText); float buttonWidth = Mathf.Max(k_HelpBoxButtonMinWidth, GUI.skin.button.CalcSize(buttonContent).x); - var buttonRect = new Rect( - position.xMax - buttonWidth - k_HelpBoxButtonInset, - position.yMax - k_HelpBoxButtonHeight - k_HelpBoxButtonInset, - buttonWidth, - k_HelpBoxButtonHeight); + float buttonX = Mathf.Max(minX, rightEdge - buttonWidth); + var buttonRect = new Rect(buttonX, buttonY, rightEdge - buttonX, k_HelpBoxButtonHeight); + rightEdge = buttonX - k_HelpBoxButtonSpacing; return GUI.Button(buttonRect, buttonContent); } @@ -2393,5 +2455,3 @@ public void Dispose() } } // end of namespace -#pragma warning restore UAL0010,UAL0011,UAL0012,UAL0013,UAL0014 -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerShared.cs b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerShared.cs index 808e211b40..832bcf11c0 100644 --- a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerShared.cs +++ b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryDrawerShared.cs @@ -102,7 +102,7 @@ internal static class Texts // Foldout titles for a dictionary value that is itself a collection, replacing the "Value" displayName. internal static readonly string NestedArrayLabel = L10n.Tr("Array", null); internal static readonly string NestedListLabel = L10n.Tr("List", null); - internal static readonly string ResetToDefaultsLabel = L10n.Tr("Reset to Defaults", null); + internal static readonly string ResetLayoutLabel = L10n.Tr("Reset Layout", null); internal static readonly string MultiEditUnsupportedMessage = L10n.Tr("Dictionary: Multi-object editing is not supported.", null); // Entries are sorted by key, so a given row may correspond to different entries across targets, so edits could affect unrelated entries internal static readonly string DuplicateMarkerTooltip = L10n.Tr("An element with the same key already exists, so this element is excluded from the runtime dictionary.", null); internal static readonly string NullKeyMarkerTooltip = L10n.Tr("The key is null. A dictionary only stores entries with a valid (non-null) key, so this element is excluded from the runtime dictionary.", null); @@ -114,7 +114,9 @@ internal static class Texts internal static readonly string NullKeysHelpBoxSingle = L10n.Tr("1 null key ignored. A dictionary key can't be null.", null); internal static readonly string NullKeysHelpBoxFormat = L10n.Tr("{0} null keys ignored. A dictionary key can't be null.", null); internal static readonly string MixedIgnoredHelpBoxFormat = L10n.Tr("{0} entries ignored. Ensure all keys are unique and non-null.", null); - internal static readonly string SelectFirstIgnoredButtonLabel = L10n.Tr("Select", null); + internal static readonly string SelectIgnoredButtonLabel = L10n.Tr("Select", null); + internal static readonly string SelectAllIgnoredButtonLabel = L10n.Tr("Select All", null); + internal static readonly string SelectFirstIgnoredButtonLabel = L10n.Tr("Select First", null); // Header context-menu labels for the three DictionaryLayout values, shown as a // radio group (the active layout is checked). internal static readonly string TwoColumnsLayoutLabel = L10n.Tr("Two Columns", null); @@ -187,7 +189,7 @@ internal class DictionaryState // Disk-backed, persistent across editor sessions. Key: Hash128 of normalized path // ([\d+] → []) so container siblings share state (linked views). Eviction: only via - // explicit RemoveState from the "Reset to Defaults" context menu. + // explicit RemoveState from the "Reset Layout" context menu. [NoAutoStaticsCleanup] // disk-backed state cache, intentionally persistent across sessions; safe to persist static readonly StateCache s_StateCache = new StateCache("Library/StateCache/DictionaryDrawer/"); @@ -311,6 +313,9 @@ internal static void ClearCachedState(Hash128 stateCacheKey) internal static bool ShowSerializedOrder => SessionState.GetBool(k_SerializedOrderSessionKey, false); [AutoStaticsCleanupOnCodeReload] // stale view handlers after reload would pin the old ALC; views resubscribe on attach + // Subscribed when a DictionaryView attaches to a panel and unsubscribed when it detaches, so an + // empty handler list is correct while no view is attached; reattaching subscribes again. + [IgnoreForUAL0015("Subscribed and unsubscribed as DictionaryViews attach to and detach from a panel")] internal static event Action SerializedOrderChanged; internal static void SetShowSerializedOrder(bool value) @@ -601,6 +606,9 @@ public AssemblyLayoutEntry(DictionaryDisplayAttribute attribute, string declarin // a project. The key is the closed Dictionary targetType. // Statics reset on domain reload, so the cache rebuilds automatically when assemblies change. [AutoStaticsCleanupOnCodeReload] + // Lazy registry: GetAssemblyLayoutRegistry rescans the loaded assemblies whenever this is null, so + // the mapping cleared on reload is rebuilt from the assemblies that are actually loaded now. + [IgnoreForUAL0015("Lazy assembly-layout registry rebuilt by GetAssemblyLayoutRegistry on the next access")] static Dictionary s_AssemblyLayoutRegistry; static Dictionary GetAssemblyLayoutRegistry() @@ -840,6 +848,31 @@ internal static int FindFirstIgnoredDisplayIndex( return firstDisplayIndex == int.MaxValue ? -1 : firstDisplayIndex; } + internal static void CollectIgnoredDisplayIndices( + IEnumerable duplicateArrayIndices, + IEnumerable nullKeyArrayIndices, + SortedIndexMap sortedIndices, + List displayIndices) + { + displayIndices.Clear(); + AddDisplayIndices(duplicateArrayIndices, sortedIndices, displayIndices); + AddDisplayIndices(nullKeyArrayIndices, sortedIndices, displayIndices); + displayIndices.Sort(); + } + + static void AddDisplayIndices(IEnumerable arrayIndices, SortedIndexMap sortedIndices, List displayIndices) + { + if (arrayIndices == null) + return; + + foreach (var arrayIndex in arrayIndices) + { + if (!sortedIndices.ContainsArrayIndex(arrayIndex)) + continue; + displayIndices.Add(sortedIndices.ToDisplayIndex(arrayIndex)); + } + } + static int MinDisplayIndex(IEnumerable arrayIndices, SortedIndexMap sortedIndices, int current) { if (arrayIndices == null) diff --git a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryView.cs b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryView.cs index 2dff1143e8..746d43902d 100644 --- a/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryView.cs +++ b/Editor/Mono/GUI/PropertyDrawers/Dictionary/DictionaryView.cs @@ -2,12 +2,12 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using System.Collections.Generic; using Unity.Profiling; using Unity.Profiling.LowLevel; using UnityEditor.UIElements; +using UnityEngine.Pool; using UnityEngine.UIElements.Internal; using UnityEditor; using Unity.Scripting.LifecycleManagement; @@ -70,6 +70,7 @@ internal partial class DictionaryView : ListView static readonly string k_RowOneColumnClass = k_RowClass + "--one-column"; static readonly string k_HelpBoxClass = ussClassName + "__helpbox"; static readonly string k_HelpBoxIgnoredClass = ussClassName + "__helpbox--duplicates"; + static readonly string k_HelpBoxButtonRowClass = ussClassName + "__helpbox__buttons"; static readonly string k_HelpBoxSelectIgnoredClass = ussClassName + "__helpbox__select-duplicate"; static readonly string k_HeaderSpacerClass = ussClassName + "__header-spacer"; static readonly string k_ToggleLabelClass = ussClassName + "__toggle-label"; @@ -96,6 +97,8 @@ internal partial class DictionaryView : ListView // foldout, so the value is always visible and the header is plain, non-interactive text. static readonly string k_RowValueHeaderClass = ussClassName + "__row-value-header"; + const float k_ScrolledToBottomTolerance = 1f; + // Holds the live DictionaryView siblings that share one persisted DictionaryState — the elements of a // List/array/Dictionary of dictionaries, whose paths all normalize to the same key. Because // they share a single StateCache entry (avoiding an explosion of per-instance caches), a @@ -103,6 +106,9 @@ internal partial class DictionaryView : ListView // the others. // Key is the same Hash128 as s_StateCache (the normalized property path) [AutoStaticsCleanupOnCodeReload] + // Registry of live sibling views: each DictionaryView adds itself when it attaches to a panel + // and removes itself when it detaches, so reattaching the inspector refills it. + [IgnoreForUAL0015("Live sibling-view registry refilled as DictionaryViews reattach to a panel")] static readonly Dictionary> s_LinkedViews = new(); SerializedProperty m_DictionaryFieldProperty; @@ -137,6 +143,8 @@ internal partial class DictionaryView : ListView HelpBox m_MultiEditHelpBox; HelpBox m_IgnoredHelpBox; + Button m_SelectAllIgnoredButton; + Button m_SelectFirstIgnoredButton; readonly HashSet m_DuplicateEntryIndices = new(); readonly HashSet m_NullKeyEntryIndices = new(); @@ -425,6 +433,8 @@ void ResetBoundState() { m_IgnoredHelpBox.RemoveFromHierarchy(); m_IgnoredHelpBox = null; + m_SelectAllIgnoredButton = null; + m_SelectFirstIgnoredButton = null; } if (m_ListHeader != null) { @@ -560,16 +570,34 @@ void BuildIgnoredHelpBox(VisualElement parent) m_IgnoredHelpBox.AddToClassList(k_HelpBoxClass); m_IgnoredHelpBox.AddToClassList(k_HelpBoxIgnoredClass); - var selectButton = new Button(OnSelectFirstIgnoredClicked) - { - text = DictionaryDrawer.Texts.SelectFirstIgnoredButtonLabel - }; - selectButton.AddToClassList(k_HelpBoxSelectIgnoredClass); - m_IgnoredHelpBox.Add(selectButton); + var buttonRow = new VisualElement(); + buttonRow.AddToClassList(k_HelpBoxButtonRowClass); + m_IgnoredHelpBox.Add(buttonRow); + + m_SelectFirstIgnoredButton = new Button(OnSelectFirstIgnoredClicked); + m_SelectFirstIgnoredButton.AddToClassList(k_HelpBoxSelectIgnoredClass); + buttonRow.Add(m_SelectFirstIgnoredButton); + + m_SelectAllIgnoredButton = new Button(OnSelectAllIgnoredClicked); + m_SelectAllIgnoredButton.AddToClassList(k_HelpBoxSelectIgnoredClass); + buttonRow.Add(m_SelectAllIgnoredButton); parent.Add(m_IgnoredHelpBox); } + void UpdateIgnoredHelpBoxButtons(int ignoredCount) + { + if (m_SelectAllIgnoredButton == null || m_SelectFirstIgnoredButton == null) + return; + + bool isSingle = ignoredCount == 1; + m_SelectAllIgnoredButton.style.display = isSingle ? DisplayStyle.None : DisplayStyle.Flex; + m_SelectAllIgnoredButton.text = DictionaryDrawer.Texts.SelectAllIgnoredButtonLabel; + m_SelectFirstIgnoredButton.text = isSingle + ? DictionaryDrawer.Texts.SelectIgnoredButtonLabel + : DictionaryDrawer.Texts.SelectFirstIgnoredButtonLabel; + } + void OnSelectFirstIgnoredClicked() { int firstDisplayIndex = DictionaryDrawer.FindFirstIgnoredDisplayIndex(m_DuplicateEntryIndices, m_NullKeyEntryIndices, m_SortedIndexMap); @@ -581,6 +609,20 @@ void OnSelectFirstIgnoredClicked() FocusContentContainer(); } + void OnSelectAllIgnoredClicked() + { + using (ListPool.Get(out var displayIndices)) + { + DictionaryDrawer.CollectIgnoredDisplayIndices(m_DuplicateEntryIndices, m_NullKeyEntryIndices, m_SortedIndexMap, displayIndices); + if (displayIndices.Count == 0) + return; + + SetSelection(displayIndices); + ScrollToItem(displayIndices[0]); + FocusContentContainer(); + } + } + VisualElement BuildColumnHeader() { var fieldInfo = ScriptAttributeUtility.GetFieldInfoAndStaticTypeFromProperty(m_DictionaryFieldProperty, out var dictionaryType); @@ -628,7 +670,7 @@ VisualElement BuildColumnHeader() header.AddManipulator(new ContextualMenuManipulator(evt => { // The three layouts form a radio group (the active one is checked), followed - // by a separator and the "Reset to Defaults" action. + // by a separator and the "Reset Layout" action. AppendLayoutAction(evt.menu, DictionaryDrawer.Texts.TwoColumnsLayoutLabel, DictionaryLayout.TwoColumns); AppendLayoutAction(evt.menu, DictionaryDrawer.Texts.OneColumnWithValueFoldoutLayoutLabel, DictionaryLayout.OneColumnWithValueFoldout); AppendLayoutAction(evt.menu, DictionaryDrawer.Texts.OneColumnWithValueVisibleLayoutLabel, DictionaryLayout.OneColumnWithValueVisible); @@ -637,7 +679,7 @@ VisualElement BuildColumnHeader() _ => DictionaryDrawer.SetShowSerializedOrder(!DictionaryDrawer.ShowSerializedOrder), _ => DictionaryDrawer.ShowSerializedOrder ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal); evt.menu.AppendSeparator(); - evt.menu.AppendAction(DictionaryDrawer.Texts.ResetToDefaultsLabel, + evt.menu.AppendAction(DictionaryDrawer.Texts.ResetLayoutLabel, _ => ResetToDefaults(), _ => DictionaryDrawer.HasCachedState(m_StateCacheKey) ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled); })); @@ -1531,6 +1573,7 @@ void UpdateHeaderInfo() if (hasIgnored) { m_IgnoredHelpBox.text = DictionaryDrawer.Texts.GetIgnoredHelpBoxText(duplicateCount, nullKeyCount); + UpdateIgnoredHelpBoxButtons(ignoredCount); m_IgnoredHelpBox.style.display = DisplayStyle.Flex; } else @@ -1545,6 +1588,8 @@ void OnRemoveClicked() var selected = SelectedDisplayIndices; int newSelectedDisplayIndex = selected.Count == 1 ? selected[0] : -1; + bool wasScrolledToBottom = IsScrolledToBottom(); + var removed = selected.Count > 0 ? DictionaryDrawer.RemoveEntriesAtDisplayIndices(m_ArrayProperty, selected, m_SortedIndexMap) : DictionaryDrawer.RemoveEntryAtDisplayIndex(m_ArrayProperty, m_ArrayProperty.arraySize - 1, m_SortedIndexMap); @@ -1556,12 +1601,37 @@ void OnRemoveClicked() UpdateHeaderInfo(); int newSize = displayedItemCount; - if (newSize <= 0 || newSelectedDisplayIndex < 0) + int selectedDisplayIndex = newSize > 0 && newSelectedDisplayIndex >= 0 + ? Mathf.Min(newSelectedDisplayIndex, newSize - 1) + : -1; + + if (selectedDisplayIndex < 0) ClearSelection(); else - SetSelection(Mathf.Min(newSelectedDisplayIndex, newSize - 1)); + SetSelection(selectedDisplayIndex); FocusContentContainer(); + + bool stickToBottom = wasScrolledToBottom && newSize > 0 && + (selectedDisplayIndex < 0 || selectedDisplayIndex == newSize - 1); + + if (stickToBottom) + { + schedule.Execute(() => ScrollToItem(-1)); + } + else if (selectedDisplayIndex >= 0) + { + schedule.Execute(() => ScrollToItem(selectedDisplayIndex)); + } + } + + bool IsScrolledToBottom() + { + var scroller = scrollView?.verticalScroller; + if (scroller == null || scroller.highValue <= 0f) + return false; + + return scroller.value >= scroller.highValue - k_ScrolledToBottomTolerance; } /// @@ -1678,4 +1748,3 @@ void OnPointerCaptureOut(PointerCaptureOutEvent evt) } } // end of namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/RenameOverlay.cs b/Editor/Mono/GUI/RenameOverlay.cs index eb8c8a66cc..6da6b3e778 100644 --- a/Editor/Mono/GUI/RenameOverlay.cs +++ b/Editor/Mono/GUI/RenameOverlay.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using UnityEngine; using UnityEditorInternal; @@ -454,4 +453,3 @@ public void Reset() } } } // end namespace UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/ReorderableList.cs b/Editor/Mono/GUI/ReorderableList.cs index b9fd4c5c6d..f30179be40 100644 --- a/Editor/Mono/GUI/ReorderableList.cs +++ b/Editor/Mono/GUI/ReorderableList.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEditor; using System; @@ -115,6 +114,9 @@ public bool Set(SerializedProperty property, float height, float offset) internal bool m_PropertyCacheValid = false; PropertyCacheEntry[] m_PropertyCache = Array.Empty(); [AutoStaticsCleanupOnCodeReload] + // Transient invalidation markers: InvalidateParentCaches re-adds a path whenever a nested list + // changes and the consuming list removes its own entry, so the list is empty at rest. + [IgnoreForUAL0015("Transient invalidation markers re-added by InvalidateParentCaches")] static List m_OutdatedProperties = new List(); static string GetParentListPath(string propertyPath) @@ -165,9 +167,9 @@ internal void InvalidateForGUI() // class for default rendering and behavior of reorderable list - stores styles and is statically available as s_Defaults public class Defaults { - public GUIContent iconToolbarPlus = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add to the list"); - public GUIContent iconToolbarPlusMore = EditorGUIUtility.TrIconContent("Toolbar Plus More", "Choose to add to the list"); - public GUIContent iconToolbarMinus = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove selection from the list"); + public GUIContent iconToolbarPlus = L10n.IconContent("Toolbar Plus", "Add to the list", null); + public GUIContent iconToolbarPlusMore = L10n.IconContent("Toolbar Plus More", "Choose to add to the list", null); + public GUIContent iconToolbarMinus = L10n.IconContent("Toolbar Minus", "Remove selection from the list", null); public readonly GUIStyle draggingHandle = "RL DragHandle"; public readonly GUIStyle headerBackground = "RL Header"; public readonly GUIStyle emptyHeaderBackground = "RL Empty Header"; @@ -183,7 +185,7 @@ public class Defaults const float elementPadding = 2; private int ArrayCountInPropertyPath(SerializedProperty prop) => Regex.Matches(prop.propertyPath, ".Array.data").Count; private float FieldLabelSize(Rect r, SerializedProperty prop) => r.width * 0.45f - 20 - ArrayCountInPropertyPath(prop) * 22 + (prop.depth < 2 ? 7 : 0); - private static readonly GUIContent s_ListIsEmpty = EditorGUIUtility.TrTextContent("List is Empty"); + private static readonly GUIContent s_ListIsEmpty = L10n.TextContent("List is Empty", null, null, null); internal static readonly string undoAdd = "Add Element To Array"; internal static readonly string undoRemove = "Remove Element From Array"; internal static readonly string undoMove = "Reorder Element In Array"; @@ -196,7 +198,7 @@ public Defaults() defaultLabel.alignment = TextAnchor.MiddleCenter; } - private static GUIContent OverMaxMultiEditLimit(int maxMultiEditElementCount) => EditorGUIUtility.TrTextContent($"This field cannot display arrays with more than {maxMultiEditElementCount} elements when multiple objects are selected."); + private static GUIContent OverMaxMultiEditLimit(int maxMultiEditElementCount) => L10n.TextContent($"This field cannot display arrays with more than {maxMultiEditElementCount} elements when multiple objects are selected.", null, null, null); // draw the default footer public void DrawFooter(Rect rect, ReorderableList list) @@ -446,6 +448,9 @@ public static Defaults defaultBehaviours } [AutoStaticsCleanupOnCodeReload] + // Live-instance registry: every ReorderableList adds a weak reference to itself while initializing + // from its constructors, so the list cleared on reload refills as lists are recreated. + [IgnoreForUAL0015("Live-instance registry, refilled by each ReorderableList constructor")] static List> s_Instances = new List>(); internal static void InvalidateExistingListCaches() => s_Instances.ForEach(list => { @@ -1460,4 +1465,3 @@ public bool HasKeyboardControl() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/Toolbars/Toolbar.cs b/Editor/Mono/GUI/Toolbars/Toolbar.cs index 22be8ae0a4..3fa71cc7cb 100644 --- a/Editor/Mono/GUI/Toolbars/Toolbar.cs +++ b/Editor/Mono/GUI/Toolbars/Toolbar.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using UnityEngine; using UnityEngine.Scripting; using UnityEditorInternal; @@ -108,13 +107,18 @@ void Update() [EditorBrowsable(EditorBrowsableState.Never)] internal static readonly string editModeName = L10n.Tr("Edit Mode", null); [EditorBrowsable(EditorBrowsableState.Never)] - internal static readonly string menuItemSearchName = L10n.Tr("Add Menu Item Shortcut", null); + internal static readonly string menuItemSearchName = L10n.Tr("Menu Items", null); [EditorBrowsable(EditorBrowsableState.Never)] internal static readonly string showAllName = L10n.Tr("Show All", null); [EditorBrowsable(EditorBrowsableState.Never)] + internal static readonly string mainToolbarElementSearchName = L10n.Tr("Toolbar Elements", null); + [EditorBrowsable(EditorBrowsableState.Never)] internal static readonly string hideAllName = L10n.Tr("Hide All", null); [AutoStaticsCleanupOnCodeReload] + // Points at the live main toolbar window: Toolbar.OnEnable creates it again after a code reload and + // the MainToolbarWindow constructor re-assigns the slot. + [IgnoreForUAL0015("Window instance slot re-assigned by the constructor when Toolbar.OnEnable recreates it")] internal static MainToolbarWindow instance; MainToolbarAnalytics m_Analytics; @@ -130,22 +134,22 @@ void Update() #pragma warning restore UAL0015 } + // UUM-116278: re-normalizes '\\' to '/' on every iteration, since Path.GetDirectoryName reintroduces it each call. + static void AddAncestorPaths(string leafPath, HashSet paths) + { + var path = Path.GetDirectoryName(leafPath)?.Replace(Path.DirectorySeparatorChar, '/'); + while (!string.IsNullOrEmpty(path)) + { + paths.Add(path); + path = Path.GetDirectoryName(path)?.Replace(Path.DirectorySeparatorChar, '/'); + } + } + string[] GetAllUniquePaths() { HashSet uniquePaths = new HashSet(); foreach (var def in MainToolbar.GetAllElementDefinitions()) - { - var path = Path.GetDirectoryName(def.attr.path); - // UUM-116278: On Windows leaving the '\\' will result in a new empty menu later in - // the menu creation as dropdown.AddItem uses '/' as a submenu separator. - path = path.Replace(Path.DirectorySeparatorChar, '/'); - - while (!string.IsNullOrEmpty(path)) - { - uniquePaths.Add(path); - path = Path.GetDirectoryName(path); - } - } + AddAncestorPaths(def.attr.path, uniquePaths); string[] results = new string[uniquePaths.Count]; int count = 0; @@ -160,9 +164,9 @@ string[] GetAllUniquePaths() void OnEnable() { - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // m_Parent lives on this MainToolbarWindow, which a code reload recreates; OnEnable runs again on the new instance and re-reads the toolbar rebuilt by the same reload m_Parent = Toolbar.instance; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 m_UniqueMenuCategories = GetAllUniquePaths(); @@ -255,75 +259,46 @@ void ToggleEditMode() } [AutoStaticsCleanupOnCodeReload] - internal static event Action menuItemSearchRequested; + internal static event Action pickerRequested; void OpenMenuItemSearch() { - menuItemSearchRequested?.Invoke(); + RaisePickerRequested(MainToolbar.PickerMode.MenuItems, string.Empty); + } + + void OpenMainToolbarElementSearch() + { + RaisePickerRequested(MainToolbar.PickerMode.ToolbarElements, string.Empty); } + internal static void RaisePickerRequested(MainToolbar.PickerMode mode, string filter) => pickerRequested?.Invoke(mode, filter); + [NoAutoStaticsCleanup] // Scratch set of menu category paths, rebuilt (??= / Clear) each menu population; strings only, safe to persist. static HashSet s_UsedMenuCategoryPaths; void PopulateMenuWithOverlays(AbstractGenericMenu dropdown, bool includeUtilityFunctions = true) { - var overlays = new List<(Overlay overlay, MainToolbarElementAttribute attrib)>(); - - s_UnityOnlyOverlays.Clear(); - foreach (var overlay in overlayCanvas.overlays) - { - var mto = overlay as MainToolbarOverlay; - if (mto.createElementMethod == null) - continue; // Dynamically-created overlay (e.g. a pinned menu item); not managed from this menu. - - if (!mto.IsAvailable()) - continue; - - overlays.Add((overlay, mto.createElementMethod.GetCustomAttribute())); - if (mto.createElementMethod.GetCustomAttribute() != null) - s_UnityOnlyOverlays.Add(overlay); - } - - overlays.Sort((a, b) => - { - // Group into unity vs non-unity first - if (s_UnityOnlyOverlays.Contains(a.overlay) && !s_UnityOnlyOverlays.Contains(b.overlay)) - return -1; - if (s_UnityOnlyOverlays.Contains(b.overlay) && !s_UnityOnlyOverlays.Contains(a.overlay)) - return 1; - - // Sort by menu priority first - var result = a.attrib.menuPriority.CompareTo(b.attrib.menuPriority); - if (result != 0) - return result; - - // Then alphabetically by path - result = String.Compare(a.attrib.path, b.attrib.path, StringComparison.OrdinalIgnoreCase); - if (result != 0) - return result; - - // Then by dock position and index - return ((int)a.attrib.defaultDockPosition * 100 + a.attrib.defaultDockIndex) - .CompareTo((int)b.attrib.defaultDockPosition * 100 + b.attrib.defaultDockIndex); - }); + var overlays = MainToolbar.GetSortedAvailableOverlays(); s_UsedMenuCategoryPaths ??= new(); s_UsedMenuCategoryPaths.Clear(); - Overlay prevOverlay = null; - foreach (var pair in overlays) + (Overlay overlay, bool isUnityOnly)? prev = null; + foreach (var entry in overlays) { - if (s_UnityOnlyOverlays.Contains(prevOverlay) && !s_UnityOnlyOverlays.Contains(pair.overlay)) + if (prev.HasValue && prev.Value.isUnityOnly && !entry.isUnityOnly) dropdown.AddSeparator(""); - if (pair.attrib.path != Toolbar.deprecatedElementsId || Toolbar.instance.deprecatedElements.Count > 0) + if (entry.attrib.path != Toolbar.deprecatedElementsId || Toolbar.instance.deprecatedElements.Count > 0) { - dropdown.AddItem(pair.attrib.path, pair.overlay.displayed, () => + var overlay = entry.overlay; + dropdown.AddItem(entry.attrib.path, overlay.displayed, () => { - pair.overlay.displayed = !pair.overlay.displayed; + overlay.displayed = !overlay.displayed; }); - s_UsedMenuCategoryPaths.Add(Path.GetDirectoryName(pair.attrib.path)); + // Marks every ancestor category used, not just the immediate one, so a category holding only subcategories still gets Show/Hide All. + AddAncestorPaths(entry.attrib.path, s_UsedMenuCategoryPaths); } - prevOverlay = pair.overlay; + prev = (entry.overlay, entry.isUnityOnly); } if (includeUtilityFunctions) @@ -349,14 +324,13 @@ void PopulateFullMenu(AbstractGenericMenu dropdown) PopulateMenuWithOverlays(dropdown); dropdown.AddSeparator(""); + dropdown.AddItem(mainToolbarElementSearchName, false, OpenMainToolbarElementSearch); dropdown.AddItem(menuItemSearchName, false, OpenMenuItemSearch); dropdown.AddSeparator(""); OverlayPresetManager.GenerateMenu(dropdown, "Presets/", this, false, CheckIfCanvasChangedSinceLastPreset, new UnityOnlyToolbarPreset()); } - [AutoStaticsCleanupOnCodeReload] - static HashSet s_UnityOnlyOverlays = new(); internal void ShowMenu(Rect dropdownRect) { var dropdown = rootVisualElement.panel.CreateMenu(); @@ -375,6 +349,9 @@ bool CheckIfCanvasChangedSinceLastPreset(OverlayCanvas canvas) partial class Toolbar : HostView { [AutoStaticsCleanupOnCodeReload] + // Points at the live toolbar host view, which a code reload recreates; the Toolbar constructor + // re-assigns the slot and every reader null-checks it first. + [IgnoreForUAL0015("Toolbar instance slot re-assigned by the constructor when the host view is recreated")] static Toolbar s_Instance; public const float ToolbarHeight = 36f; @@ -445,10 +422,18 @@ internal static void AddSubToolbar(SubToolbar subToolbar) internal const string deprecatedElementsId = "Unsupported User Elements"; [Obsolete($"Use {nameof(instance)} instead")] [AutoStaticsCleanupOnCodeReload] + // Second slot pointing at the live toolbar host view, assigned alongside s_Instance by the Toolbar + // constructor when a code reload recreates the view. + [IgnoreForUAL0015("Toolbar instance slot re-assigned by the constructor when the host view is recreated")] internal static Toolbar get; List m_DeprecatedElements = new List(); internal IReadOnlyList deprecatedElements => m_DeprecatedElements; + // Legacy fake-toolbar population hook (deprecated AddSubToolbar path, same as s_SubToolbars above). + // Cleared on reload like the other toolbar events: the in-repo subscriber (DeprecatedElementsToolbar + // in SubToolbarZone.cs) re-subscribes from its [OnCodeLoaded] Initialize(); persisting the list would + // keep third-party delegates alive and pin their unloaded assemblies. [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Event re-subscribed on every code load by DeprecatedElementsToolbar's [OnCodeLoaded] Initialize()")] internal static event Action populateFakeToolbar; void InitializeFakeHierarchyForDeprecatedToolbarHacks() @@ -513,4 +498,3 @@ internal override void OnChildAdded(VisualElement ve) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/TreeView/GameObjectTreeViewDataSource.cs b/Editor/Mono/GUI/TreeView/GameObjectTreeViewDataSource.cs index e95953dd93..b3e0c1c590 100644 --- a/Editor/Mono/GUI/TreeView/GameObjectTreeViewDataSource.cs +++ b/Editor/Mono/GUI/TreeView/GameObjectTreeViewDataSource.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; using UnityEngine.SceneManagement; using UnityEditor.SceneManagement; @@ -720,4 +719,3 @@ public Scene GetLastScene() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs b/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs index 45ada14578..1be991bb8b 100644 --- a/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs +++ b/Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -788,4 +787,3 @@ public float PrefabModeButton(GameObjectTreeViewItem item, Rect selectionRect) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs b/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs index 2d94c49973..0d883de081 100644 --- a/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs +++ b/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs @@ -525,7 +525,7 @@ void DoContextMenu() protected virtual void AddColumnHeaderContextMenuItems(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Resize to Fit"), false, ResizeToFit); + menu.AddItem(L10n.TextContent("Resize to Fit", null, null, null), false, ResizeToFit); menu.AddSeparator(""); diff --git a/Editor/Mono/GUI/TreeView/SubSceneGUI.cs b/Editor/Mono/GUI/TreeView/SubSceneGUI.cs index 5efc8da1ad..6e880e538d 100644 --- a/Editor/Mono/GUI/TreeView/SubSceneGUI.cs +++ b/Editor/Mono/GUI/TreeView/SubSceneGUI.cs @@ -105,7 +105,7 @@ internal static bool IsSubSceneHeader(GameObject gameObject) internal static void CreateClosedSubSceneContextClick(GenericMenu menu, SceneHierarchyHooks.SubSceneInfo subScene) { - var selectAssetContent = EditorGUIUtility.TrTextContent("Select Scene Asset"); + var selectAssetContent = L10n.TextContent("Select Scene Asset", null, null, null); if (subScene.sceneAsset) menu.AddItem(selectAssetContent, false, SelectSceneAsset, subScene.sceneAsset); else diff --git a/Editor/Mono/GUI/TreeView/ToggleTreeView.cs b/Editor/Mono/GUI/TreeView/ToggleTreeView.cs index b8cc792032..021d014b86 100644 --- a/Editor/Mono/GUI/TreeView/ToggleTreeView.cs +++ b/Editor/Mono/GUI/TreeView/ToggleTreeView.cs @@ -21,10 +21,10 @@ internal abstract class ToggleTreeViewItem : TreeViewItem { static class Styles { - public static readonly GUIContent toggleAll = EditorGUIUtility.TrTextContent("Toggle All"); - public static readonly GUIContent expandAll = EditorGUIUtility.TrTextContent("Expand All"); - public static readonly GUIContent collapseAll = EditorGUIUtility.TrTextContent("Collapse All"); - public static readonly GUIContent toggle = EditorGUIUtility.TrTextContent("", "Maintain Alt/Option key to enable or disable all children"); + public static readonly GUIContent toggleAll = L10n.TextContent("Toggle All", null, null, null); + public static readonly GUIContent expandAll = L10n.TextContent("Expand All", null, null, null); + public static readonly GUIContent collapseAll = L10n.TextContent("Collapse All", null, null, null); + public static readonly GUIContent toggle = L10n.TextContent("", "Maintain Alt/Option key to enable or disable all children", null, null); public static readonly GUIContent filterSelected = new GUIContent(EditorGUIUtility.FindTexture("FilterSelectedOnly"), "Filter selected only"); } diff --git a/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestWindow.cs b/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestWindow.cs index e3713ed14c..090dc1184e 100644 --- a/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestWindow.cs +++ b/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using UnityEngine; @@ -29,7 +28,7 @@ enum TestType public TreeViewTestWindow() { - titleContent = EditorGUIUtility.TrTextContent("TreeView Test"); + titleContent = L10n.TextContent("TreeView Test", null, null, null); } void OnEnable() @@ -89,9 +88,8 @@ void TestLargeTreesWithFixedItemHeightAndPingingAndFraming() public virtual void AddItemsToMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Large TreeView"), m_TestType == TestType.LargeTreesWithStandardGUI, () => m_TestType = TestType.LargeTreesWithStandardGUI); - menu.AddItem(EditorGUIUtility.TrTextContent("Custom Item Height TreeView"), m_TestType == TestType.TreeWithCustomItemHeight, () => m_TestType = TestType.TreeWithCustomItemHeight); + menu.AddItem(L10n.TextContent("Large TreeView", null, null, null), m_TestType == TestType.LargeTreesWithStandardGUI, () => m_TestType = TestType.LargeTreesWithStandardGUI); + menu.AddItem(L10n.TextContent("Custom Item Height TreeView", null, null, null), m_TestType == TestType.TreeWithCustomItemHeight, () => m_TestType = TestType.TreeWithCustomItemHeight); } } } // UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUI/WindowLayout.cs b/Editor/Mono/GUI/WindowLayout.cs index bfa0a66752..68b1cba08c 100644 --- a/Editor/Mono/GUI/WindowLayout.cs +++ b/Editor/Mono/GUI/WindowLayout.cs @@ -90,7 +90,9 @@ public float size internal static string ProjectLayoutPath => GetProjectLayoutPerMode(ModeService.currentId); internal static string currentLayoutName => GetLayoutFileName(ModeService.currentId, Application.unityVersionVer); + // Re-subscribed on every code load by LayoutDropdown.Initialize(). [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Event re-subscribed on every code load by LayoutDropdown.Initialize()")] internal static event Action lastLoadedLayoutChanged; [NoAutoStaticsCleanup] // string label cache, value type with no user references, safe to persist across code reload diff --git a/Editor/Mono/GUIDebugger/BaseInspectView.cs b/Editor/Mono/GUIDebugger/BaseInspectView.cs index 24b573163e..0b037b8f72 100644 --- a/Editor/Mono/GUIDebugger/BaseInspectView.cs +++ b/Editor/Mono/GUIDebugger/BaseInspectView.cs @@ -22,8 +22,8 @@ internal abstract class BaseInspectView : IBaseInspectView { protected static class Styles { - public static readonly GUIContent instructionsLabel = EditorGUIUtility.TrTextContent("Instructions"); - public static readonly GUIContent emptyViewLabel = EditorGUIUtility.TrTextContent("Select an Instruction on the left to see details"); + public static readonly GUIContent instructionsLabel = L10n.TextContent("Instructions", null, null, null); + public static readonly GUIContent emptyViewLabel = L10n.TextContent("Select an Instruction on the left to see details", null, null, null); public static readonly GUIStyle centeredLabel = "IN CenteredLabel"; } diff --git a/Editor/Mono/GUIDebugger/GUIViewDebuggerWindow.cs b/Editor/Mono/GUIDebugger/GUIViewDebuggerWindow.cs index 3cb04cfe67..a802319f24 100644 --- a/Editor/Mono/GUIDebugger/GUIViewDebuggerWindow.cs +++ b/Editor/Mono/GUIDebugger/GUIViewDebuggerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: UIToolkitDevTools not yet converted using System; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -29,9 +28,9 @@ internal static class Styles { public static readonly string defaultWindowPopupText = ""; - public static readonly GUIContent inspectedWindowLabel = EditorGUIUtility.TrTextContent("Inspected View: "); - public static readonly GUIContent pickStyleLabel = EditorGUIUtility.TrTextContent("Pick Style"); - public static readonly GUIContent pickingStyleLabel = EditorGUIUtility.TrTextContent("Picking "); + public static readonly GUIContent inspectedWindowLabel = L10n.TextContent("Inspected View: ", null, null, null); + public static readonly GUIContent pickStyleLabel = L10n.TextContent("Pick Style", null, null, null); + public static readonly GUIContent pickingStyleLabel = L10n.TextContent("Picking ", null, null, null); public static readonly GUIStyle listItem = "PR Label"; public static readonly GUIStyle listItemBackground = "CN EntryBackOdd"; @@ -111,9 +110,7 @@ private set public IBaseInspectView instructionModeView { get { return m_InstructionModeView; } } IBaseInspectView m_InstructionModeView; - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced protected GUIViewDebuggerWindow() - #pragma warning restore UAL0015 { m_InstructionModeView = new StyleDrawInspectView(this); m_Highlighter = new ElementHighlighter(); @@ -200,7 +197,7 @@ static void InitDebuggerWindow() void OnEnable() { - titleContent = EditorGUIUtility.TrTextContent("IMGUI Debugger"); + titleContent = L10n.TextContent("IMGUI Debugger", null, null, null); GUIViewDebuggerHelper.onViewInstructionsChanged += OnInspectedViewChanged; GUIViewDebuggerHelper.onDebuggingViewchanged += OnDebuggedViewChanged; GUIView serializedInspected = m_Inspected; @@ -332,7 +329,7 @@ void DoWindowPopup() List options = new List(views.Count + 1); - options.Add(EditorGUIUtility.TrTextContent("None")); + options.Add(L10n.TextContent("None", null, null, null)); int selectedIndex = 0; List selectableViews = new List(views.Count + 1); @@ -455,6 +452,9 @@ void ShowDrawInstructions() internal static partial class GUIViewDebuggerHelper { [AutoStaticsCleanupOnCodeReload] + // Only the GUI debugger window subscribes, from its OnEnable, so a code reload that clears the + // handlers is followed by the window re-enabling and subscribing again. + [IgnoreForUAL0015("Subscribers re-register from GUIViewDebuggerWindow.OnEnable after reload")] internal static event Action onViewInstructionsChanged = null; [AutoStaticsCleanupOnCodeReload] internal static event Action onDebuggingViewchanged = null; @@ -472,4 +472,3 @@ private static void CallDebuggingViewChanged(GUIView view, bool isBeingDebugged) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GUIView.cs b/Editor/Mono/GUIView.cs index 52b6b58233..0a3e5a02ae 100644 --- a/Editor/Mono/GUIView.cs +++ b/Editor/Mono/GUIView.cs @@ -63,6 +63,9 @@ internal static void RestoreReentrantLayoutState() // are processed in order to clean any dangling state left after // an event was unexpectedly used. [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle: ShortcutIntegration re-adds its handler when the + // enabled flag is set again while lazily recreating its controller. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static Action beforeEventProcessed; // Instead of allocating a new Event object every time diff --git a/Editor/Mono/GameObjectUtility.bindings.cs b/Editor/Mono/GameObjectUtility.bindings.cs index 680b3813af..78a87c4942 100644 --- a/Editor/Mono/GameObjectUtility.bindings.cs +++ b/Editor/Mono/GameObjectUtility.bindings.cs @@ -14,9 +14,10 @@ namespace UnityEditor [NativeHeader("Editor/Src/CommandImplementation.h")] public sealed partial class GameObjectUtility { - public static extern StaticEditorFlags GetStaticEditorFlags(GameObject go); - public static extern void SetStaticEditorFlags(GameObject go, StaticEditorFlags flags); - public static extern bool AreStaticEditorFlagsSet(GameObject go, StaticEditorFlags flags); + public static extern StaticEditorFlags GetStaticEditorFlags([NotNull] GameObject go); + public static extern void SetStaticEditorFlags([NotNull] GameObject go, StaticEditorFlags flags); + public static extern bool AnyStaticEditorFlagsSet([NotNull] GameObject go, StaticEditorFlags flags); + public static extern bool AllStaticEditorFlagsSet([NotNull] GameObject go, StaticEditorFlags flags); internal static extern string GetFirstItemPathAfterGameObjectCreationMenuItems(); diff --git a/Editor/Mono/GameObjectUtility.deprecated.cs b/Editor/Mono/GameObjectUtility.deprecated.cs index 8f4fd35805..02af3673e3 100644 --- a/Editor/Mono/GameObjectUtility.deprecated.cs +++ b/Editor/Mono/GameObjectUtility.deprecated.cs @@ -10,11 +10,14 @@ namespace UnityEditor [NativeHeader("Editor/Mono/GameObjectUtility.bindings.h")] public sealed partial class GameObjectUtility { + [System.Obsolete("AreStaticEditorFlagsSet has been deprecated. Use AnyStaticEditorFlagsSet to check whether ANY of the requested flags are set, or AllStaticEditorFlagsSet to check whether ALL of them are set. (UnityUpgradable) -> AnyStaticEditorFlagsSet(*)", false)] + public static bool AreStaticEditorFlagsSet(GameObject go, StaticEditorFlags flags) => AnyStaticEditorFlagsSet(go, flags); + [System.Obsolete("GetNavMeshArea has been deprecated. To relate a GameObject to an area type and retrieve their relation later, create a NavMeshBuildMarkup and pass it into UnityEngine.AI.NavMeshBuilder.CollectSources().")] - public static extern int GetNavMeshArea(GameObject go); + public static extern int GetNavMeshArea([NotNull] GameObject go); [System.Obsolete("SetNavMeshArea has been deprecated. To relate a GameObject to an area type, create a NavMeshBuildMarkup and pass it into UnityEngine.AI.NavMeshBuilder.CollectSources().")] - public static extern void SetNavMeshArea(GameObject go, int areaIndex); + public static extern void SetNavMeshArea([NotNull] GameObject go, int areaIndex); [System.Obsolete("GetNavMeshAreaFromName has been deprecated. Use NavMesh.GetAreaFromName instead. (UnityUpgradable) -> [UnityEngine] UnityEngine.AI.NavMesh.GetAreaFromName(*)")] [StaticAccessor("GetNavMeshProjectSettings()")] @@ -28,11 +31,11 @@ public sealed partial class GameObjectUtility [System.Obsolete("GetNavMeshLayer has been deprecated. To relate a GameObject to an area type and retrieve their relation later, create a NavMeshBuildMarkup and pass it into UnityEngine.AI.NavMeshBuilder.CollectSources(). (UnityUpgradable) -> GetNavMeshArea(*)")] [NativeName("GetNavMeshArea")] - public static extern int GetNavMeshLayer(GameObject go); + public static extern int GetNavMeshLayer([NotNull] GameObject go); [System.Obsolete("SetNavMeshLayer has been deprecated. To relate a GameObject to an area type, create a NavMeshBuildMarkup and pass it into UnityEngine.AI.NavMeshBuilder.CollectSources(). (UnityUpgradable) -> SetNavMeshArea(*)")] [NativeName("SetNavMeshArea")] - public static extern void SetNavMeshLayer(GameObject go, int areaIndex); + public static extern void SetNavMeshLayer([NotNull] GameObject go, int areaIndex); [System.Obsolete("GetNavMeshLayerFromName has been deprecated. Use NavMesh.GetAreaFromName instead. (UnityUpgradable) -> [UnityEngine] UnityEngine.AI.NavMesh.GetAreaFromName(*)")] [StaticAccessor("GetNavMeshProjectSettings()")] diff --git a/Editor/Mono/GameView/GameView.cs b/Editor/Mono/GameView/GameView.cs index 94fb8c9fbc..551e564d9c 100644 --- a/Editor/Mono/GameView/GameView.cs +++ b/Editor/Mono/GameView/GameView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: GameView not yet converted using System; using UnityEngine; using UnityEngine.Bindings; @@ -102,19 +101,19 @@ float maxScale internal static class Styles { - public static readonly GUIContent gizmosContent = EditorGUIUtility.TrTextContent("Gizmos", "Activate / Deactivate gizmos in the GameView"); - public static readonly GUIContent zoomSliderContent = EditorGUIUtility.TrTextContent("Scale", "Size of the game view on the screen."); - public static readonly GUIContent muteOffContent = EditorGUIUtility.TrIconContent("GameViewAudio On", "Mute Audio"); - public static readonly GUIContent muteOnContent = EditorGUIUtility.TrIconContent("GameViewAudio", "Mute Audio"); - public static readonly GUIContent shortcutsOnContent = EditorGUIUtility.TrIconContent("Keyboard", "Unity Shortcuts"); - public static readonly GUIContent shortcutsOffContent = EditorGUIUtility.TrIconContent("KeyboardShortcutsDisabled", "Unity Shortcuts"); - public static readonly GUIContent statsContent = EditorGUIUtility.TrTextContent("Stats"); - public static readonly GUIContent frameDebuggerOnContent = EditorGUIUtility.TrTextContent("Frame Debugger On"); - public static readonly GUIContent noCameraWarningContextMenuContent = EditorGUIUtility.TrTextContent("Warn if No Cameras Rendering"); - public static readonly GUIContent clearEveryFrameContextMenuContent = EditorGUIUtility.TrTextContent("Clear Every Frame in Edit Mode"); - public static readonly GUIContent lowResAspectRatiosContextMenuContent = EditorGUIUtility.TrTextContent("Low Resolution Aspect Ratios"); - public static readonly GUIContent metalFrameCaptureContent = EditorGUIUtility.TrIconContent("FrameCapture", "Capture the current view and open in Xcode frame debugger"); - public static readonly GUIContent frameDebuggerContent = EditorGUIUtility.TrIconContent("Debug", "Opens the Frame Debugger"); + public static readonly GUIContent gizmosContent = L10n.TextContent("Gizmos", "Activate / Deactivate gizmos in the GameView", null, null); + public static readonly GUIContent zoomSliderContent = L10n.TextContent("Scale", "Size of the game view on the screen.", null, null); + public static readonly GUIContent muteOffContent = L10n.IconContent("GameViewAudio On", "Mute Audio", null); + public static readonly GUIContent muteOnContent = L10n.IconContent("GameViewAudio", "Mute Audio", null); + public static readonly GUIContent shortcutsOnContent = L10n.IconContent("Keyboard", "Unity Shortcuts", null); + public static readonly GUIContent shortcutsOffContent = L10n.IconContent("KeyboardShortcutsDisabled", "Unity Shortcuts", null); + public static readonly GUIContent statsContent = L10n.TextContent("Stats", null, null, null); + public static readonly GUIContent frameDebuggerOnContent = L10n.TextContent("Frame Debugger On", null, null, null); + public static readonly GUIContent noCameraWarningContextMenuContent = L10n.TextContent("Warn if No Cameras Rendering", null, null, null); + public static readonly GUIContent clearEveryFrameContextMenuContent = L10n.TextContent("Clear Every Frame in Edit Mode", null, null, null); + public static readonly GUIContent lowResAspectRatiosContextMenuContent = L10n.TextContent("Low Resolution Aspect Ratios", null, null, null); + public static readonly GUIContent metalFrameCaptureContent = L10n.IconContent("FrameCapture", "Capture the current view and open in Xcode frame debugger", null); + public static readonly GUIContent frameDebuggerContent = L10n.IconContent("Debug", "Opens the Frame Debugger", null); public const string k_StatsShortcutID = "Game View/Toggle Stats"; public const string k_StatsTooltip = "View general rendering information"; @@ -129,7 +128,7 @@ internal static class Styles static Styles() { gameViewBackgroundStyle = "GameViewBackground"; - renderdocContent = EditorGUIUtility.TrIconContent("FrameCapture", RenderDocUtil.openInRenderDocTooltip); + renderdocContent = L10n.IconContent("FrameCapture", RenderDocUtil.openInRenderDocTooltip, null); } } @@ -1307,4 +1306,3 @@ internal void SetCustomResolution(Vector2 res, string baseName) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/GameView/GameViewSizeMenu.cs b/Editor/Mono/GameView/GameViewSizeMenu.cs index 62f97cdf14..5cd5175d4a 100644 --- a/Editor/Mono/GameView/GameViewSizeMenu.cs +++ b/Editor/Mono/GameView/GameViewSizeMenu.cs @@ -12,7 +12,7 @@ internal class GameViewSizeMenu : FlexibleMenu { static class Styles { - public static readonly GUIContent vSyncToggleContent = EditorGUIUtility.TrTextContent("VSync (Game view only)", "Enable VSync only for the game view while in playmode."); + public static readonly GUIContent vSyncToggleContent = L10n.TextContent("VSync (Game view only)", "Enable VSync only for the game view while in playmode.", null, null); } readonly Vector3 kMargins = new (9f, 7f); IGameViewSizeMenuUser m_GameView; diff --git a/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs b/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs index f9a14ea7ef..58033643d0 100644 --- a/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs +++ b/Editor/Mono/GameView/GameViewSizesMenuModifyItemUI.cs @@ -12,14 +12,14 @@ internal class GameViewSizesMenuModifyItemUI : FlexibleMenuModifyItemUI { private static class Styles { - public static readonly GUIContent headerAdd = EditorGUIUtility.TrTextContent("Add"); - public static readonly GUIContent headerEdit = EditorGUIUtility.TrTextContent("Edit"); - public static readonly GUIContent typeName = EditorGUIUtility.TrTextContent("Type"); - public static readonly GUIContent widthHeightText = EditorGUIUtility.TrTextContent("Width & Height"); - public static readonly GUIContent optionalText = EditorGUIUtility.TrTextContent("Label"); - public static readonly GUIContent ok = EditorGUIUtility.TrTextContent("OK"); - public static readonly GUIContent cancel = EditorGUIUtility.TrTextContent("Cancel"); - public static readonly GUIContent[] typeNames = new[] {EditorGUIUtility.TrTextContent("Aspect Ratio"), EditorGUIUtility.TrTextContent("Fixed Resolution")}; + public static readonly GUIContent headerAdd = L10n.TextContent("Add", null, null, null); + public static readonly GUIContent headerEdit = L10n.TextContent("Edit", null, null, null); + public static readonly GUIContent typeName = L10n.TextContent("Type", null, null, null); + public static readonly GUIContent widthHeightText = L10n.TextContent("Width & Height", null, null, null); + public static readonly GUIContent optionalText = L10n.TextContent("Label", null, null, null); + public static readonly GUIContent ok = L10n.TextContent("OK", null, null, null); + public static readonly GUIContent cancel = L10n.TextContent("Cancel", null, null, null); + public static readonly GUIContent[] typeNames = new[] {L10n.TextContent("Aspect Ratio", null, null, null), L10n.TextContent("Fixed Resolution", null, null, null)}; [NoAutoStaticsCleanup] // Immutable cache of a style constant (managed float, no user-code refs); safe to persist across code reload. public static readonly SVC windowWidth = new SVC("GameView", "--sizes-menu-modify-item-window-width", 230f); diff --git a/Editor/Mono/Graphics/D3D12DeviceFilterListsEditor.cs b/Editor/Mono/Graphics/D3D12DeviceFilterListsEditor.cs index bae4bddbdd..e0c155834a 100644 --- a/Editor/Mono/Graphics/D3D12DeviceFilterListsEditor.cs +++ b/Editor/Mono/Graphics/D3D12DeviceFilterListsEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: DirectX12 not yet converted using System; using System.Collections.Generic; using System.Text; @@ -25,21 +24,21 @@ internal static class Styles public const float kComparatorFieldWidth = 170.0f; public const string kGfxJobsNoticeText = "The order of the Graphics Jobs Filters is important. Filtering will use the first passing filter to determine Graphics Jobs Mode at runtime."; - public static readonly GUIContent preferredGraphicsJobsMode = EditorGUIUtility.TrTextContent("Preferred Graphics Jobs Mode", "Indicates which graphics jobs mode this filter will enforce at runtime."); + public static readonly GUIContent preferredGraphicsJobsMode = L10n.TextContent("Preferred Graphics Jobs Mode", "Indicates which graphics jobs mode this filter will enforce at runtime.", null, null); - public static readonly GUIContent filterList = EditorGUIUtility.TrTextContent("Filters", "List of filters"); - public static readonly GUIContent vendor = EditorGUIUtility.TrTextContent("Vendor", "Use a regular expression to specify the vendor name of a device"); - public static readonly GUIContent deviceName = EditorGUIUtility.TrTextContent("Device Name", "Use a regular expression to specify the device name of a device"); + public static readonly GUIContent filterList = L10n.TextContent("Filters", "List of filters", null, null); + public static readonly GUIContent vendor = L10n.TextContent("Vendor", "Use a regular expression to specify the vendor name of a device", null, null); + public static readonly GUIContent deviceName = L10n.TextContent("Device Name", "Use a regular expression to specify the device name of a device", null, null); public static readonly GUIContent driverVersion = - EditorGUIUtility.TrTextContent("Driver Version", "Specify the driver version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)"); + L10n.TextContent("Driver Version", "Specify the driver version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)", null, null); public static readonly GUIContent featureLevel = - EditorGUIUtility.TrTextContent("D3D12 Feature Level", "Specify the D3D12 feature level for a device using the format MajorVersion.MinorVersion(optional)"); + L10n.TextContent("D3D12 Feature Level", "Specify the D3D12 feature level for a device using the format MajorVersion.MinorVersion(optional)", null, null); public static readonly GUIContent graphicsMemory = - EditorGUIUtility.TrTextContent("Graphics Memory (MB)", "Specify the amount of graphics memory in megabytes"); - public static readonly GUIContent processorCount = EditorGUIUtility.TrTextContent("Processor Count", "Specify the number of processors"); - public static readonly GUIContent deviceType = EditorGUIUtility.TrTextContent("Device Type", "Specify if the GPU is discrete or integrated"); - public static readonly GUIContent deviceIdentification = EditorGUIUtility.TrTextContent("Device Identification", ""); - public static readonly GUIContent capabilityMetrics = EditorGUIUtility.TrTextContent("Performance & Capability Metrics", ""); + L10n.TextContent("Graphics Memory (MB)", "Specify the amount of graphics memory in megabytes", null, null); + public static readonly GUIContent processorCount = L10n.TextContent("Processor Count", "Specify the number of processors", null, null); + public static readonly GUIContent deviceType = L10n.TextContent("Device Type", "Specify if the GPU is discrete or integrated", null, null); + public static readonly GUIContent deviceIdentification = L10n.TextContent("Device Identification", "", null, null); + public static readonly GUIContent capabilityMetrics = L10n.TextContent("Performance & Capability Metrics", "", null, null); // Text public static readonly string filterText = "filter"; @@ -515,4 +514,3 @@ public override void OnInspectorGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Graphics/VulkanDeviceFilterListsEditor.cs b/Editor/Mono/Graphics/VulkanDeviceFilterListsEditor.cs index b4d884ef6e..3c86c4f1bd 100644 --- a/Editor/Mono/Graphics/VulkanDeviceFilterListsEditor.cs +++ b/Editor/Mono/Graphics/VulkanDeviceFilterListsEditor.cs @@ -14,21 +14,21 @@ internal static class DeviceFilterUI { internal static class Styles { - public static readonly GUIContent conversionButton = EditorGUIUtility.TrTextContent("Import Legacy Player Settings Filter Lists", "Imports the 'Android Vulkan Deny Filter List' and 'Android Vulkan Allow Filter List' Player Settings fields to a standalone Vulkan Device Filtering Asset. Once imported, this button and the Android Vulkan Deny/Allow Filter List fields will be disabled."); + public static readonly GUIContent conversionButton = L10n.TextContent("Import Legacy Player Settings Filter Lists", "Imports the 'Android Vulkan Deny Filter List' and 'Android Vulkan Allow Filter List' Player Settings fields to a standalone Vulkan Device Filtering Asset. Once imported, this button and the Android Vulkan Deny/Allow Filter List fields will be disabled.", null, null); - public static readonly GUIContent preferredGraphicsJobsMode = EditorGUIUtility.TrTextContent("Preferred Graphics Jobs Mode", "Indicates which graphics jobs mode this filter will enforce at runtime."); + public static readonly GUIContent preferredGraphicsJobsMode = L10n.TextContent("Preferred Graphics Jobs Mode", "Indicates which graphics jobs mode this filter will enforce at runtime.", null, null); - public static readonly GUIContent filterList = EditorGUIUtility.TrTextContent("Filters", "List of filters"); - public static readonly GUIContent vendor = EditorGUIUtility.TrTextContent("Vendor", "Use a regular expression to specify the vendor name of a device"); - public static readonly GUIContent deviceName = EditorGUIUtility.TrTextContent("Device Name", "Use a regular expression to specify the device name of a device"); - public static readonly GUIContent brand = EditorGUIUtility.TrTextContent("Brand", "Use a regular expression to specify the device brand of a device"); - public static readonly GUIContent product = EditorGUIUtility.TrTextContent("Product Name", "Use a regular expression to specify the product name of a device"); + public static readonly GUIContent filterList = L10n.TextContent("Filters", "List of filters", null, null); + public static readonly GUIContent vendor = L10n.TextContent("Vendor", "Use a regular expression to specify the vendor name of a device", null, null); + public static readonly GUIContent deviceName = L10n.TextContent("Device Name", "Use a regular expression to specify the device name of a device", null, null); + public static readonly GUIContent brand = L10n.TextContent("Brand", "Use a regular expression to specify the device brand of a device", null, null); + public static readonly GUIContent product = L10n.TextContent("Product Name", "Use a regular expression to specify the product name of a device", null, null); public static readonly GUIContent osVersion = - EditorGUIUtility.TrTextContent("Android OS Version", "Use a regular expression to specify the OS version of a device"); + L10n.TextContent("Android OS Version", "Use a regular expression to specify the OS version of a device", null, null); public static readonly GUIContent vulkanApiVersion = - EditorGUIUtility.TrTextContent("Vulkan API Version", "Specify the Vulkan API version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional)"); + L10n.TextContent("Vulkan API Version", "Specify the Vulkan API version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional)", null, null); public static readonly GUIContent driverVersion = - EditorGUIUtility.TrTextContent("Driver Version", "Specify the driver version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional)"); + L10n.TextContent("Driver Version", "Specify the driver version for a device using the format MajorVersion.MinorVersion(optional).PatchVersion(optional)", null, null); // Text public static readonly string filterText = "filter"; diff --git a/Editor/Mono/Graphics/WebGPUDeviceFilterListsEditor.cs b/Editor/Mono/Graphics/WebGPUDeviceFilterListsEditor.cs index 05b9ef393e..c6ad8063bb 100644 --- a/Editor/Mono/Graphics/WebGPUDeviceFilterListsEditor.cs +++ b/Editor/Mono/Graphics/WebGPUDeviceFilterListsEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: WebGPU not yet converted using System; using System.Collections.Generic; using System.Diagnostics; @@ -25,25 +24,25 @@ internal static class Styles public const float kHeightBetweenRows = 10.0f; public const float kComparatorFieldWidth = 170.0f; - public static readonly GUIContent filterList = EditorGUIUtility.TrTextContent("Filters", "List of filters"); - public static readonly GUIContent vendor = EditorGUIUtility.TrTextContent("Vendor", "Use a regular expression to specify the vendor name of a device"); - public static readonly GUIContent browserName = EditorGUIUtility.TrTextContent("Browser Name", "Use a regular expression to specify the name of a browser"); + public static readonly GUIContent filterList = L10n.TextContent("Filters", "List of filters", null, null); + public static readonly GUIContent vendor = L10n.TextContent("Vendor", "Use a regular expression to specify the vendor name of a device", null, null); + public static readonly GUIContent browserName = L10n.TextContent("Browser Name", "Use a regular expression to specify the name of a browser", null, null); public static readonly GUIContent browserVersion = - EditorGUIUtility.TrTextContent("Browser Version", "Specify the browser version using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)"); + L10n.TextContent("Browser Version", "Specify the browser version using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)", null, null); public static readonly GUIContent browserEngineFlavor = - EditorGUIUtility.TrTextContent("Browser Engine", "The browser engine (WebGPU backend) to match: Chromium-based (Blink), Safari-based (WebKit), or Firefox-based (Gecko)"); + L10n.TextContent("Browser Engine", "The browser engine (WebGPU backend) to match: Chromium-based (Blink), Safari-based (WebKit), or Firefox-based (Gecko)", null, null); public static readonly GUIContent engineVersion = - EditorGUIUtility.TrTextContent("Engine Version", "Specify the engine version using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)"); + L10n.TextContent("Engine Version", "Specify the engine version using the format MajorVersion.MinorVersion(optional).PatchVersion(optional).PatchMinorVersion(optional)", null, null); public static readonly GUIContent featureLevel = - EditorGUIUtility.TrTextContent("WebGPU Feature Level", "Specify the WebGPU feature level for a device using the format MajorVersion.MinorVersion(optional)"); + L10n.TextContent("WebGPU Feature Level", "Specify the WebGPU feature level for a device using the format MajorVersion.MinorVersion(optional)", null, null); public static readonly GUIContent graphicsMemory = - EditorGUIUtility.TrTextContent("Graphics Memory (MB)", "Specify the amount of graphics memory in megabytes"); - public static readonly GUIContent processorCount = EditorGUIUtility.TrTextContent("Processor Count", "Specify the number of processors"); - public static readonly GUIContent deviceType = EditorGUIUtility.TrTextContent("Device Type", "Specify if the GPU is discrete or integrated"); - public static readonly GUIContent browserIdentification = EditorGUIUtility.TrTextContent("Browser", ""); - public static readonly GUIContent capabilityMetrics = EditorGUIUtility.TrTextContent("Capabilities", ""); - public static readonly GUIContent features = EditorGUIUtility.TrTextContent("Required Features", "WebGPU device features required or excluded by this filter"); - public static readonly GUIContent limits = EditorGUIUtility.TrTextContent("Limits", "WebGPU device limits required or excluded by this filter"); + L10n.TextContent("Graphics Memory (MB)", "Specify the amount of graphics memory in megabytes", null, null); + public static readonly GUIContent processorCount = L10n.TextContent("Processor Count", "Specify the number of processors", null, null); + public static readonly GUIContent deviceType = L10n.TextContent("Device Type", "Specify if the GPU is discrete or integrated", null, null); + public static readonly GUIContent browserIdentification = L10n.TextContent("Browser", "", null, null); + public static readonly GUIContent capabilityMetrics = L10n.TextContent("Capabilities", "", null, null); + public static readonly GUIContent features = L10n.TextContent("Required Features", "WebGPU device features required or excluded by this filter", null, null); + public static readonly GUIContent limits = L10n.TextContent("Limits", "WebGPU device limits required or excluded by this filter", null, null); // Text public static readonly string filterText = "filter"; @@ -569,4 +568,3 @@ public override void OnInspectorGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Handles/BoundsHandle/PrimitiveBoundsHandle.cs b/Editor/Mono/Handles/BoundsHandle/PrimitiveBoundsHandle.cs index 13ad3574d9..38b6f98d8d 100644 --- a/Editor/Mono/Handles/BoundsHandle/PrimitiveBoundsHandle.cs +++ b/Editor/Mono/Handles/BoundsHandle/PrimitiveBoundsHandle.cs @@ -42,7 +42,7 @@ internal static GUIContent editModeButton { s_EditModeButton = new GUIContent( EditorGUIUtility.IconContent("EditCollider").image, - EditorGUIUtility.TrTextContent("Edit bounding volume.\n\n - Hold Alt after clicking control handle to pin center in place.\n - Hold Shift after clicking control handle to scale uniformly.").text + L10n.TextContent("Edit bounding volume.\n\n - Hold Alt after clicking control handle to pin center in place.\n - Hold Shift after clicking control handle to scale uniformly.", null, null, null).text ); } return s_EditModeButton; @@ -50,6 +50,8 @@ internal static GUIContent editModeButton } [AutoStaticsCleanupOnCodeReload] + // Lazy getter recreates the button content from its icon on the next access after cleanup nulls it. + [IgnoreForUAL0015("Lazy GUIContent, recreated from its icon on the next access")] private static GUIContent s_EditModeButton; public static float DefaultMidpointHandleSizeFunction(Vector3 position) diff --git a/Editor/Mono/Handles/HandleUtility.cs b/Editor/Mono/Handles/HandleUtility.cs index e8822ee030..6827dc41bd 100644 --- a/Editor/Mono/Handles/HandleUtility.cs +++ b/Editor/Mono/Handles/HandleUtility.cs @@ -2224,7 +2224,9 @@ public static void Repaint() public delegate UnityObject ResolvePickingWithWorldPositionCallback(int localPickingIndex, Vector3 worldPos, float depth); public delegate RenderPickingResult RenderPickingCallback(in RenderPickingArgs args); + // Re-registered on every code load by UIToolkitSceneViewPicking's [InitializeOnLoad] static constructor. [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Callbacks re-registered on every code load by UIToolkitSceneViewPicking's [InitializeOnLoad] static constructor")] private static readonly List s_RenderPickingCallbacks = new(); [AutoStaticsCleanupOnCodeReload] private static readonly List<(int PickingIndexBegin, int PickingIndexEnd, ResolvePickingCallback Resolver, ResolvePickingWithWorldPositionCallback ResolverWithWorldPos)> s_RenderPickingResults = new(); diff --git a/Editor/Mono/Handles/Handles.cs b/Editor/Mono/Handles/Handles.cs index 174aef6c9f..466fc8855c 100644 --- a/Editor/Mono/Handles/Handles.cs +++ b/Editor/Mono/Handles/Handles.cs @@ -72,8 +72,8 @@ public sealed partial class Handles public static Color UIColliderHandleColor { get { return s_UIColliderHandleColor; } } internal static readonly PrefColor s_UIColliderHandleColor = new PrefColor("Scene/UI Collider Handle", 145f / 255, 244f / 255, 139f / 255, 210f / 255); - internal readonly static GUIContent s_StaticLabel = EditorGUIUtility.TrTextContent("Static"); - internal readonly static GUIContent s_PrefabLabel = EditorGUIUtility.TrTextContent("Prefab"); + internal readonly static GUIContent s_StaticLabel = L10n.TextContent("Static", null, null, null); + internal readonly static GUIContent s_PrefabLabel = L10n.TextContent("Prefab", null, null, null); internal static readonly int s_SliderHash = "SliderHash".GetHashCode(); internal static readonly int s_Slider2DHash = "Slider2DHash".GetHashCode(); diff --git a/Editor/Mono/HierarchyPreferences.cs b/Editor/Mono/HierarchyPreferences.cs index f3edfe63e5..25025e7ecf 100644 --- a/Editor/Mono/HierarchyPreferences.cs +++ b/Editor/Mono/HierarchyPreferences.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: NativeHierarchyContainer not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEditor.SceneManagement; @@ -45,17 +44,45 @@ public static PrefabStage.Mode DefaultPrefabModeFromHierarchy /// [VisibleToOtherModules("HierarchyModule", "MultiplayerEditorModule")] [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static event Action AnyPreferenceChanged; static void FireAnyPreferenceChanged() => AnyPreferenceChanged?.Invoke(); - static HierarchyPreferences() + // Runs on every code load because useLegacyHierarchyChanged is cleared on reload (a static + // constructor would only subscribe on the first load). The SavedValue instances persist across + // reloads, so Shutdown unsubscribes their handlers before the old code unloads. + [OnCodeLoaded] + static void Initialize() { - RenameNewObjects.valueChanged += FireAnyPreferenceChanged; - UseQueryBuilder.valueChanged += FireAnyPreferenceChanged; - AlternatingRowBackground.valueChanged += FireAnyPreferenceChanged; + RenameNewObjects.valueChanged += FireAnyPreferenceChanged; + UseQueryBuilder.valueChanged += FireAnyPreferenceChanged; + AlternatingRowBackground.valueChanged += FireAnyPreferenceChanged; + GameObjectIconMode.valueChanged += FireAnyPreferenceChanged; EditorSettings.useLegacyHierarchyChanged += FireAnyPreferenceChanged; - GameObjectIconMode.valueChanged += FireAnyPreferenceChanged; + } + + // useLegacyHierarchyChanged is not unsubscribed here: it is cleared on reload + // ([AutoStaticsCleanupOnCodeReload]), so only the persistent SavedValue events need it. + [OnCodeUnloading] + static void Shutdown() + { + RenameNewObjects.valueChanged -= FireAnyPreferenceChanged; + UseQueryBuilder.valueChanged -= FireAnyPreferenceChanged; + AlternatingRowBackground.valueChanged -= FireAnyPreferenceChanged; + GameObjectIconMode.valueChanged -= FireAnyPreferenceChanged; + } + + [OnCodeUnloading] + static void Uninitialize() + { + RenameNewObjects.valueChanged -= FireAnyPreferenceChanged; + UseQueryBuilder.valueChanged -= FireAnyPreferenceChanged; + AlternatingRowBackground.valueChanged -= FireAnyPreferenceChanged; + EditorSettings.useLegacyHierarchyChanged -= FireAnyPreferenceChanged; + GameObjectIconMode.valueChanged -= FireAnyPreferenceChanged; } public static void EnsureCorrectHierarchyIsInUse(EditorWindow window) @@ -98,4 +125,3 @@ internal static void RefreshPreferences() internal static Type HierarchyV2WindowType; } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/HostView.cs b/Editor/Mono/HostView.cs index b895f26347..33504338e5 100644 --- a/Editor/Mono/HostView.cs +++ b/Editor/Mono/HostView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: EditorWindowManagement not yet converted using System; using System.Collections.Generic; using System.Data.Common; @@ -53,18 +52,18 @@ public static class DataModes static readonly Texture2D k_MixedModeIcon = EditorGUIUtility.LoadIcon("DataMode.Mixed"); static readonly Texture2D k_RuntimeModeIcon = EditorGUIUtility.LoadIcon("DataMode.Runtime"); - public static readonly GUIContent authoringModeContent = EditorGUIUtility.TrIconContent(k_AuthoringModeIcon, k_AutomaticAuthoringString); - public static readonly GUIContent mixedModeContent = EditorGUIUtility.TrIconContent(k_MixedModeIcon, k_AutomaticMixedString); - public static readonly GUIContent runtimeModeContent = EditorGUIUtility.TrIconContent(k_RuntimeModeIcon, k_AutomaticRuntimeString); + public static readonly GUIContent authoringModeContent = L10n.IconContent(k_AuthoringModeIcon, k_AutomaticAuthoringString, null); + public static readonly GUIContent mixedModeContent = L10n.IconContent(k_MixedModeIcon, k_AutomaticMixedString, null); + public static readonly GUIContent runtimeModeContent = L10n.IconContent(k_RuntimeModeIcon, k_AutomaticRuntimeString, null); // Sticky data mode icons static readonly Texture2D k_StickyAuthoringModeIcon = EditorGUIUtility.LoadIcon("DataMode.Authoring.Sticky"); static readonly Texture2D k_StickyMixedModeIcon = EditorGUIUtility.LoadIcon("DataMode.Mixed.Sticky"); static readonly Texture2D k_StickyRuntimeModeIcon = EditorGUIUtility.LoadIcon("DataMode.Runtime.Sticky"); - public static readonly GUIContent stickyAuthoringModeContent = EditorGUIUtility.TrIconContent(k_StickyAuthoringModeIcon, k_AuthoringString); - public static readonly GUIContent stickyMixedModeContent = EditorGUIUtility.TrIconContent(k_StickyMixedModeIcon, k_MixedString); - public static readonly GUIContent stickyRuntimeModeContent = EditorGUIUtility.TrIconContent(k_StickyRuntimeModeIcon, k_RuntimeString); + public static readonly GUIContent stickyAuthoringModeContent = L10n.IconContent(k_StickyAuthoringModeIcon, k_AuthoringString, null); + public static readonly GUIContent stickyMixedModeContent = L10n.IconContent(k_StickyMixedModeIcon, k_MixedString, null); + public static readonly GUIContent stickyRuntimeModeContent = L10n.IconContent(k_StickyRuntimeModeIcon, k_RuntimeString, null); // Use an empty style to avoid the hover effect of normal buttons public static readonly GUIStyle switchStyle = new GUIStyle(); @@ -854,7 +853,7 @@ protected void ShowGenericMenu(float leftOffset, float topOffset) } else if (item.icon != null) { - if (EditorGUI.Button(itemRect, EditorGUIUtility.TrIconContent(item.icon, item.menuPath), EditorStyles.iconButton)) + if (EditorGUI.Button(itemRect, L10n.IconContent(item.icon, item.menuPath, null), EditorStyles.iconButton)) item.executeHandler(actualView, item); } } @@ -1017,13 +1016,12 @@ protected virtual void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow wind if (window && Unsupported.IsDeveloperMode()) { - menu.AddItem(EditorGUIUtility.TrTextContent("Inspect Window"), false, Inspect, window); - menu.AddItem(EditorGUIUtility.TrTextContent("Inspect View"), false, Inspect, window.m_Parent); - menu.AddItem(EditorGUIUtility.TrTextContent("Reload Window _f5"), false, Reload, window); + menu.AddItem(L10n.TextContent("Inspect Window", null, null, null), false, Inspect, window); + menu.AddItem(L10n.TextContent("Inspect View", null, null, null), false, Inspect, window.m_Parent); + menu.AddItem(L10n.TextContent("Reload Window _f5", null, null, null), false, Reload, window); menu.AddSeparator(""); } } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/IconSelector.cs b/Editor/Mono/IconSelector.cs index 48f55f2de8..21128e5020 100644 --- a/Editor/Mono/IconSelector.cs +++ b/Editor/Mono/IconSelector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -21,6 +20,9 @@ class Styles } [AutoStaticsCleanupOnCodeReload] + // Cache of the open icon-selector popup; ShowAtPosition creates a new instance whenever this is + // null, and closing the popup nulls it as well. + [IgnoreForUAL0015("Popup instance recreated by ShowAtPosition when the cached one is null")] static IconSelector s_IconSelector = null; [NoAutoStaticsCleanup] // value-type popup close-time used to debounce reopen; safe to persist across reload static long s_LastClosedTime = 0; @@ -29,7 +31,7 @@ class Styles static readonly int s_HashIconSelector = "IconSelector".GetHashCode(); [NoAutoStaticsCleanup] // lazy GUIStyle/GUIContent Styles holder; safe to persist across reload static Styles m_Styles; - static readonly GUIContent s_Other = EditorGUIUtility.TrTextContent("Other..."); + static readonly GUIContent s_Other = L10n.TextContent("Other...", null, null, null); Object m_TargetObject; Object[] m_TargetObjectList; @@ -410,4 +412,3 @@ internal void OnGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs b/Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs index 8904d4f7dd..10c7d4f019 100644 --- a/Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs +++ b/Editor/Mono/ImportSettings/DesktopPluginImporterExtension.cs @@ -27,7 +27,7 @@ internal enum DesktopPluginCPUArchitecture internal class DesktopSingleCPUProperty : Property { public DesktopSingleCPUProperty(BuildTarget buildTarget, DesktopPluginCPUArchitecture architecture) - : base(EditorGUIUtility.TrTextContent(GetArchitectureNameInGUI(buildTarget, architecture)), cpuKey, architecture, BuildPipeline.GetBuildTargetName(buildTarget)) + : base(L10n.TextContent(GetArchitectureNameInGUI(buildTarget, architecture), null, null, null), cpuKey, architecture, BuildPipeline.GetBuildTargetName(buildTarget)) { } @@ -88,7 +88,7 @@ public DesktopMultiCPUProperty(BuildTarget buildTarget, params DesktopPluginCPUA architectureCount = m_SupportedArchitectures.Length; m_SupportedArchitectureNames = new GUIContent[architectureCount]; for (int i = 0; i < architectureCount; i++) - m_SupportedArchitectureNames[i] = EditorGUIUtility.TrTextContent(GetArchitectureNameInGUI(buildTarget, m_SupportedArchitectures[i])); + m_SupportedArchitectureNames[i] = L10n.TextContent(GetArchitectureNameInGUI(buildTarget, m_SupportedArchitectures[i]), null, null, null); } DesktopPluginCPUArchitecture GetCurrentArchitecture(PluginImporterInspector inspector) @@ -168,10 +168,10 @@ public DesktopPluginImporterExtension() // Windows 32-bit (x86) and Windows 64-bit (ARM64/x86_64) are separate targets, so they have separate checkboxes // Linux only has x64 architecture and Mac has a single target for both 64-bit architectures (ARM64/Intel-64bit) - m_Windows32Managed = new DesktopSingleCPUProperty(EditorGUIUtility.TrTextContent("Windows x86"), BuildTarget.StandaloneWindows); - m_Windows64Managed = new DesktopSingleCPUProperty(EditorGUIUtility.TrTextContent("Windows 64-bit"), BuildTarget.StandaloneWindows64); - m_LinuxManaged = new DesktopSingleCPUProperty(EditorGUIUtility.TrTextContent("Linux x64"),BuildTarget.StandaloneLinux64); - m_MacOSManaged = new DesktopSingleCPUProperty(EditorGUIUtility.TrTextContent("macOS 64-bit"),BuildTarget.StandaloneOSX); + m_Windows32Managed = new DesktopSingleCPUProperty(L10n.TextContent("Windows x86", null, null, null), BuildTarget.StandaloneWindows); + m_Windows64Managed = new DesktopSingleCPUProperty(L10n.TextContent("Windows 64-bit", null, null, null), BuildTarget.StandaloneWindows64); + m_LinuxManaged = new DesktopSingleCPUProperty(L10n.TextContent("Linux x64", null, null, null),BuildTarget.StandaloneLinux64); + m_MacOSManaged = new DesktopSingleCPUProperty(L10n.TextContent("macOS 64-bit", null, null, null),BuildTarget.StandaloneOSX); nativeProperties = new Property[] { @@ -230,7 +230,7 @@ public override void OnPlatformSettingsGUI(PluginImporterInspector inspector) { if (IsUsableOnWindows(imp)) { - EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Windows"), EditorStyles.boldLabel); + EditorGUILayout.LabelField(L10n.TextContent("Windows", null, null, null), EditorStyles.boldLabel); m_Windows32.OnGUI(inspector); m_Windows64.OnGUI(inspector); EditorGUILayout.Space(); @@ -238,14 +238,14 @@ public override void OnPlatformSettingsGUI(PluginImporterInspector inspector) if (IsUsableOnLinux(imp)) { - EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Linux"), EditorStyles.boldLabel); + EditorGUILayout.LabelField(L10n.TextContent("Linux", null, null, null), EditorStyles.boldLabel); m_Linux.OnGUI(inspector); EditorGUILayout.Space(); } if (IsUsableOnOSX(imp)) { - EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("macOS"), EditorStyles.boldLabel); + EditorGUILayout.LabelField(L10n.TextContent("macOS", null, null, null), EditorStyles.boldLabel); m_MacOS.OnGUI(inspector); EditorGUILayout.Space(); } diff --git a/Editor/Mono/ImportSettings/EditorPluginImporterExtension.cs b/Editor/Mono/ImportSettings/EditorPluginImporterExtension.cs index 1e8f659e11..f91ca98dda 100644 --- a/Editor/Mono/ImportSettings/EditorPluginImporterExtension.cs +++ b/Editor/Mono/ImportSettings/EditorPluginImporterExtension.cs @@ -64,7 +64,7 @@ public CPUProperty(GUIContent name, string key, EditorPluginCPUArchitecture defa m_ArchitectureNames = new GUIContent[enumLength]; for (int i = 0; i < enumLength; i++) { - m_ArchitectureNames[i] = EditorGUIUtility.TrTextContent(GetArchitectureName(currentOS, (EditorPluginCPUArchitecture)i)); + m_ArchitectureNames[i] = L10n.TextContent(GetArchitectureName(currentOS, (EditorPluginCPUArchitecture)i), null, null, null); } } @@ -109,7 +109,7 @@ public void UpdateArchitectureNames(EditorPluginOSArchitecture osValue) int enumLength = Enum.GetNames(typeof(EditorPluginCPUArchitecture)).Length; for (int i = 0; i < enumLength; i++) { - m_ArchitectureNames[i] = EditorGUIUtility.TrTextContent(GetArchitectureName(osValue, (EditorPluginCPUArchitecture)i)); + m_ArchitectureNames[i] = L10n.TextContent(GetArchitectureName(osValue, (EditorPluginCPUArchitecture)i), null, null, null); } currentOS = osValue; } @@ -139,8 +139,8 @@ static string GetArchitectureName(EditorPluginOSArchitecture os, EditorPluginCPU public EditorPluginImporterExtension() : base(null) { - editorCPUProperty = new CPUProperty(EditorGUIUtility.TrTextContent("CPU", "The processor architectiure that this plugin is compatible with"), "CPU", EditorPluginCPUArchitecture.AnyCPU, (Enum e) => CanSelectArch(e)); - editorOSProperty = new EditorProperty(EditorGUIUtility.TrTextContent("OS", "The Editor operating system that this plugin is compatible with"), "OS", EditorPluginOSArchitecture.AnyOS); + editorCPUProperty = new CPUProperty(L10n.TextContent("CPU", "The processor architectiure that this plugin is compatible with", null, null), "CPU", EditorPluginCPUArchitecture.AnyCPU, (Enum e) => CanSelectArch(e)); + editorOSProperty = new EditorProperty(L10n.TextContent("OS", "The Editor operating system that this plugin is compatible with", null, null), "OS", EditorPluginOSArchitecture.AnyOS); properties = new Property[] { editorOSProperty, editorCPUProperty }; } diff --git a/Editor/Mono/ImportSettings/ExposeTransformEditor.cs b/Editor/Mono/ImportSettings/ExposeTransformEditor.cs index 761148ff6d..52294ff103 100644 --- a/Editor/Mono/ImportSettings/ExposeTransformEditor.cs +++ b/Editor/Mono/ImportSettings/ExposeTransformEditor.cs @@ -18,8 +18,8 @@ internal class ExposeTransformEditor private static class Styles { // TreeView column - public static readonly GUIContent TransformName = EditorGUIUtility.TrTextContent("Node Name"); - public static readonly GUIContent EnableName = EditorGUIUtility.TrTextContent("Use", "Maintain Alt/Option key to enable or disable all children"); + public static readonly GUIContent TransformName = L10n.TextContent("Node Name", null, null, null); + public static readonly GUIContent EnableName = L10n.TextContent("Use", "Maintain Alt/Option key to enable or disable all children", null, null); } diff --git a/Editor/Mono/ImportSettings/IHVImageFormatImporterInspector.cs b/Editor/Mono/ImportSettings/IHVImageFormatImporterInspector.cs index 1f1d2fb8ed..1e790ca1f8 100644 --- a/Editor/Mono/ImportSettings/IHVImageFormatImporterInspector.cs +++ b/Editor/Mono/ImportSettings/IHVImageFormatImporterInspector.cs @@ -27,17 +27,17 @@ internal class IHVImageFormatImporterInspector : AssetImporterEditor internal class Styles { // copy pasted from TextureImporterInspector.TextureSettingsGUI() - public static readonly GUIContent readWrite = EditorGUIUtility.TrTextContent("Read/Write", "Enable to be able to access the raw pixel data from code."); - public static readonly GUIContent sRGBTexture = EditorGUIUtility.TrTextContent("sRGB (Color Texture)", "Texture content is stored in gamma space. Non-HDR color textures should enable this flag (except if used for IMGUI)."); - public static readonly GUIContent wrapMode = EditorGUIUtility.TrTextContent("Wrap Mode"); - public static readonly GUIContent filterMode = EditorGUIUtility.TrTextContent("Filter Mode"); + public static readonly GUIContent readWrite = L10n.TextContent("Read/Write", "Enable to be able to access the raw pixel data from code.", null, null); + public static readonly GUIContent sRGBTexture = L10n.TextContent("sRGB (Color Texture)", "Texture content is stored in gamma space. Non-HDR color textures should enable this flag (except if used for IMGUI).", null, null); + public static readonly GUIContent wrapMode = L10n.TextContent("Wrap Mode", null, null, null); + public static readonly GUIContent filterMode = L10n.TextContent("Filter Mode", null, null, null); public static readonly GUIContent streamingMipmaps = EditorGUIUtility.TrTextContent("Stream Mipmap Levels", "Only load larger mipmap levels as needed to render the current game cameras."); public static readonly GUIContent streamingMipmapsPriority = EditorGUIUtility.TrTextContent("Priority", "Mipmap streaming priority when there's contention for resources. Positive numbers represent higher priority. Valid range is -128 to 127."); public static readonly int[] filterModeValues = { (int)FilterMode.Point, (int)FilterMode.Bilinear, (int)FilterMode.Trilinear }; public static readonly GUIContent[] filterModeOptions = - { EditorGUIUtility.TrTextContent("Point (no filter)"), EditorGUIUtility.TrTextContent("Bilinear"), EditorGUIUtility.TrTextContent("Trilinear") }; + { L10n.TextContent("Point (no filter)", null, null, null), L10n.TextContent("Bilinear", null, null, null), L10n.TextContent("Trilinear", null, null, null) }; } diff --git a/Editor/Mono/ImportSettings/SpeedTreeImporterInspector.cs b/Editor/Mono/ImportSettings/SpeedTreeImporterInspector.cs index def704e377..b570fd21dd 100644 --- a/Editor/Mono/ImportSettings/SpeedTreeImporterInspector.cs +++ b/Editor/Mono/ImportSettings/SpeedTreeImporterInspector.cs @@ -17,10 +17,10 @@ internal class SpeedTreeImporterInspector : AssetImporterTabbedEditor { private static class Styles { - public static readonly GUIContent ApplyAndGenerate = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and generate materials with new settings."); - public static readonly GUIContent Regenerate = EditorGUIUtility.TrTextContent("Regenerate Materials", "Regenerate materials from the current importer settings."); - public static readonly GUIContent RegenerateRemapped = EditorGUIUtility.TrTextContent("Regenerate Materials", "Regenerate the remapped materials from the current import settings."); - public static readonly GUIContent ApplyAndGenerateRemapped = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and regenerate the remapped materials with new settings."); + public static readonly GUIContent ApplyAndGenerate = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and generate materials with new settings.", null, null); + public static readonly GUIContent Regenerate = L10n.TextContent("Regenerate Materials", "Regenerate materials from the current importer settings.", null, null); + public static readonly GUIContent RegenerateRemapped = L10n.TextContent("Regenerate Materials", "Regenerate the remapped materials from the current import settings.", null, null); + public static readonly GUIContent ApplyAndGenerateRemapped = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and regenerate the remapped materials with new settings.", null, null); } private SerializedProperty m_MaterialLocation; diff --git a/Editor/Mono/ImportSettings/SpeedTreeImporterMaterialEditor.cs b/Editor/Mono/ImportSettings/SpeedTreeImporterMaterialEditor.cs index 22ad1308f1..c875762a6d 100644 --- a/Editor/Mono/ImportSettings/SpeedTreeImporterMaterialEditor.cs +++ b/Editor/Mono/ImportSettings/SpeedTreeImporterMaterialEditor.cs @@ -14,28 +14,28 @@ internal class SpeedTreeImporterMaterialEditor : BaseSpeedTreeImporterTabUI { private static class Styles { - public static readonly GUIContent MaterialLocation = EditorGUIUtility.TrTextContent("Location"); + public static readonly GUIContent MaterialLocation = L10n.TextContent("Location", null, null, null); public static readonly GUIContent[] MaterialLocationOpt = { - EditorGUIUtility.TrTextContent("Use External Materials (Legacy)", "Use external materials if found in the project."), - EditorGUIUtility.TrTextContent("Use Embedded Materials", "Embed the material inside the imported asset.") + L10n.TextContent("Use External Materials (Legacy)", "Use external materials if found in the project.", null, null), + L10n.TextContent("Use Embedded Materials", "Embed the material inside the imported asset.", null, null) }; - public static readonly GUIContent RemapOptions = EditorGUIUtility.TrTextContent("On Demand Remap"); - public static readonly GUIContent RemapMaterialsInProject = EditorGUIUtility.TrTextContent("Search and Remap...", "Click on this button to search and remap the materials from the project."); + public static readonly GUIContent RemapOptions = L10n.TextContent("On Demand Remap", null, null, null); + public static readonly GUIContent RemapMaterialsInProject = L10n.TextContent("Search and Remap...", "Click on this button to search and remap the materials from the project.", null, null); - public static readonly GUIContent ExternalMaterialMappings = EditorGUIUtility.TrTextContent("Remapped Materials", "External materials to use for each embedded material."); - public static readonly GUIContent NoMaterialMappingsHelp = EditorGUIUtility.TrTextContent("Re-import the asset to see the list of used materials."); + public static readonly GUIContent ExternalMaterialMappings = L10n.TextContent("Remapped Materials", "External materials to use for each embedded material.", null, null); + public static readonly GUIContent NoMaterialMappingsHelp = L10n.TextContent("Re-import the asset to see the list of used materials.", null, null, null); - public static readonly GUIContent Materials = EditorGUIUtility.TrTextContent("Materials"); - public static readonly GUIContent ExtractEmbeddedMaterials = EditorGUIUtility.TrTextContent("Extract Materials...", "Click on this button to extract the embedded materials."); + public static readonly GUIContent Materials = L10n.TextContent("Materials", null, null, null); + public static readonly GUIContent ExtractEmbeddedMaterials = L10n.TextContent("Extract Materials...", "Click on this button to extract the embedded materials.", null, null); - public static readonly GUIContent InternalMaterialHelp = EditorGUIUtility.TrTextContent("Materials are embedded inside the imported asset."); - public static readonly GUIContent MaterialAssignmentsHelp = EditorGUIUtility.TrTextContent("Material assignments can be remapped below."); + public static readonly GUIContent InternalMaterialHelp = L10n.TextContent("Materials are embedded inside the imported asset.", null, null, null); + public static readonly GUIContent MaterialAssignmentsHelp = L10n.TextContent("Material assignments can be remapped below.", null, null, null); - public static readonly GUIContent ExternalMaterialSearchHelp = EditorGUIUtility.TrTextContent("Searches the user provided directory and matches the materials that share the same name and LOD with the originally imported material."); + public static readonly GUIContent ExternalMaterialSearchHelp = L10n.TextContent("Searches the user provided directory and matches the materials that share the same name and LOD with the originally imported material.", null, null, null); - public static readonly GUIContent SelectMaterialFolder = EditorGUIUtility.TrTextContent("Select Materials Folder"); + public static readonly GUIContent SelectMaterialFolder = L10n.TextContent("Select Materials Folder", null, null, null); } private SerializedProperty m_MaterialLocation; diff --git a/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs b/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs index 38026f907b..9e93512606 100644 --- a/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs +++ b/Editor/Mono/ImportSettings/SpeedTreeImporterModelEditor.cs @@ -17,43 +17,43 @@ internal class SpeedTreeImporterModelEditor : BaseSpeedTreeImporterTabUI { private class Styles { - public static readonly GUIContent MeshesHeader = EditorGUIUtility.TrTextContent("Meshes"); - public static readonly GUIContent UnitConversion = EditorGUIUtility.TrTextContent("Unit Conversion", "Select the unit conversion to apply to the imported SpeedTree asset"); - public static readonly GUIContent ScaleFactor = EditorGUIUtility.TrTextContent("Scale Factor", "How much to scale the tree model, interpreting the exported units as meters. Must be positive."); - - public static readonly GUIContent EnableColorVariation = EditorGUIUtility.TrTextContent("Color Variation", "Color is determined by linearly interpolating between the Main Color & Color Variation values based on the world position X, Y and Z values"); - public static readonly GUIContent EnableBump = EditorGUIUtility.TrTextContent("Normal Map", "Enable normal mapping (aka Bump mapping)."); - public static readonly GUIContent EnableSubsurface = EditorGUIUtility.TrTextContent("Subsurface Scattering", "Enable subsurface scattering effects."); - public static readonly GUIContent MainColor = EditorGUIUtility.TrTextContent("Main Color", "The color modulating the diffuse lighting component."); - public static readonly GUIContent HueVariation = EditorGUIUtility.TrTextContent("Variation Color (RGB), Intensity (A)", "Tint the tree with the Variation Color"); - public static readonly GUIContent AlphaTestRef = EditorGUIUtility.TrTextContent("Alpha Cutoff", "The alpha-test reference value."); - - public static readonly GUIContent LightingHeader = EditorGUIUtility.TrTextContent("Lighting"); - public static readonly GUIContent CastShadows = EditorGUIUtility.TrTextContent("Cast Shadows", "The tree casts shadow"); - public static readonly GUIContent ReceiveShadows = EditorGUIUtility.TrTextContent("Receive Shadows", "The tree receives shadow"); - public static readonly GUIContent UseLightProbes = EditorGUIUtility.TrTextContent("Light Probes", "The tree uses light probe for lighting"); // TODO: update help text - public static readonly GUIContent UseReflectionProbes = EditorGUIUtility.TrTextContent("Reflection Probes", "The tree uses reflection probe for rendering"); // TODO: update help text - - public static readonly GUIContent AdditionalSettingsHeader = EditorGUIUtility.TrTextContent("Additional Settings"); - public static readonly GUIContent MotionVectorMode = EditorGUIUtility.TrTextContent("Motion Vectors", "Motion vector mode to set for the mesh renderer of each LOD object"); - public static readonly GUIContent GenerateRigidBody = EditorGUIUtility.TrTextContent("Generate Rigidbody", "Generates a Rigidbody in the root game object"); - public static readonly GUIContent GenerateColliders = EditorGUIUtility.TrTextContent("Generate Colliders", "Generates mesh colliders for the LOD objects"); - - public static readonly GUIContent WindHeader = EditorGUIUtility.TrTextContent("Wind"); - public static readonly GUIContent WindQuality = EditorGUIUtility.TrTextContent("Wind Quality", "Controls the wind effect's quality."); - - public static readonly GUIContent LODHeader = EditorGUIUtility.TrTextContent("LOD"); - public static readonly GUIContent ResetLOD = EditorGUIUtility.TrTextContent("Reset LOD to...", "Unify the LOD settings for all selected assets"); - public static readonly GUIContent SmoothLOD = EditorGUIUtility.TrTextContent("Smooth Transitions", "Toggles smooth LOD transitions"); - public static readonly GUIContent AnimateCrossFading = EditorGUIUtility.TrTextContent("Animate Cross-fading", "Cross-fading is animated instead of being calculated by distance"); - public static readonly GUIContent CrossFadeWidth = EditorGUIUtility.TrTextContent("Crossfade Width", "Proportion of the last 3D mesh LOD region width which is used for cross-fading to billboard tree"); - public static readonly GUIContent FadeOutWidth = EditorGUIUtility.TrTextContent("Fade Out Width", "Proportion of the billboard LOD region width which is used for fading out the billboard"); - - public static readonly GUIContent EnableLodCustomizationsWarn = EditorGUIUtility.TrTextContent("Customizing LOD options may help with tuning the GPU performance but will likely negatively impact the instanced draw batching, i.e. CPU performance.\nPlease use the per-LOD customizations with careful memory and performance profiling for both CPU and GPU and remember that these options are a trade-off rather than a free win."); - public static readonly GUIContent BillboardSettingsHelp = EditorGUIUtility.TrTextContent("Billboard options are separate from the 3D model options shown above.\nChange the options below for influencing billboard rendering."); - - public static readonly GUIContent ApplyAndGenerate = EditorGUIUtility.TrTextContent("Apply & Generate Materials", "Apply current importer settings and generate asset materials with the new settings."); - public static readonly GUIContent Regenerate = EditorGUIUtility.TrTextContent("Regenerate Materials", "Regenerate materials using the current import settings."); + public static readonly GUIContent MeshesHeader = L10n.TextContent("Meshes", null, null, null); + public static readonly GUIContent UnitConversion = L10n.TextContent("Unit Conversion", "Select the unit conversion to apply to the imported SpeedTree asset", null, null); + public static readonly GUIContent ScaleFactor = L10n.TextContent("Scale Factor", "How much to scale the tree model, interpreting the exported units as meters. Must be positive.", null, null); + + public static readonly GUIContent EnableColorVariation = L10n.TextContent("Color Variation", "Color is determined by linearly interpolating between the Main Color & Color Variation values based on the world position X, Y and Z values", null, null); + public static readonly GUIContent EnableBump = L10n.TextContent("Normal Map", "Enable normal mapping (aka Bump mapping).", null, null); + public static readonly GUIContent EnableSubsurface = L10n.TextContent("Subsurface Scattering", "Enable subsurface scattering effects.", null, null); + public static readonly GUIContent MainColor = L10n.TextContent("Main Color", "The color modulating the diffuse lighting component.", null, null); + public static readonly GUIContent HueVariation = L10n.TextContent("Variation Color (RGB), Intensity (A)", "Tint the tree with the Variation Color", null, null); + public static readonly GUIContent AlphaTestRef = L10n.TextContent("Alpha Cutoff", "The alpha-test reference value.", null, null); + + public static readonly GUIContent LightingHeader = L10n.TextContent("Lighting", null, null, null); + public static readonly GUIContent CastShadows = L10n.TextContent("Cast Shadows", "The tree casts shadow", null, null); + public static readonly GUIContent ReceiveShadows = L10n.TextContent("Receive Shadows", "The tree receives shadow", null, null); + public static readonly GUIContent UseLightProbes = L10n.TextContent("Light Probes", "The tree uses light probe for lighting", null, null); // TODO: update help text + public static readonly GUIContent UseReflectionProbes = L10n.TextContent("Reflection Probes", "The tree uses reflection probe for rendering", null, null); // TODO: update help text + + public static readonly GUIContent AdditionalSettingsHeader = L10n.TextContent("Additional Settings", null, null, null); + public static readonly GUIContent MotionVectorMode = L10n.TextContent("Motion Vectors", "Motion vector mode to set for the mesh renderer of each LOD object", null, null); + public static readonly GUIContent GenerateRigidBody = L10n.TextContent("Generate Rigidbody", "Generates a Rigidbody in the root game object", null, null); + public static readonly GUIContent GenerateColliders = L10n.TextContent("Generate Colliders", "Generates mesh colliders for the LOD objects", null, null); + + public static readonly GUIContent WindHeader = L10n.TextContent("Wind", null, null, null); + public static readonly GUIContent WindQuality = L10n.TextContent("Wind Quality", "Controls the wind effect's quality.", null, null); + + public static readonly GUIContent LODHeader = L10n.TextContent("LOD", null, null, null); + public static readonly GUIContent ResetLOD = L10n.TextContent("Reset LOD to...", "Unify the LOD settings for all selected assets", null, null); + public static readonly GUIContent SmoothLOD = L10n.TextContent("Smooth Transitions", "Toggles smooth LOD transitions", null, null); + public static readonly GUIContent AnimateCrossFading = L10n.TextContent("Animate Cross-fading", "Cross-fading is animated instead of being calculated by distance", null, null); + public static readonly GUIContent CrossFadeWidth = L10n.TextContent("Crossfade Width", "Proportion of the last 3D mesh LOD region width which is used for cross-fading to billboard tree", null, null); + public static readonly GUIContent FadeOutWidth = L10n.TextContent("Fade Out Width", "Proportion of the billboard LOD region width which is used for fading out the billboard", null, null); + + public static readonly GUIContent EnableLodCustomizationsWarn = L10n.TextContent("Customizing LOD options may help with tuning the GPU performance but will likely negatively impact the instanced draw batching, i.e. CPU performance.\nPlease use the per-LOD customizations with careful memory and performance profiling for both CPU and GPU and remember that these options are a trade-off rather than a free win.", null, null, null); + public static readonly GUIContent BillboardSettingsHelp = L10n.TextContent("Billboard options are separate from the 3D model options shown above.\nChange the options below for influencing billboard rendering.", null, null, null); + + public static readonly GUIContent ApplyAndGenerate = L10n.TextContent("Apply & Generate Materials", "Apply current importer settings and generate asset materials with the new settings.", null, null); + public static readonly GUIContent Regenerate = L10n.TextContent("Regenerate Materials", "Regenerate materials using the current import settings.", null, null); public static readonly GUIContent[] ReflectionProbeUsageNames = Array.ConvertAll(Enum.GetNames(typeof(ReflectionProbeUsage)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] WindQualityNames = Array.ConvertAll(SpeedTreeImporter.windQualityNames, s => new GUIContent(s)); @@ -753,7 +753,7 @@ private void DrawLODSettingCustomizationGUI(List lods, int lodIn else { // Toggle - GUIContent customizationLabel = EditorGUIUtility.TrTextContent(String.Format("Customize {0} options", lods[lodIndex].LODName), "To override options for a certain LOD, check this box and select the LOD from the LOD slider above"); + GUIContent customizationLabel = L10n.TextContent(String.Format("Customize {0} options", lods[lodIndex].LODName), "To override options for a certain LOD, check this box and select the LOD from the LOD slider above", null, null); EditorGUILayout.PropertyField(lodSettingOverride, customizationLabel); // Warning diff --git a/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs b/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs index 4ced0b8de3..9b322bfc13 100644 --- a/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs +++ b/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs @@ -15,7 +15,7 @@ internal abstract class BaseTextureImportPlatformSettings { static class Styles { - static public readonly GUIContent overrideFor = EditorGUIUtility.TrTextContent("Override For {0}"); + static public readonly GUIContent overrideFor = L10n.TextContent("Override For {0}", null, null, null); } public abstract bool textureTypeHasMultipleDifferentValues { get; } @@ -159,7 +159,7 @@ internal static void ShowPlatformSpecificSettings(List textureShapeOptionsDictionnary = new Dictionary(); public readonly Dictionary textureShapeValuesDictionnary = new Dictionary(); - public readonly GUIContent defaultPlatform = EditorGUIUtility.TrTextContent("Default"); + public readonly GUIContent defaultPlatform = L10n.TextContent("Default", null, null, null); - public readonly GUIContent filterMode = EditorGUIUtility.TrTextContent("Filter Mode"); + public readonly GUIContent filterMode = L10n.TextContent("Filter Mode", null, null, null); public readonly GUIContent[] filterModeOptions = { - EditorGUIUtility.TrTextContent("Point (no filter)"), - EditorGUIUtility.TrTextContent("Bilinear"), - EditorGUIUtility.TrTextContent("Trilinear") + L10n.TextContent("Point (no filter)", null, null, null), + L10n.TextContent("Bilinear", null, null, null), + L10n.TextContent("Trilinear", null, null, null) }; - public readonly GUIContent cookieType = EditorGUIUtility.TrTextContent("Light Type"); + public readonly GUIContent cookieType = L10n.TextContent("Light Type", null, null, null); public readonly GUIContent[] cookieOptions = { - EditorGUIUtility.TrTextContent("Spot Light"), - EditorGUIUtility.TrTextContent("Directional Light"), - EditorGUIUtility.TrTextContent("Point Light"), + L10n.TextContent("Spot Light", null, null, null), + L10n.TextContent("Directional Light", null, null, null), + L10n.TextContent("Point Light", null, null, null), }; - public readonly GUIContent generateFromBump = EditorGUIUtility.TrTextContent("Create from Grayscale", "The grayscale of the image is used as a heightmap for generating the normal map."); - public readonly GUIContent bumpiness = EditorGUIUtility.TrTextContent("Bumpiness"); - public readonly GUIContent bumpFiltering = EditorGUIUtility.TrTextContent("Filtering"); + public readonly GUIContent generateFromBump = L10n.TextContent("Create from Grayscale", "The grayscale of the image is used as a heightmap for generating the normal map.", null, null); + public readonly GUIContent bumpiness = L10n.TextContent("Bumpiness", null, null, null); + public readonly GUIContent bumpFiltering = L10n.TextContent("Filtering", null, null, null); public readonly GUIContent[] bumpFilteringOptions = { - EditorGUIUtility.TrTextContent("Sharp"), - EditorGUIUtility.TrTextContent("Smooth"), + L10n.TextContent("Sharp", null, null, null), + L10n.TextContent("Smooth", null, null, null), }; - public readonly GUIContent flipGreenChannel = EditorGUIUtility.TrTextContent("Flip Green Channel", - "Invert values in the normal map green (Y) channel. Use on normal maps that were produced for non-Unity normal orientation convention."); - public readonly GUIContent swizzle = EditorGUIUtility.TrTextContent("Swizzle", - "Reorder and invert texture color channels. For each of R,G,B,A channels pick where the channel data comes from."); + public readonly GUIContent flipGreenChannel = L10n.TextContent("Flip Green Channel", + "Invert values in the normal map green (Y) channel. Use on normal maps that were produced for non-Unity normal orientation convention.", null, null); + public readonly GUIContent swizzle = L10n.TextContent("Swizzle", + "Reorder and invert texture color channels. For each of R,G,B,A channels pick where the channel data comes from.", null, null); - public readonly GUIContent cubemap = EditorGUIUtility.TrTextContent("Mapping"); + public readonly GUIContent cubemap = L10n.TextContent("Mapping", null, null, null); public readonly GUIContent[] cubemapOptions = { - EditorGUIUtility.TrTextContent("Auto"), - EditorGUIUtility.TrTextContent("6 Frames Layout (Cubic Environment)", "Texture contains 6 images arranged in one of the standard cubemap layouts - cross or sequence (+x, -x, +y, -y, +z, -z). Texture can be in vertical or horizontal orientation."), - EditorGUIUtility.TrTextContent("Latitude-Longitude Layout (Cylindrical)", "Texture contains an image of a ball unwrapped such that latitude and longitude are mapped to horizontal and vertical dimensions (as on a globe)."), - EditorGUIUtility.TrTextContent("Mirrored Ball (Spheremap)", "Texture contains an image of a mirrored ball.") + L10n.TextContent("Auto", null, null, null), + L10n.TextContent("6 Frames Layout (Cubic Environment)", "Texture contains 6 images arranged in one of the standard cubemap layouts - cross or sequence (+x, -x, +y, -y, +z, -z). Texture can be in vertical or horizontal orientation.", null, null), + L10n.TextContent("Latitude-Longitude Layout (Cylindrical)", "Texture contains an image of a ball unwrapped such that latitude and longitude are mapped to horizontal and vertical dimensions (as on a globe).", null, null), + L10n.TextContent("Mirrored Ball (Spheremap)", "Texture contains an image of a mirrored ball.", null, null) }; public readonly int[] cubemapValues2 = { @@ -258,12 +258,12 @@ internal class Styles (int)TextureImporterGenerateCubemap.Spheremap }; - public readonly GUIContent cubemapConvolution = EditorGUIUtility.TrTextContent("Convolution Type"); + public readonly GUIContent cubemapConvolution = L10n.TextContent("Convolution Type", null, null, null); public readonly GUIContent[] cubemapConvolutionOptions = { - EditorGUIUtility.TrTextContent("None"), - EditorGUIUtility.TrTextContent("Specular (Glossy Reflection)", "Convolve cubemap for specular reflections with varying smoothness (Glossy Reflections)."), - EditorGUIUtility.TrTextContent("Diffuse (Irradiance)", "Convolve cubemap for diffuse-only reflection (Irradiance Cubemap).") + L10n.TextContent("None", null, null, null), + L10n.TextContent("Specular (Glossy Reflection)", "Convolve cubemap for specular reflections with varying smoothness (Glossy Reflections).", null, null), + L10n.TextContent("Diffuse (Irradiance)", "Convolve cubemap for diffuse-only reflection (Irradiance Cubemap).", null, null) }; public readonly int[] cubemapConvolutionValues = { @@ -272,27 +272,27 @@ internal class Styles (int)TextureImporterCubemapConvolution.Diffuse }; - public readonly GUIContent seamlessCubemap = EditorGUIUtility.TrTextContent("Fixup Edge Seams", "Enable if this texture is used for glossy reflections."); - public readonly GUIContent textureFormat = EditorGUIUtility.TrTextContent("Format"); - - public readonly GUIContent mipmapFadeOutToggle = EditorGUIUtility.TrTextContent("Fadeout to Gray"); - public readonly GUIContent mipmapFadeStartMip = EditorGUIUtility.TrTextContent("Fade Start Mip"); - public readonly GUIContent mipmapFadeEndMip = EditorGUIUtility.TrTextContent("Fade End Mip"); - public readonly GUIContent mipmapFadeOut = EditorGUIUtility.TrTextContent("Fade Range"); - public readonly GUIContent readWrite = EditorGUIUtility.TrTextContent("Read/Write", "Enable to be able to access the raw pixel data from code."); - public readonly GUIContent useMipmapLimits = EditorGUIUtility.TrTextContent("Mipmap Limit", "Disable this if the number of mipmap levels to upload should not be limited by the quality settings. (effectively: always upload at full resolution, regardless of the global mipmap limit or mipmap limit groups)"); - public readonly GUIContent mipmapLimitGroupName = EditorGUIUtility.TrTextContent("Mipmap Limit Group", "Select a Mipmap Limit Group for this texture. If you do not add this texture to a Mipmap Limit Group, or Unity cannot find the group name you provide, Unity limits the number of mipmap levels it uploads to the maximum defined by the Global Texture Mipmap Limit (see Quality Settings). If Unity can find the Mipmap Limit Group you specify, it respects that group's limit."); - public readonly GUIContent mipmapLimitGroupWarning = EditorGUIUtility.TrTextContent("This texture takes the default mipmap limit settings because Unity cannot find the mipmap limit group you have designated. Consult your project's Quality Settings for a list of mipmap limit groups."); + public readonly GUIContent seamlessCubemap = L10n.TextContent("Fixup Edge Seams", "Enable if this texture is used for glossy reflections.", null, null); + public readonly GUIContent textureFormat = L10n.TextContent("Format", null, null, null); + + public readonly GUIContent mipmapFadeOutToggle = L10n.TextContent("Fadeout to Gray", null, null, null); + public readonly GUIContent mipmapFadeStartMip = L10n.TextContent("Fade Start Mip", null, null, null); + public readonly GUIContent mipmapFadeEndMip = L10n.TextContent("Fade End Mip", null, null, null); + public readonly GUIContent mipmapFadeOut = L10n.TextContent("Fade Range", null, null, null); + public readonly GUIContent readWrite = L10n.TextContent("Read/Write", "Enable to be able to access the raw pixel data from code.", null, null); + public readonly GUIContent useMipmapLimits = L10n.TextContent("Mipmap Limit", "Disable this if the number of mipmap levels to upload should not be limited by the quality settings. (effectively: always upload at full resolution, regardless of the global mipmap limit or mipmap limit groups)", null, null); + public readonly GUIContent mipmapLimitGroupName = L10n.TextContent("Mipmap Limit Group", "Select a Mipmap Limit Group for this texture. If you do not add this texture to a Mipmap Limit Group, or Unity cannot find the group name you provide, Unity limits the number of mipmap levels it uploads to the maximum defined by the Global Texture Mipmap Limit (see Quality Settings). If Unity can find the Mipmap Limit Group you specify, it respects that group's limit.", null, null); + public readonly GUIContent mipmapLimitGroupWarning = L10n.TextContent("This texture takes the default mipmap limit settings because Unity cannot find the mipmap limit group you have designated. Consult your project's Quality Settings for a list of mipmap limit groups.", null, null, null); public readonly GUIContent streamingMipmaps = EditorGUIUtility.TrTextContent("Stream Mipmap Levels", "Only load larger mipmap levels as needed to render the current game cameras. Requires Texture Mipmap Streaming to be enabled in quality settings."); public readonly GUIContent streamingMipmapsPriority = EditorGUIUtility.TrTextContent("Priority", "Mipmap streaming priority when there's contention for resources. Positive numbers represent higher priority. Valid range is -128 to 127."); public readonly GUIContent vtOnly = EditorGUIUtility.TrTextContent("Virtual Texture Only", "Texture is optimized for use as a virtual texture and can only be used as a virtual texture."); - public readonly GUIContent alphaSource = EditorGUIUtility.TrTextContent("Alpha Source", "How is the alpha generated for the imported texture."); + public readonly GUIContent alphaSource = L10n.TextContent("Alpha Source", "How is the alpha generated for the imported texture.", null, null); public readonly GUIContent[] alphaSourceOptions = { - EditorGUIUtility.TrTextContent("None", "No Alpha will be used."), - EditorGUIUtility.TrTextContent("Input Texture Alpha", "Use Alpha from the input texture if one is provided."), - EditorGUIUtility.TrTextContent("From Gray Scale", "Generate Alpha from image gray scale."), + L10n.TextContent("None", "No Alpha will be used.", null, null), + L10n.TextContent("Input Texture Alpha", "Use Alpha from the input texture if one is provided.", null, null), + L10n.TextContent("From Gray Scale", "Generate Alpha from image gray scale.", null, null), }; public readonly int[] alphaSourceValues = { @@ -301,11 +301,11 @@ internal class Styles (int)TextureImporterAlphaSource.FromGrayScale, }; - public readonly GUIContent singleChannelComponent = EditorGUIUtility.TrTextContent("Channel", "As which color/alpha component the single channel texture is treated."); + public readonly GUIContent singleChannelComponent = L10n.TextContent("Channel", "As which color/alpha component the single channel texture is treated.", null, null); public readonly GUIContent[] singleChannelComponentOptions = { - EditorGUIUtility.TrTextContent("Alpha", "Use the alpha channel (compression not supported)."), - EditorGUIUtility.TrTextContent("Red", "Use the red color component."), + L10n.TextContent("Alpha", "Use the alpha channel (compression not supported).", null, null), + L10n.TextContent("Red", "Use the red color component.", null, null), }; public readonly int[] singleChannelComponentValues = { @@ -313,72 +313,72 @@ internal class Styles (int)TextureImporterSingleChannelComponent.Red, }; - public readonly GUIContent generateMipMaps = EditorGUIUtility.TrTextContent("Generate Mipmap", "Create progressively smaller versions of the texture, for reduced texture shimmering and better GPU performance when the texture is viewed at a distance."); - public readonly GUIContent showMipmapGenerationSettings = EditorGUIUtility.TrTextContent("Generation Settings", "Set up how the mipmap levels are generated from the imported image."); - public readonly GUIContent sRGBTexture = EditorGUIUtility.TrTextContent("sRGB (Color Texture)", "Texture content is stored in gamma space. Non-HDR color textures should enable this flag (except if used for IMGUI)."); - public readonly GUIContent sRGBForEtc1Warning = EditorGUIUtility.TrTextContent("Unity does not support importing textures as ETC when that texture is in the sRGB color space and the project is set to use a Linear color space. One or more of the textures you have selected are imported as ETC2 instead."); - public readonly GUIContent borderMipMaps = EditorGUIUtility.TrTextContent("Replicate Border", "Replicate pixel values from texture borders into smaller mipmap levels. Mostly used for Cookie texture types."); - public readonly GUIContent mipMapsPreserveCoverage = EditorGUIUtility.TrTextContent("Preserve Coverage", "The alpha channel of generated mipmaps will preserve coverage for the alpha test. Useful for foliage textures."); - public readonly GUIContent alphaTestReferenceValue = EditorGUIUtility.TrTextContent("Alpha Cutoff", "The reference value used during the alpha test. Controls mipmap coverage."); - public readonly GUIContent mipMapFilter = EditorGUIUtility.TrTextContent("Mipmap Filtering"); + public readonly GUIContent generateMipMaps = L10n.TextContent("Generate Mipmap", "Create progressively smaller versions of the texture, for reduced texture shimmering and better GPU performance when the texture is viewed at a distance.", null, null); + public readonly GUIContent showMipmapGenerationSettings = L10n.TextContent("Generation Settings", "Set up how the mipmap levels are generated from the imported image.", null, null); + public readonly GUIContent sRGBTexture = L10n.TextContent("sRGB (Color Texture)", "Texture content is stored in gamma space. Non-HDR color textures should enable this flag (except if used for IMGUI).", null, null); + public readonly GUIContent sRGBForEtc1Warning = L10n.TextContent("Unity does not support importing textures as ETC when that texture is in the sRGB color space and the project is set to use a Linear color space. One or more of the textures you have selected are imported as ETC2 instead.", null, null, null); + public readonly GUIContent borderMipMaps = L10n.TextContent("Replicate Border", "Replicate pixel values from texture borders into smaller mipmap levels. Mostly used for Cookie texture types.", null, null); + public readonly GUIContent mipMapsPreserveCoverage = L10n.TextContent("Preserve Coverage", "The alpha channel of generated mipmaps will preserve coverage for the alpha test. Useful for foliage textures.", null, null); + public readonly GUIContent alphaTestReferenceValue = L10n.TextContent("Alpha Cutoff", "The reference value used during the alpha test. Controls mipmap coverage.", null, null); + public readonly GUIContent mipMapFilter = L10n.TextContent("Mipmap Filtering", null, null, null); public readonly GUIContent[] mipMapFilterOptions = { - EditorGUIUtility.TrTextContent("Box"), - EditorGUIUtility.TrTextContent("Kaiser"), + L10n.TextContent("Box", null, null, null), + L10n.TextContent("Kaiser", null, null, null), }; - public readonly GUIContent npot = EditorGUIUtility.TrTextContent("Non-Power of 2", "How non-power-of-two textures are scaled on import."); - public readonly GUIContent generateCubemap = EditorGUIUtility.TrTextContent("Generate Cubemap"); + public readonly GUIContent npot = L10n.TextContent("Non-Power of 2", "How non-power-of-two textures are scaled on import.", null, null); + public readonly GUIContent generateCubemap = L10n.TextContent("Generate Cubemap", null, null, null); - public readonly GUIContent spriteMode = EditorGUIUtility.TrTextContent("Sprite Mode"); + public readonly GUIContent spriteMode = L10n.TextContent("Sprite Mode", null, null, null); public readonly GUIContent[] spriteModeOptions = { - EditorGUIUtility.TrTextContent("Single"), - EditorGUIUtility.TrTextContent("Multiple"), - EditorGUIUtility.TrTextContent("Polygon"), + L10n.TextContent("Single", null, null, null), + L10n.TextContent("Multiple", null, null, null), + L10n.TextContent("Polygon", null, null, null), }; public readonly GUIContent[] spriteMeshTypeOptions = { - EditorGUIUtility.TrTextContent("Full Rect"), - EditorGUIUtility.TrTextContent("Tight"), + L10n.TextContent("Full Rect", null, null, null), + L10n.TextContent("Tight", null, null, null), }; - public readonly GUIContent spritePixelsPerUnit = EditorGUIUtility.TrTextContent("Pixels Per Unit", "How many pixels in the sprite correspond to one unit in the world."); - public readonly GUIContent spriteExtrude = EditorGUIUtility.TrTextContent("Extrude Edges", "How much empty area to leave around the sprite in the generated mesh."); - public readonly GUIContent spriteTriangulation = EditorGUIUtility.TrTextContent("Mesh Triangulation Method", "Use Legacy for old method. And UTess for Delaunary with Subdivision"); - public readonly GUIContent spriteOutline = EditorGUIUtility.TrTextContent("Outline Detail", "Sprite Outline Detail."); - public readonly GUIContent spriteSubdivision = EditorGUIUtility.TrTextContent("Mesh Subdivision", "Refine triangulation."); - public readonly GUIContent spriteMeshType = EditorGUIUtility.TrTextContent("Mesh Type", "Type of sprite mesh to generate."); - public readonly GUIContent spriteAlignment = EditorGUIUtility.TrTextContent("Pivot", "Sprite pivot point in its localspace. May be used for syncing animation frames of different sizes."); + public readonly GUIContent spritePixelsPerUnit = L10n.TextContent("Pixels Per Unit", "How many pixels in the sprite correspond to one unit in the world.", null, null); + public readonly GUIContent spriteExtrude = L10n.TextContent("Extrude Edges", "How much empty area to leave around the sprite in the generated mesh.", null, null); + public readonly GUIContent spriteTriangulation = L10n.TextContent("Mesh Triangulation Method", "Use Legacy for old method. And UTess for Delaunary with Subdivision", null, null); + public readonly GUIContent spriteOutline = L10n.TextContent("Outline Detail", "Sprite Outline Detail.", null, null); + public readonly GUIContent spriteSubdivision = L10n.TextContent("Mesh Subdivision", "Refine triangulation.", null, null); + public readonly GUIContent spriteMeshType = L10n.TextContent("Mesh Type", "Type of sprite mesh to generate.", null, null); + public readonly GUIContent spriteAlignment = L10n.TextContent("Pivot", "Sprite pivot point in its localspace. May be used for syncing animation frames of different sizes.", null, null); public readonly GUIContent[] spriteAlignmentOptions = { - EditorGUIUtility.TrTextContent("Center"), - EditorGUIUtility.TrTextContent("Top Left"), - EditorGUIUtility.TrTextContent("Top"), - EditorGUIUtility.TrTextContent("Top Right"), - EditorGUIUtility.TrTextContent("Left"), - EditorGUIUtility.TrTextContent("Right"), - EditorGUIUtility.TrTextContent("Bottom Left"), - EditorGUIUtility.TrTextContent("Bottom"), - EditorGUIUtility.TrTextContent("Bottom Right"), - EditorGUIUtility.TrTextContent("Custom"), + L10n.TextContent("Center", null, null, null), + L10n.TextContent("Top Left", null, null, null), + L10n.TextContent("Top", null, null, null), + L10n.TextContent("Top Right", null, null, null), + L10n.TextContent("Left", null, null, null), + L10n.TextContent("Right", null, null, null), + L10n.TextContent("Bottom Left", null, null, null), + L10n.TextContent("Bottom", null, null, null), + L10n.TextContent("Bottom Right", null, null, null), + L10n.TextContent("Custom", null, null, null), }; - public readonly GUIContent spriteGenerateFallbackPhysicsOutline = EditorGUIUtility.TrTextContent("Generate Physics Outline", "Generates a default physics outline from the shape of the Sprite(s) when a physics outline has not been set in the Sprite Editor."); - public readonly GUIContent applyAndContinueToSpriteEditor = EditorGUIUtility.TrTextContent("Unapplied import settings for \'{0}\'.\n Apply changes and continue to Sprite Editor Window?"); - public readonly GUIContent unappliedImportSettings = EditorGUIUtility.TrTextContent("Unapplied import settings"); - public readonly GUIContent yes = EditorGUIUtility.TrTextContent("Yes"); - public readonly GUIContent no = EditorGUIUtility.TrTextContent("No"); + public readonly GUIContent spriteGenerateFallbackPhysicsOutline = L10n.TextContent("Generate Physics Outline", "Generates a default physics outline from the shape of the Sprite(s) when a physics outline has not been set in the Sprite Editor.", null, null); + public readonly GUIContent applyAndContinueToSpriteEditor = L10n.TextContent("Unapplied import settings for \'{0}\'.\n Apply changes and continue to Sprite Editor Window?", null, null, null); + public readonly GUIContent unappliedImportSettings = L10n.TextContent("Unapplied import settings", null, null, null); + public readonly GUIContent yes = L10n.TextContent("Yes", null, null, null); + public readonly GUIContent no = L10n.TextContent("No", null, null, null); - public readonly GUIContent alphaIsTransparency = EditorGUIUtility.TrTextContent("Alpha Is Transparency", "If the alpha channel of your texture represents transparency, enable this property to dilate the color channels of visible texels into fully transparent areas. This effectively adds padding around transparent areas that prevents filtering artifacts from forming on their edges. Unity does not support this property for HDR textures. \n\nThis property makes the color data of invisible texels undefined. Disable this property to preserve invisible texels' original color data."); + public readonly GUIContent alphaIsTransparency = L10n.TextContent("Alpha Is Transparency", "If the alpha channel of your texture represents transparency, enable this property to dilate the color channels of visible texels into fully transparent areas. This effectively adds padding around transparent areas that prevents filtering artifacts from forming on their edges. Unity does not support this property for HDR textures. \n\nThis property makes the color data of invisible texels undefined. Disable this property to preserve invisible texels' original color data.", null, null); - public readonly GUIContent showAdvanced = EditorGUIUtility.TrTextContent("Advanced", "Show advanced settings."); + public readonly GUIContent showAdvanced = L10n.TextContent("Advanced", "Show advanced settings.", null, null); - public readonly GUIContent psdRemoveMatte = EditorGUIUtility.TrTextContent("Remove PSD Matte", "Enable special processing for PSD that has transparency, as color pixels will be tweaked (blended with white color)."); + public readonly GUIContent psdRemoveMatte = L10n.TextContent("Remove PSD Matte", "Enable special processing for PSD that has transparency, as color pixels will be tweaked (blended with white color).", null, null); - public readonly GUIContent ignorePngGamma = EditorGUIUtility.TrTextContent("Ignore PNG Gamma", "Ignore the Gamma attribute value in PNG files."); - public readonly GUIContent readWriteWarning = EditorGUIUtility.TrTextContent("When you enable Read/Write, Unity stores an additional copy of your textures in CPU-addressable memory. One or more of the textures you have selected use a considerable amount of memory (more than 512MB)."); + public readonly GUIContent ignorePngGamma = L10n.TextContent("Ignore PNG Gamma", "Ignore the Gamma attribute value in PNG files.", null, null); + public readonly GUIContent readWriteWarning = L10n.TextContent("When you enable Read/Write, Unity stores an additional copy of your textures in CPU-addressable memory. One or more of the textures you have selected use a considerable amount of memory (more than 512MB).", null, null, null); - public readonly GUIContent flipbookColumns = EditorGUIUtility.TrTextContent("Columns", "Source image is divided into this amount of columns."); - public readonly GUIContent flipbookRows = EditorGUIUtility.TrTextContent("Rows", "Source image is divided into this amount of rows."); + public readonly GUIContent flipbookColumns = L10n.TextContent("Columns", "Source image is divided into this amount of columns.", null, null); + public readonly GUIContent flipbookRows = L10n.TextContent("Rows", "Source image is divided into this amount of rows.", null, null); public Styles() { @@ -1527,7 +1527,7 @@ void TextureSettingsGUI() bool displayWarning = TargetsHaveNPOTTextures(); if (displayWarning) { - GUIContent c = EditorGUIUtility.TrTextContent("Graphics device doesn't support Repeat wrap mode on NPOT textures. Falling back to Clamp."); + GUIContent c = L10n.TextContent("Graphics device doesn't support Repeat wrap mode on NPOT textures. Falling back to Clamp.", null, null, null); EditorGUILayout.HelpBox(c.text, MessageType.Warning, true); } } @@ -1547,6 +1547,7 @@ void TextureSettingsGUI() } + public override void OnInspectorGUI() { serializedObject.Update(); diff --git a/Editor/Mono/Inspector/AimConstraintEditor.cs b/Editor/Mono/Inspector/AimConstraintEditor.cs index 7a59b3b47f..94435b281f 100644 --- a/Editor/Mono/Inspector/AimConstraintEditor.cs +++ b/Editor/Mono/Inspector/AimConstraintEditor.cs @@ -34,23 +34,23 @@ internal class AimConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_RotationAtRest = EditorGUIUtility.TrTextContent("Rotation At Rest", "The orientation of the constrained object when the weights of the sources add up to zero or when all the rotation axes are disabled."); - GUIContent m_RotationOffset = EditorGUIUtility.TrTextContent("Rotation Offset", "The offset from the constrained orientation."); + GUIContent m_RotationAtRest = L10n.TextContent("Rotation At Rest", "The orientation of the constrained object when the weights of the sources add up to zero or when all the rotation axes are disabled.", null, null); + GUIContent m_RotationOffset = L10n.TextContent("Rotation Offset", "The offset from the constrained orientation.", null, null); - GUIContent m_RotationAxes = EditorGUIUtility.TrTextContent("Freeze Rotation Axes", "The axes along which the constraint is applied."); + GUIContent m_RotationAxes = L10n.TextContent("Freeze Rotation Axes", "The axes along which the constraint is applied.", null, null); - GUIContent m_AimVector = EditorGUIUtility.TrTextContent("Aim Vector", "Specifies which axis of the constrained object should aim at the target."); - GUIContent m_UpVector = EditorGUIUtility.TrTextContent("Up Vector", "Specifies the direction of the up vector in local space."); - GUIContent m_WorldUpVector = EditorGUIUtility.TrTextContent("World Up Vector", "Specifies the direction of the global up vector."); - GUIContent m_WorldUpObject = EditorGUIUtility.TrTextContent("World Up Object", "The reference object when the World Up Type is either Object Up or Object Rotation Up."); - GUIContent m_WorldUpType = EditorGUIUtility.TrTextContent("World Up Type", "Specifies how the world up vector should be computed."); + GUIContent m_AimVector = L10n.TextContent("Aim Vector", "Specifies which axis of the constrained object should aim at the target.", null, null); + GUIContent m_UpVector = L10n.TextContent("Up Vector", "Specifies the direction of the up vector in local space.", null, null); + GUIContent m_WorldUpVector = L10n.TextContent("World Up Vector", "Specifies the direction of the global up vector.", null, null); + GUIContent m_WorldUpObject = L10n.TextContent("World Up Object", "The reference object when the World Up Type is either Object Up or Object Rotation Up.", null, null); + GUIContent m_WorldUpType = L10n.TextContent("World Up Type", "Specifies how the world up vector should be computed.", null, null); GUIContent[] m_WorldUpTypes = { - EditorGUIUtility.TrTextContent("Scene Up", "Use the Y axis as the world up vector."), - EditorGUIUtility.TrTextContent("Object Up", "Use a vector that points to the reference object as the world up vector."), - EditorGUIUtility.TrTextContent("Object Rotation Up", "Use a vector defined in the reference object's local space as the world up vector."), - EditorGUIUtility.TrTextContent("Vector", "The world up vector is user defined."), - EditorGUIUtility.TrTextContent("None", "The world up vector is ignored.") + L10n.TextContent("Scene Up", "Use the Y axis as the world up vector.", null, null), + L10n.TextContent("Object Up", "Use a vector that points to the reference object as the world up vector.", null, null), + L10n.TextContent("Object Rotation Up", "Use a vector defined in the reference object's local space as the world up vector.", null, null), + L10n.TextContent("Vector", "The world up vector is user defined.", null, null), + L10n.TextContent("None", "The world up vector is ignored.", null, null) }; public override GUIContent AtRest { get { return m_RotationAtRest; } } public override GUIContent Offset { get { return m_RotationOffset; } } diff --git a/Editor/Mono/Inspector/AnimationClipEditor.cs b/Editor/Mono/Inspector/AnimationClipEditor.cs index 253557d4e5..4507453e21 100644 --- a/Editor/Mono/Inspector/AnimationClipEditor.cs +++ b/Editor/Mono/Inspector/AnimationClipEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEngine; using UnityEditor.Animations; using System; @@ -59,101 +58,101 @@ internal static void EditWithImporter(AnimationClip clip) internal static class Styles { - public static readonly GUIContent StartFrame = EditorGUIUtility.TrTextContent("Start", "Start frame of the clip."); - public static readonly GUIContent EndFrame = EditorGUIUtility.TrTextContent("End", "End frame of the clip."); + public static readonly GUIContent StartFrame = L10n.TextContent("Start", "Start frame of the clip.", null, null); + public static readonly GUIContent EndFrame = L10n.TextContent("End", "End frame of the clip.", null, null); public static readonly string AverageVelocity = L10n.Tr("Average Velocity: {0}\nAverage Angular Y Speed: {1} deg/s", null); - public static readonly GUIContent HasAdditiveReferencePose = EditorGUIUtility.TrTextContent("Additive Reference Pose", "Enable to define the additive reference pose frame."); - public static readonly GUIContent AdditiveReferencePoseFrame = EditorGUIUtility.TrTextContent("Pose Frame", "Pose Frame."); - public static readonly GUIContent LoopTime = EditorGUIUtility.TrTextContent("Loop Time", "Enable to make the animation play through and then restart when the end is reached."); - public static readonly GUIContent LoopPose = EditorGUIUtility.TrTextContent("Loop Pose", "Enable to make the animation loop seamlessly."); - public static readonly GUIContent LoopCycleOffset = EditorGUIUtility.TrTextContent("Cycle Offset", "Offset to the cycle of a looping animation, if we want to start it at a different time."); - public static readonly GUIContent RootTransformRotation = EditorGUIUtility.TrTextContent("Root Transform Rotation"); - public static readonly GUIContent RootTransformRotationY = EditorGUIUtility.TrTextContent("Root Transform Position (Y)"); - public static readonly GUIContent RootTransformPositionXZ = EditorGUIUtility.TrTextContent("Root Transform Position (XZ)"); + public static readonly GUIContent HasAdditiveReferencePose = L10n.TextContent("Additive Reference Pose", "Enable to define the additive reference pose frame.", null, null); + public static readonly GUIContent AdditiveReferencePoseFrame = L10n.TextContent("Pose Frame", "Pose Frame.", null, null); + public static readonly GUIContent LoopTime = L10n.TextContent("Loop Time", "Enable to make the animation play through and then restart when the end is reached.", null, null); + public static readonly GUIContent LoopPose = L10n.TextContent("Loop Pose", "Enable to make the animation loop seamlessly.", null, null); + public static readonly GUIContent LoopCycleOffset = L10n.TextContent("Cycle Offset", "Offset to the cycle of a looping animation, if we want to start it at a different time.", null, null); + public static readonly GUIContent RootTransformRotation = L10n.TextContent("Root Transform Rotation", null, null, null); + public static readonly GUIContent RootTransformRotationY = L10n.TextContent("Root Transform Position (Y)", null, null, null); + public static readonly GUIContent RootTransformPositionXZ = L10n.TextContent("Root Transform Position (XZ)", null, null, null); - public static readonly GUIContent BakeIntoPoseOrientation = EditorGUIUtility.TrTextContent("Bake Into Pose", "Enable to make root rotation be baked into the movement of the bones. Disable to make root rotation be stored as root motion."); - public static readonly GUIContent OrientationOffsetY = EditorGUIUtility.TrTextContent("Offset", "Offset to the root rotation (in degrees)."); + public static readonly GUIContent BakeIntoPoseOrientation = L10n.TextContent("Bake Into Pose", "Enable to make root rotation be baked into the movement of the bones. Disable to make root rotation be stored as root motion.", null, null); + public static readonly GUIContent OrientationOffsetY = L10n.TextContent("Offset", "Offset to the root rotation (in degrees).", null, null); - public static readonly GUIContent BasedUponOrientation = EditorGUIUtility.TrTextContent("Based Upon", "What the root rotation is based upon."); - public static readonly GUIContent BasedUponStartOrientation = EditorGUIUtility.TrTextContent("Based Upon (at Start)", "What the root rotation is based upon."); + public static readonly GUIContent BasedUponOrientation = L10n.TextContent("Based Upon", "What the root rotation is based upon.", null, null); + public static readonly GUIContent BasedUponStartOrientation = L10n.TextContent("Based Upon (at Start)", "What the root rotation is based upon.", null, null); public static readonly GUIContent[] BasedUponRotationHumanOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the rotation as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Body Orientation", "Keeps the upper body pointing forward.") + L10n.TextContent("Original", "Keeps the rotation as it is authored in the source file.", null, null), + L10n.TextContent("Body Orientation", "Keeps the upper body pointing forward.", null, null) }; public static readonly GUIContent[] BasedUponRotationOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the rotation as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Root Node Rotation", "Keeps the upper body pointing forward.") + L10n.TextContent("Original", "Keeps the rotation as it is authored in the source file.", null, null), + L10n.TextContent("Root Node Rotation", "Keeps the upper body pointing forward.", null, null) }; - public static readonly GUIContent BakeIntoPosePositionY = EditorGUIUtility.TrTextContent("Bake Into Pose", "Enable to make vertical root motion be baked into the movement of the bones. Disable to make vertical root motion be stored as root motion."); - public static readonly GUIContent PositionOffsetY = EditorGUIUtility.TrTextContent("Offset", "Offset to the vertical root position."); + public static readonly GUIContent BakeIntoPosePositionY = L10n.TextContent("Bake Into Pose", "Enable to make vertical root motion be baked into the movement of the bones. Disable to make vertical root motion be stored as root motion.", null, null); + public static readonly GUIContent PositionOffsetY = L10n.TextContent("Offset", "Offset to the vertical root position.", null, null); - public static readonly GUIContent BasedUponPositionY = EditorGUIUtility.TrTextContent("Based Upon", "What the vertical root position is based upon."); - public static readonly GUIContent BasedUponStartPositionY = EditorGUIUtility.TrTextContent("Based Upon (at Start)", "What the vertical root position is based upon."); + public static readonly GUIContent BasedUponPositionY = L10n.TextContent("Based Upon", "What the vertical root position is based upon.", null, null); + public static readonly GUIContent BasedUponStartPositionY = L10n.TextContent("Based Upon (at Start)", "What the vertical root position is based upon.", null, null); public static readonly GUIContent[] BasedUponPositionYHumanOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the vertical position as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Center of Mass", "Keeps the center of mass aligned with root transform position."), - EditorGUIUtility.TrTextContent("Feet", "Keeps the feet aligned with the root transform position.") + L10n.TextContent("Original", "Keeps the vertical position as it is authored in the source file.", null, null), + L10n.TextContent("Center of Mass", "Keeps the center of mass aligned with root transform position.", null, null), + L10n.TextContent("Feet", "Keeps the feet aligned with the root transform position.", null, null) }; public static readonly GUIContent[] BasedUponPositionYOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the vertical position as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Root Node Position") + L10n.TextContent("Original", "Keeps the vertical position as it is authored in the source file.", null, null), + L10n.TextContent("Root Node Position", null, null, null) }; - public static readonly GUIContent BakeIntoPosePositionXZ = EditorGUIUtility.TrTextContent("Bake Into Pose", "Enable to make horizontal root motion be baked into the movement of the bones. Disable to make horizontal root motion be stored as root motion."); + public static readonly GUIContent BakeIntoPosePositionXZ = L10n.TextContent("Bake Into Pose", "Enable to make horizontal root motion be baked into the movement of the bones. Disable to make horizontal root motion be stored as root motion.", null, null); - public static readonly GUIContent BasedUponPositionXZ = EditorGUIUtility.TrTextContent("Based Upon", "What the horizontal root position is based upon."); - public static readonly GUIContent BasedUponStartPositionXZ = EditorGUIUtility.TrTextContent("Based Upon (at Start)", "What the horizontal root position is based upon."); + public static readonly GUIContent BasedUponPositionXZ = L10n.TextContent("Based Upon", "What the horizontal root position is based upon.", null, null); + public static readonly GUIContent BasedUponStartPositionXZ = L10n.TextContent("Based Upon (at Start)", "What the horizontal root position is based upon.", null, null); public static readonly GUIContent[] BasedUponPositionXZHumanOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the horizontal position as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Center of Mass", "Keeps the center of mass aligned with root transform position.") + L10n.TextContent("Original", "Keeps the horizontal position as it is authored in the source file.", null, null), + L10n.TextContent("Center of Mass", "Keeps the center of mass aligned with root transform position.", null, null) }; public static readonly GUIContent[] BasedUponPositionXZOpt = { - EditorGUIUtility.TrTextContent("Original", "Keeps the horizontal position as it is authored in the source file."), - EditorGUIUtility.TrTextContent("Root Node Position") + L10n.TextContent("Original", "Keeps the horizontal position as it is authored in the source file.", null, null), + L10n.TextContent("Root Node Position", null, null, null) }; - public static readonly GUIContent Mirror = EditorGUIUtility.TrTextContent("Mirror", "Mirror left and right in this clip."); + public static readonly GUIContent Mirror = L10n.TextContent("Mirror", "Mirror left and right in this clip.", null, null); - public static readonly GUIContent Curves = EditorGUIUtility.TrTextContent("Curves", "Parameter-related curves."); - public static readonly GUIContent Length = EditorGUIUtility.TrTextContent("Length"); - public static readonly GUIContent AddLoopFrame = EditorGUIUtility.TrTextContent("Add Loop Frame"); - public static readonly GUIContent WrapMode = EditorGUIUtility.TrTextContent("Wrap Mode"); - public static readonly GUIContent Events = EditorGUIUtility.TrTextContent("Events"); - public static readonly GUIContent LoopMatch = EditorGUIUtility.TrTextContent("loop match"); + public static readonly GUIContent Curves = L10n.TextContent("Curves", "Parameter-related curves.", null, null); + public static readonly GUIContent Length = L10n.TextContent("Length", null, null, null); + public static readonly GUIContent AddLoopFrame = L10n.TextContent("Add Loop Frame", null, null, null); + public static readonly GUIContent WrapMode = L10n.TextContent("Wrap Mode", null, null, null); + public static readonly GUIContent Events = L10n.TextContent("Events", null, null, null); + public static readonly GUIContent LoopMatch = L10n.TextContent("loop match", null, null, null); public static readonly string InvalidMultiSelection = L10n.Tr("Both legacy and non legacy Animation Clips have been selected. This combination cannot be edited together. Select either legacy or non legacy Animation Clips.", null); - public static readonly GUIContent AddEventContent = EditorGUIUtility.TrIconContent("Animation.AddEvent", "Add Event."); + public static readonly GUIContent AddEventContent = L10n.IconContent("Animation.AddEvent", "Add Event.", null); public static readonly GUIContent GreenLightIcon = EditorGUIUtility.IconContent("lightMeter/greenLight"); public static readonly GUIContent LightRimIcon = EditorGUIUtility.IconContent("lightMeter/lightRim"); public static readonly GUIContent OrangeLightIcon = EditorGUIUtility.IconContent("lightMeter/orangeLight"); public static readonly GUIContent RedLightIcon = EditorGUIUtility.IconContent("lightMeter/redLight"); - public static readonly GUIContent PrevKeyContent = EditorGUIUtility.TrIconContent("Animation.PrevKey", "Go to previous key frame."); - public static readonly GUIContent NextKeyContent = EditorGUIUtility.TrIconContent("Animation.NextKey", "Go to next key frame."); - public static readonly GUIContent AddKeyframeContent = EditorGUIUtility.TrIconContent("Animation.AddKeyframe", "Add Keyframe."); + public static readonly GUIContent PrevKeyContent = L10n.IconContent("Animation.PrevKey", "Go to previous key frame.", null); + public static readonly GUIContent NextKeyContent = L10n.IconContent("Animation.NextKey", "Go to next key frame.", null); + public static readonly GUIContent AddKeyframeContent = L10n.IconContent("Animation.AddKeyframe", "Add Keyframe.", null); - public static readonly GUIContent AddEvent = EditorGUIUtility.TrTextContent("Add Animation Event"); - public static readonly GUIContent DeleteEvents = EditorGUIUtility.TrTextContent("Delete Animation Events"); - public static readonly GUIContent DeleteEvent = EditorGUIUtility.TrTextContent("Delete Animation Event"); - public static readonly GUIContent CopyEvents = EditorGUIUtility.TrTextContent("Copy Animation Events"); - public static readonly GUIContent PasteEvents = EditorGUIUtility.TrTextContent("Paste Animation Events"); + public static readonly GUIContent AddEvent = L10n.TextContent("Add Animation Event", null, null, null); + public static readonly GUIContent DeleteEvents = L10n.TextContent("Delete Animation Events", null, null, null); + public static readonly GUIContent DeleteEvent = L10n.TextContent("Delete Animation Event", null, null, null); + public static readonly GUIContent CopyEvents = L10n.TextContent("Copy Animation Events", null, null, null); + public static readonly GUIContent PasteEvents = L10n.TextContent("Paste Animation Events", null, null, null); } static readonly string s_LoopMeterStr = "LoopMeter"; @@ -2172,4 +2171,3 @@ public void UpdateEvents(AnimationClipInfoProperties clipInfo) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/AnimatorInspector.cs b/Editor/Mono/Inspector/AnimatorInspector.cs index 39b852e4f9..c8b01c1960 100644 --- a/Editor/Mono/Inspector/AnimatorInspector.cs +++ b/Editor/Mono/Inspector/AnimatorInspector.cs @@ -33,10 +33,10 @@ internal class AnimatorInspector : Editor class Styles { - public GUIContent applyRootMotion = new GUIContent(EditorGUIUtility.TrTextContent("Apply Root Motion")); - public GUIContent updateMode = new GUIContent(EditorGUIUtility.TrTextContent("Update Mode")); - public GUIContent cullingMode = new GUIContent(EditorGUIUtility.TrTextContent("Culling Mode")); - public GUIContent animatePhysics = new GUIContent(EditorGUIUtility.TrTextContent("Animate Physics")); + public GUIContent applyRootMotion = new GUIContent(L10n.TextContent("Apply Root Motion", null, null, null)); + public GUIContent updateMode = new GUIContent(L10n.TextContent("Update Mode", null, null, null)); + public GUIContent cullingMode = new GUIContent(L10n.TextContent("Culling Mode", null, null, null)); + public GUIContent animatePhysics = new GUIContent(L10n.TextContent("Animate Physics", null, null, null)); public Styles() { diff --git a/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs b/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs index f29225371a..7bc62fe42b 100644 --- a/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs +++ b/Editor/Mono/Inspector/AssemblyDefinitionImporterInspector.cs @@ -23,28 +23,28 @@ internal class AssemblyDefinitionImporterInspector : AssetImporterEditor { internal class Styles { - public static readonly GUIContent name = EditorGUIUtility.TrTextContent("Name", "The assembly name is used to generate a .dll file on you disk."); - public static readonly GUIContent rootNamespace = EditorGUIUtility.TrTextContent("Root Namespace", "Specify the root namespace of the assembly."); - public static readonly GUIContent defineConstraints = EditorGUIUtility.TrTextContent("Define Constraints", "Specify constraints which determine if the assembly will be compiled or not. The assembly will compile whenever all constraints are met."); - public static readonly GUIContent versionDefines = EditorGUIUtility.TrTextContent("Version Defines", "Specify preprocessor symbols to define based on package, module or Unity versions."); - public static readonly GUIContent resource = EditorGUIUtility.TrTextContent("If resource", "Select 'Unity' or the package or module that you want to set a define for."); - public static readonly GUIContent version = EditorGUIUtility.TrTextContent("version is", "Specify the semantic version of your chosen module, package or Unity Version. You must use mathematical interval notation."); - public static readonly GUIContent define = EditorGUIUtility.TrTextContent("set define", "Specify the name you want this define to have. This define is only set if the expression's condition is satisfied."); - public static readonly GUIContent expressionOutcome = EditorGUIUtility.TrTextContent("Version expression outcome", "Shows the mathematical equation applied to the version number used determine if the symbol should be defined."); - public static readonly GUIContent references = EditorGUIUtility.TrTextContent("Assembly Definition References", "The list of assembly files that this assembly definition should reference."); - public static readonly GUIContent precompiledReferences = EditorGUIUtility.TrTextContent("Assembly References", "The list of Precompiled assemblies that this assembly definition should reference."); - public static readonly GUIContent generalOptions = EditorGUIUtility.TrTextContent("General Options"); - public static readonly GUIContent overrideReferences = EditorGUIUtility.TrTextContent("Override References", "When enabled, you can select which specific precompiled assemblies to refer to via a drop-down list that appears. When not enabled, this assembly definition refers to all auto-referenced precompiled assemblies."); - public static readonly GUIContent autoReferenced = EditorGUIUtility.TrTextContent("Auto Referenced", "When enabled, this assembly definition is automatically referenced in predefined assemblies."); - public static readonly GUIContent useGUIDs = EditorGUIUtility.TrTextContent("Use GUIDs", "Use GUIDs instead of assembly names for Assembly Definition References. Allows referenced assemblies to be renamed without having to update references."); - public static readonly GUIContent platforms = EditorGUIUtility.TrTextContent("Platforms", "Select which platforms include or exclude in the build that this assembly definition file is for."); - public static readonly GUIContent anyPlatform = EditorGUIUtility.TrTextContent("Any Platform"); - public static readonly GUIContent includePlatforms = EditorGUIUtility.TrTextContent("Include Platforms"); - public static readonly GUIContent excludePlatforms = EditorGUIUtility.TrTextContent("Exclude Platforms"); - public static readonly GUIContent selectAll = EditorGUIUtility.TrTextContent("Select all"); - public static readonly GUIContent deselectAll = EditorGUIUtility.TrTextContent("Deselect all"); - public static readonly GUIContent loadError = EditorGUIUtility.TrTextContent("Load error"); - public static readonly GUIContent noEngineReferences = EditorGUIUtility.TrTextContent("No Engine References", "When enabled, references to UnityEngine/UnityEditor will not be added when compiling this assembly."); + public static readonly GUIContent name = L10n.TextContent("Name", "The assembly name is used to generate a .dll file on you disk.", null, null); + public static readonly GUIContent rootNamespace = L10n.TextContent("Root Namespace", "Specify the root namespace of the assembly.", null, null); + public static readonly GUIContent defineConstraints = L10n.TextContent("Define Constraints", "Specify constraints which determine if the assembly will be compiled or not. The assembly will compile whenever all constraints are met.", null, null); + public static readonly GUIContent versionDefines = L10n.TextContent("Version Defines", "Specify preprocessor symbols to define based on package, module or Unity versions.", null, null); + public static readonly GUIContent resource = L10n.TextContent("If resource", "Select 'Unity' or the package or module that you want to set a define for.", null, null); + public static readonly GUIContent version = L10n.TextContent("version is", "Specify the semantic version of your chosen module, package or Unity Version. You must use mathematical interval notation.", null, null); + public static readonly GUIContent define = L10n.TextContent("set define", "Specify the name you want this define to have. This define is only set if the expression's condition is satisfied.", null, null); + public static readonly GUIContent expressionOutcome = L10n.TextContent("Version expression outcome", "Shows the mathematical equation applied to the version number used determine if the symbol should be defined.", null, null); + public static readonly GUIContent references = L10n.TextContent("Assembly Definition References", "The list of assembly files that this assembly definition should reference.", null, null); + public static readonly GUIContent precompiledReferences = L10n.TextContent("Assembly References", "The list of Precompiled assemblies that this assembly definition should reference.", null, null); + public static readonly GUIContent generalOptions = L10n.TextContent("General Options", null, null, null); + public static readonly GUIContent overrideReferences = L10n.TextContent("Override References", "When enabled, you can select which specific precompiled assemblies to refer to via a drop-down list that appears. When not enabled, this assembly definition refers to all auto-referenced precompiled assemblies.", null, null); + public static readonly GUIContent autoReferenced = L10n.TextContent("Auto Referenced", "When enabled, this assembly definition is automatically referenced in predefined assemblies.", null, null); + public static readonly GUIContent useGUIDs = L10n.TextContent("Use GUIDs", "Use GUIDs instead of assembly names for Assembly Definition References. Allows referenced assemblies to be renamed without having to update references.", null, null); + public static readonly GUIContent platforms = L10n.TextContent("Platforms", "Select which platforms include or exclude in the build that this assembly definition file is for.", null, null); + public static readonly GUIContent anyPlatform = L10n.TextContent("Any Platform", null, null, null); + public static readonly GUIContent includePlatforms = L10n.TextContent("Include Platforms", null, null, null); + public static readonly GUIContent excludePlatforms = L10n.TextContent("Exclude Platforms", null, null, null); + public static readonly GUIContent selectAll = L10n.TextContent("Select all", null, null, null); + public static readonly GUIContent deselectAll = L10n.TextContent("Deselect all", null, null, null); + public static readonly GUIContent loadError = L10n.TextContent("Load error", null, null, null); + public static readonly GUIContent noEngineReferences = L10n.TextContent("No Engine References", "When enabled, references to UnityEngine/UnityEditor will not be added when compiling this assembly.", null, null); // This is used to make everything in reorderable list elements centered vertically. public const int kCenterHeightOffset = 1; @@ -708,11 +708,11 @@ private void DrawPrecompiledReferenceListElement(Rect rect, int index, bool isac if (m_PrecompileReferenceListEntry.Count == 1) { - label = EditorGUIUtility.TrTempContent("No possible references"); + label = L10n.TempContent("No possible references", null); } else { - label = EditorGUIUtility.TrTempContent("None"); + label = L10n.TempContent("None", null); } } else diff --git a/Editor/Mono/Inspector/AssemblyDefinitionReferenceImporterInspector.cs b/Editor/Mono/Inspector/AssemblyDefinitionReferenceImporterInspector.cs index bc2d7f7b93..547739f6bc 100644 --- a/Editor/Mono/Inspector/AssemblyDefinitionReferenceImporterInspector.cs +++ b/Editor/Mono/Inspector/AssemblyDefinitionReferenceImporterInspector.cs @@ -18,9 +18,9 @@ internal class AssemblyDefinitionReferenceImporterInspector : AssetImporterEdito { internal class Styles { - public static readonly GUIContent assemblyDefinition = EditorGUIUtility.TrTextContent("Assembly Definition"); - public static readonly GUIContent loadError = EditorGUIUtility.TrTextContent("Load error"); - public static readonly GUIContent useGUID = EditorGUIUtility.TrTextContent("Use GUID", "Use the Assembly Definition asset GUID instead of name for referencing. Allows the referenced assembly to be renamed without having to update references."); + public static readonly GUIContent assemblyDefinition = L10n.TextContent("Assembly Definition", null, null, null); + public static readonly GUIContent loadError = L10n.TextContent("Load error", null, null, null); + public static readonly GUIContent useGUID = L10n.TextContent("Use GUID", "Use the Assembly Definition asset GUID instead of name for referencing. Allows the referenced assembly to be renamed without having to update references.", null, null); } GUIStyle m_TextStyle; diff --git a/Editor/Mono/Inspector/AssetBundleNameGUI.cs b/Editor/Mono/Inspector/AssetBundleNameGUI.cs index 402062a7e5..05d0f8df46 100644 --- a/Editor/Mono/Inspector/AssetBundleNameGUI.cs +++ b/Editor/Mono/Inspector/AssetBundleNameGUI.cs @@ -16,7 +16,7 @@ namespace UnityEditor { internal class AssetBundleNameGUI { - static private readonly GUIContent kAssetBundleName = EditorGUIUtility.TrTextContent("AssetBundle"); + static private readonly GUIContent kAssetBundleName = L10n.TextContent("AssetBundle", null, null, null); static private readonly int kAssetBundleNameFieldIdHash = "AssetBundleNameFieldHash".GetHashCode(); static private readonly int kAssetBundleVariantFieldIdHash = "AssetBundleVariantFieldHash".GetHashCode(); diff --git a/Editor/Mono/Inspector/AudioChorusFilterEditor.cs b/Editor/Mono/Inspector/AudioChorusFilterEditor.cs index e4275ab436..0c4cced6fa 100644 --- a/Editor/Mono/Inspector/AudioChorusFilterEditor.cs +++ b/Editor/Mono/Inspector/AudioChorusFilterEditor.cs @@ -19,13 +19,13 @@ class AudioChorusFilterEditor : Editor private static class Styles { - public static readonly GUIContent DryMixTooltip = EditorGUIUtility.TrTextContent("Dry Mix", "Volume of original signal to pass to output"); - public static readonly GUIContent WetMix1Tooltip = EditorGUIUtility.TrTextContent("Wet Mix 1", "Volume of 1st chorus tap"); - public static readonly GUIContent WetMix2Tooltip = EditorGUIUtility.TrTextContent("Wet Mix 2", "Volume of 2nd chorus tap"); - public static readonly GUIContent WetMix3Tooltip = EditorGUIUtility.TrTextContent("Wet Mix 3", "Volume of 3rd chorus tap"); - public static readonly GUIContent DelayTooltip = EditorGUIUtility.TrTextContent("Delay", "Chorus delay in ms"); - public static readonly GUIContent RateTooltip = EditorGUIUtility.TrTextContent("Rate", "Chorus modulation rate in hz"); - public static readonly GUIContent DepthTooltip = EditorGUIUtility.TrTextContent("Depth", "Chorus modulation depth"); + public static readonly GUIContent DryMixTooltip = L10n.TextContent("Dry Mix", "Volume of original signal to pass to output", null, null); + public static readonly GUIContent WetMix1Tooltip = L10n.TextContent("Wet Mix 1", "Volume of 1st chorus tap", null, null); + public static readonly GUIContent WetMix2Tooltip = L10n.TextContent("Wet Mix 2", "Volume of 2nd chorus tap", null, null); + public static readonly GUIContent WetMix3Tooltip = L10n.TextContent("Wet Mix 3", "Volume of 3rd chorus tap", null, null); + public static readonly GUIContent DelayTooltip = L10n.TextContent("Delay", "Chorus delay in ms", null, null); + public static readonly GUIContent RateTooltip = L10n.TextContent("Rate", "Chorus modulation rate in hz", null, null); + public static readonly GUIContent DepthTooltip = L10n.TextContent("Depth", "Chorus modulation depth", null, null); } private void OnEnable() diff --git a/Editor/Mono/Inspector/AudioClipInspector.cs b/Editor/Mono/Inspector/AudioClipInspector.cs index a135e53d54..8e3624cbcd 100644 --- a/Editor/Mono/Inspector/AudioClipInspector.cs +++ b/Editor/Mono/Inspector/AudioClipInspector.cs @@ -64,9 +64,9 @@ static void Init() var unityAudioDisabled = AudioSettings.unityAudioDisabled; - s_AutoPlayIcon = EditorGUIUtility.TrIconContent("preAudioAutoPlayOff", unityAudioDisabled ? s_PreviewDisabledMessage : "Turn Auto Play on/off"); - s_PlayIcon = EditorGUIUtility.TrIconContent("PlayButton", unityAudioDisabled ? s_PreviewDisabledMessage : "Play"); - s_LoopIcon = EditorGUIUtility.TrIconContent("preAudioLoopOff", unityAudioDisabled ? s_PreviewDisabledMessage : "Loop on/off"); + s_AutoPlayIcon = L10n.IconContent("preAudioAutoPlayOff", unityAudioDisabled ? s_PreviewDisabledMessage : "Turn Auto Play on/off", null); + s_PlayIcon = L10n.IconContent("PlayButton", unityAudioDisabled ? s_PreviewDisabledMessage : "Play", null); + s_LoopIcon = L10n.IconContent("preAudioLoopOff", unityAudioDisabled ? s_PreviewDisabledMessage : "Loop on/off", null); s_DefaultIcon = EditorGUIUtility.LoadIcon("Profiler.Audio"); } diff --git a/Editor/Mono/Inspector/AudioDistortionFilterInspector.cs b/Editor/Mono/Inspector/AudioDistortionFilterInspector.cs index fd89ef058c..59b2002b4d 100644 --- a/Editor/Mono/Inspector/AudioDistortionFilterInspector.cs +++ b/Editor/Mono/Inspector/AudioDistortionFilterInspector.cs @@ -13,7 +13,7 @@ class AudioDistortionFilterEditor : Editor private static class Styles { - public static readonly GUIContent DistortionLevelTooltip = EditorGUIUtility.TrTextContent("Distortion Level", "Distortion value"); + public static readonly GUIContent DistortionLevelTooltip = L10n.TextContent("Distortion Level", "Distortion value", null, null); } private void OnEnable() diff --git a/Editor/Mono/Inspector/AudioEchoFilterInspector.cs b/Editor/Mono/Inspector/AudioEchoFilterInspector.cs index 322677c294..656409c8e3 100644 --- a/Editor/Mono/Inspector/AudioEchoFilterInspector.cs +++ b/Editor/Mono/Inspector/AudioEchoFilterInspector.cs @@ -16,10 +16,10 @@ class AudioEchoFilterEditor : Editor private static class Styles { - public static readonly GUIContent DelayTooltip = EditorGUIUtility.TrTextContent("Delay", "Echo delay in ms"); - public static readonly GUIContent DecayRatioTooltip = EditorGUIUtility.TrTextContent("Decay Ratio", "Echo decay per delay"); - public static readonly GUIContent DryMixTooltip = EditorGUIUtility.TrTextContent("Dry Mix", "Volume of original signal to pass to output"); - public static readonly GUIContent WetMixTooltip = EditorGUIUtility.TrTextContent("Wet Mix", "Volume of echo signal to pass to output"); + public static readonly GUIContent DelayTooltip = L10n.TextContent("Delay", "Echo delay in ms", null, null); + public static readonly GUIContent DecayRatioTooltip = L10n.TextContent("Decay Ratio", "Echo decay per delay", null, null); + public static readonly GUIContent DryMixTooltip = L10n.TextContent("Dry Mix", "Volume of original signal to pass to output", null, null); + public static readonly GUIContent WetMixTooltip = L10n.TextContent("Wet Mix", "Volume of echo signal to pass to output", null, null); } private void OnEnable() diff --git a/Editor/Mono/Inspector/AudioHighPassFilterInspector.cs b/Editor/Mono/Inspector/AudioHighPassFilterInspector.cs index 2a53641f95..c495f1b0e0 100644 --- a/Editor/Mono/Inspector/AudioHighPassFilterInspector.cs +++ b/Editor/Mono/Inspector/AudioHighPassFilterInspector.cs @@ -15,8 +15,8 @@ class AudioHighPassFilterEditor : Editor private static class Styles { - public static readonly GUIContent HighpassResonanceQTooltip = EditorGUIUtility.TrTextContent("Highpass Resonance Q", "Determines how much the filter's self-resonance is dampened"); - public static readonly GUIContent CutoffFrequencyTooltip = EditorGUIUtility.TrTextContent("Cutoff Frequency", "Highpass cutoff frequency in Hz"); + public static readonly GUIContent HighpassResonanceQTooltip = L10n.TextContent("Highpass Resonance Q", "Determines how much the filter's self-resonance is dampened", null, null); + public static readonly GUIContent CutoffFrequencyTooltip = L10n.TextContent("Cutoff Frequency", "Highpass cutoff frequency in Hz", null, null); } void OnEnable() diff --git a/Editor/Mono/Inspector/AudioLowPassFilterInspector.cs b/Editor/Mono/Inspector/AudioLowPassFilterInspector.cs index 0f157e207e..4fda075a8b 100644 --- a/Editor/Mono/Inspector/AudioLowPassFilterInspector.cs +++ b/Editor/Mono/Inspector/AudioLowPassFilterInspector.cs @@ -15,8 +15,8 @@ internal class AudioLowPassFilterInspector : Editor private static class Styles { - public static readonly GUIContent LowpassResonanceQTooltip = EditorGUIUtility.TrTextContent("Lowpass Resonance Q", "Determines how much the filter's self-resonance is dampened"); - public static readonly GUIContent LowpassLevelCustomCurveTooltip = EditorGUIUtility.TrTextContent("Cutoff Frequency", "Lowpass cutoff frequency in Hz"); + public static readonly GUIContent LowpassResonanceQTooltip = L10n.TextContent("Lowpass Resonance Q", "Determines how much the filter's self-resonance is dampened", null, null); + public static readonly GUIContent LowpassLevelCustomCurveTooltip = L10n.TextContent("Cutoff Frequency", "Lowpass cutoff frequency in Hz", null, null); } void OnEnable() diff --git a/Editor/Mono/Inspector/AudioManagerInspector.cs b/Editor/Mono/Inspector/AudioManagerInspector.cs index c25a9bf28f..51156f343c 100644 --- a/Editor/Mono/Inspector/AudioManagerInspector.cs +++ b/Editor/Mono/Inspector/AudioManagerInspector.cs @@ -16,30 +16,30 @@ internal class AudioManagerInspector : ProjectSettingsBaseEditor { private class Styles { - public static readonly GUIContent Volume = EditorGUIUtility.TrTextContent("Global Volume", "Initial volume multiplier (AudioListener.volume)"); - public static readonly GUIContent RolloffScale = EditorGUIUtility.TrTextContent("Volume Rolloff Scale", "Global volume rolloff multiplier (applies only to logarithmic volume curves)."); - public static readonly GUIContent DopplerFactor = EditorGUIUtility.TrTextContent("Doppler Factor", "Global Doppler speed multiplier for sounds in motion."); - public static readonly GUIContent DefaultSpeakerMode = EditorGUIUtility.TrTextContent("Default Speaker Mode", "Speaker mode at start of the game. This may be changed at runtime using the AudioSettings.Reset function."); - public static readonly GUIContent SampleRate = EditorGUIUtility.TrTextContent("System Sample Rate", "Sample rate at which the output device of the audio system runs. Individual sounds may run at different sample rates and will be slowed down/sped up accordingly to match the output rate."); - public static readonly GUIContent DSPBufferSize = EditorGUIUtility.TrTextContent("DSP Buffer Size", "Length of mixing buffer. This determines the output latency of the game."); - public static readonly GUIContent AudioFoundation = EditorGUIUtility.TrTextContent("Audio Foundation", "Low-level, platform audio layer. Classic is the same, mature platform layer from previous versions of Unity. Enhanced is the new platform audio layer and is supported on Windows, macOS, Linux, iOS, Android (8.1 and later), XBOX Series X|S, XBOX One, PlayStation®5, Nintendo Switch™, and Nintendo Switch™ 2. The benefits include asynchronous starting and stopping of devices and greater control over audio engine behavior. On platforms that don't have enhanced mode yet, the engine will fall back to using classic mode."); - public static readonly GUIContent OutputChannelLayout = EditorGUIUtility.TrTextContent("Output Channel Layout", "The audio engine will always run at the selected channel layout and up-mixing or down-mixing will occur to match the device's native channel layout. Alternatively, if DeviceNative is selected, the engine will always run at the device's native channel count, and will be reset if that native channel count changes (i.e. when the default device changes)."); - public static readonly GUIContent OutputSamplingRate = EditorGUIUtility.TrTextContent("Output Sampling Rate", "The audio engine will always run at the selected sampling rate and sample-rate conversion will occur to match the device's native sampling rate. Alternatively, if DeviceNative is selected, the engine will always run at the device's native sampling rate, and will be reset if that native sampling rate changes (i.e. when the default device changes)."); - public static readonly GUIContent VirtualVoiceCount = EditorGUIUtility.TrTextContent("Max Virtual Voices", "Maximum number of sounds managed by the system. Even though at most RealVoiceCount of the loudest sounds will be physically playing, the remaining sounds will still be updating their play position."); - public static readonly GUIContent RealVoiceCount = EditorGUIUtility.TrTextContent("Max Real Voices", "Maximum number of actual simultaneously playing sounds."); - public static readonly GUIContent SpatializerPlugin = EditorGUIUtility.TrTextContent("Spatializer Plugin", "Native audio plugin performing spatialized filtering of 3D sources."); - public static readonly GUIContent AmbisonicDecoderPlugin = EditorGUIUtility.TrTextContent("Ambisonic Decoder Plugin", "Native audio plugin performing ambisonic-to-binaural filtering of sources."); - public static readonly GUIContent DisableAudio = EditorGUIUtility.TrTextContent("Disable Unity Audio", "Prevent allocating the output device in the runtime. Use this if you want to use other sound systems than the built-in one."); - public static readonly GUIContent VirtualizeEffects = EditorGUIUtility.TrTextContent("Virtualize Effects", "When enabled, dynamically turn off effects and spatializers on AudioSources that are culled in order to save CPU."); - public static readonly GUIContent EnableOutputSuspension = EditorGUIUtility.TrTextContent("Enable Output Suspension (editor only)", "When enabled automatically suspends audio output after detecting that the output has been silent for a long duration (editor only). Suspending the audio system disables a mechanism in the operating system that prevents the computer from going into sleep mode."); + public static readonly GUIContent Volume = L10n.TextContent("Global Volume", "Initial volume multiplier (AudioListener.volume)", null, null); + public static readonly GUIContent RolloffScale = L10n.TextContent("Volume Rolloff Scale", "Global volume rolloff multiplier (applies only to logarithmic volume curves).", null, null); + public static readonly GUIContent DopplerFactor = L10n.TextContent("Doppler Factor", "Global Doppler speed multiplier for sounds in motion.", null, null); + public static readonly GUIContent DefaultSpeakerMode = L10n.TextContent("Default Speaker Mode", "Speaker mode at start of the game. This may be changed at runtime using the AudioSettings.Reset function.", null, null); + public static readonly GUIContent SampleRate = L10n.TextContent("System Sample Rate", "Sample rate at which the output device of the audio system runs. Individual sounds may run at different sample rates and will be slowed down/sped up accordingly to match the output rate.", null, null); + public static readonly GUIContent DSPBufferSize = L10n.TextContent("DSP Buffer Size", "Length of mixing buffer. This determines the output latency of the game.", null, null); + public static readonly GUIContent AudioFoundation = L10n.TextContent("Audio Foundation", "Low-level, platform audio layer. Classic is the same, mature platform layer from previous versions of Unity. Enhanced is the new platform audio layer and is supported on Windows, macOS, Linux, iOS, Android (8.1 and later), XBOX Series X|S, XBOX One, PlayStation®5, Nintendo Switch™, and Nintendo Switch™ 2. The benefits include asynchronous starting and stopping of devices and greater control over audio engine behavior. On platforms that don't have enhanced mode yet, the engine will fall back to using classic mode.", null, null); + public static readonly GUIContent OutputChannelLayout = L10n.TextContent("Output Channel Layout", "The audio engine will always run at the selected channel layout and up-mixing or down-mixing will occur to match the device's native channel layout. Alternatively, if DeviceNative is selected, the engine will always run at the device's native channel count, and will be reset if that native channel count changes (i.e. when the default device changes).", null, null); + public static readonly GUIContent OutputSamplingRate = L10n.TextContent("Output Sampling Rate", "The audio engine will always run at the selected sampling rate and sample-rate conversion will occur to match the device's native sampling rate. Alternatively, if DeviceNative is selected, the engine will always run at the device's native sampling rate, and will be reset if that native sampling rate changes (i.e. when the default device changes).", null, null); + public static readonly GUIContent VirtualVoiceCount = L10n.TextContent("Max Virtual Voices", "Maximum number of sounds managed by the system. Even though at most RealVoiceCount of the loudest sounds will be physically playing, the remaining sounds will still be updating their play position.", null, null); + public static readonly GUIContent RealVoiceCount = L10n.TextContent("Max Real Voices", "Maximum number of actual simultaneously playing sounds.", null, null); + public static readonly GUIContent SpatializerPlugin = L10n.TextContent("Spatializer Plugin", "Native audio plugin performing spatialized filtering of 3D sources.", null, null); + public static readonly GUIContent AmbisonicDecoderPlugin = L10n.TextContent("Ambisonic Decoder Plugin", "Native audio plugin performing ambisonic-to-binaural filtering of sources.", null, null); + public static readonly GUIContent DisableAudio = L10n.TextContent("Disable Unity Audio", "Prevent allocating the output device in the runtime. Use this if you want to use other sound systems than the built-in one.", null, null); + public static readonly GUIContent VirtualizeEffects = L10n.TextContent("Virtualize Effects", "When enabled, dynamically turn off effects and spatializers on AudioSources that are culled in order to save CPU.", null, null); + public static readonly GUIContent EnableOutputSuspension = L10n.TextContent("Enable Output Suspension (editor only)", "When enabled automatically suspends audio output after detecting that the output has been silent for a long duration (editor only). Suspending the audio system disables a mechanism in the operating system that prevents the computer from going into sleep mode.", null, null); } private class StylesNonSearchable { - public static readonly GUIContent DSPBufferSizeInfo = EditorGUIUtility.TrTextContent("The requested buffer size ({0}) has been overridden to {1} by the operating system"); - public static readonly GUIContent EnhancedAudioFoundationInfo = EditorGUIUtility.TrTextContent("Enhanced will be used on Windows, macOS, Linux, iOS, Android (8.1 and later), XBOX Series X|S, XBOX One, PlayStation®5, Nintendo Switch™, and Nintendo Switch™ 2. Other platforms will use Classic."); - public static readonly GUIContent PassthroughChannelLayoutInfo = EditorGUIUtility.TrTextContent("On Android devices that support spatial audio, on Windows, XBOX Series X|S, XBOX One devices and on Meta Quest devices, this layout is sent directly to the OS spatializer instead of being down-mixed."); + public static readonly GUIContent DSPBufferSizeInfo = L10n.TextContent("The requested buffer size ({0}) has been overridden to {1} by the operating system", null, null, null); + public static readonly GUIContent EnhancedAudioFoundationInfo = L10n.TextContent("Enhanced will be used on Windows, macOS, Linux, iOS, Android (8.1 and later), XBOX Series X|S, XBOX One, PlayStation®5, Nintendo Switch™, and Nintendo Switch™ 2. Other platforms will use Classic.", null, null, null); + public static readonly GUIContent PassthroughChannelLayoutInfo = L10n.TextContent("This layout is sent directly to the OS spatializer instead of being down-mixed on Windows, XBOX Series X|S, XBOX One devices, on Meta Quest devices and on Android devices that support spatial audio.", null, null, null); } static readonly string[] k_AdditionalSearchKeywords = @@ -50,9 +50,6 @@ private class StylesNonSearchable [NoAutoStaticsCleanup] // lazy one-time cache of static GUIContent search keyword strings, no user-code refs; safe to persist static List s_SearchKeywords; - [NoAutoStaticsCleanup] // session-wide flag derived from fixed command-line args; recomputed in OnEnable, safe to persist - private static bool m_ShowAudioFoundationUI = Array.Exists(Environment.GetCommandLineArgs(), arg => arg == "-showAudioFoundationUI" || arg == "-enhancedAudioFoundation"); - private SerializedProperty m_Volume; private SerializedProperty m_RolloffScale; private SerializedProperty m_DopplerFactor; @@ -90,11 +87,6 @@ private void OnEnable() m_DisableAudio = serializedObject.FindProperty("m_DisableAudio"); m_VirtualizeEffects = serializedObject.FindProperty("m_VirtualizeEffects"); m_EnableOutputSuspension = serializedObject.FindProperty("m_EnableOutputSuspension"); - - // If the audio foundation UI feature flag is set or this project's audio foundation is set to enhanced when we first start up, - // then we show the enhanced audio foundation UI for this entire Editor session. - if (m_AudioFoundation.intValue.Equals(1)) - m_ShowAudioFoundationUI = true; } //This function assumes that index 0 is None... @@ -127,19 +119,16 @@ public override void OnInspectorGUI() m_ActualDSPBufferSize.intValue), MessageType.Info); - if (m_ShowAudioFoundationUI) + EditorGUILayout.PropertyField(m_AudioFoundation, Styles.AudioFoundation); + if (m_AudioFoundation.intValue.Equals(1)) { - EditorGUILayout.PropertyField(m_AudioFoundation, Styles.AudioFoundation); - if (m_AudioFoundation.intValue.Equals(1)) - { - EditorGUILayout.HelpBox(StylesNonSearchable.EnhancedAudioFoundationInfo.text, MessageType.Info); - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(m_OutputChannelLayout, Styles.OutputChannelLayout); - if (m_OutputChannelLayout.intValue == (int)ChannelLayoutBehavior.Surround_7_1_4) - EditorGUILayout.HelpBox(StylesNonSearchable.PassthroughChannelLayoutInfo.text, MessageType.Info); - EditorGUILayout.PropertyField(m_OutputSamplingRate, Styles.OutputSamplingRate); - EditorGUI.indentLevel--; - } + EditorGUILayout.HelpBox(StylesNonSearchable.EnhancedAudioFoundationInfo.text, MessageType.Info); + EditorGUI.indentLevel++; + EditorGUILayout.PropertyField(m_OutputChannelLayout, Styles.OutputChannelLayout); + if (m_OutputChannelLayout.intValue == (int)ChannelLayoutBehavior.Surround_7_1_4) + EditorGUILayout.HelpBox(StylesNonSearchable.PassthroughChannelLayoutInfo.text, MessageType.Info); + EditorGUILayout.PropertyField(m_OutputSamplingRate, Styles.OutputSamplingRate); + EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(m_VirtualVoiceCount, Styles.VirtualVoiceCount); diff --git a/Editor/Mono/Inspector/AudioMixerControllerInspector.cs b/Editor/Mono/Inspector/AudioMixerControllerInspector.cs index a13d6a0bb3..58fc33386e 100644 --- a/Editor/Mono/Inspector/AudioMixerControllerInspector.cs +++ b/Editor/Mono/Inspector/AudioMixerControllerInspector.cs @@ -14,9 +14,9 @@ internal class AudioMixerControllerInspector : Editor { static class Texts { - public static readonly GUIContent m_EnableSuspendLabel = EditorGUIUtility.TrTextContent("Auto Mixer Suspend", "Enables/disables suspending of processing in order to save CPU when the RMS signal level falls under the defined threshold (in dB). Mixers resume processing when an AudioSource referencing them starts playing again."); - public static readonly GUIContent m_SuspendThresholdLabel = EditorGUIUtility.TrTextContent(" Threshold Volume", "The level of the Master Group at which the mixer suspends processing in order to save CPU. Mixers resume processing when an AudioSource referencing them starts playing again."); - public static readonly GUIContent m_UpdateModeLabel = EditorGUIUtility.TrTextContent("Update Mode", "Update AudioMixer transitions with game time or unscaled realtime."); + public static readonly GUIContent m_EnableSuspendLabel = L10n.TextContent("Auto Mixer Suspend", "Enables/disables suspending of processing in order to save CPU when the RMS signal level falls under the defined threshold (in dB). Mixers resume processing when an AudioSource referencing them starts playing again.", null, null); + public static readonly GUIContent m_SuspendThresholdLabel = L10n.TextContent(" Threshold Volume", "The level of the Master Group at which the mixer suspends processing in order to save CPU. Mixers resume processing when an AudioSource referencing them starts playing again.", null, null); + public static readonly GUIContent m_UpdateModeLabel = L10n.TextContent("Update Mode", "Update AudioMixer transitions with game time or unscaled realtime.", null, null); public const string dB = "dB"; } diff --git a/Editor/Mono/Inspector/AudioReverbZoneEditor.cs b/Editor/Mono/Inspector/AudioReverbZoneEditor.cs index 0ca851d7f4..d74236b8fc 100644 --- a/Editor/Mono/Inspector/AudioReverbZoneEditor.cs +++ b/Editor/Mono/Inspector/AudioReverbZoneEditor.cs @@ -31,22 +31,22 @@ class AudioReverbZoneEditor : Editor private static class Styles { - public static readonly GUIContent MinDistanceTooltip = EditorGUIUtility.TrTextContent("MinDistance", "The distance from the centerpoint that the reverb will have full effect at"); - public static readonly GUIContent MaxDistanceTooltip = EditorGUIUtility.TrTextContent("MaxDistance", "The distance from the centerpoint that the reverb will not have any effect"); - public static readonly GUIContent ReverbPresetTooltip = EditorGUIUtility.TrTextContent("ReverbPreset", "The reverb preset"); - public static readonly GUIContent RoomTooltip = EditorGUIUtility.TrTextContent("Room", "Room effect level (at mid frequencies)"); - public static readonly GUIContent RoomHFTooltip = EditorGUIUtility.TrTextContent("Room HF", "Relative room effect level at high frequencies"); - public static readonly GUIContent RoomLFTooltip = EditorGUIUtility.TrTextContent("Room LF", "Relative room effect level at low frequencies"); - public static readonly GUIContent DecayTimeTooltip = EditorGUIUtility.TrTextContent("Decay Time", "Reverberation decay time at mid frequencies"); - public static readonly GUIContent DecayHFRatioTooltip = EditorGUIUtility.TrTextContent("Decay HF Ratio", "High-frequency to mid-frequency decay time ratio"); - public static readonly GUIContent ReflectionsTooltip = EditorGUIUtility.TrTextContent("Reflections", "Early reflections level relative to room effect"); - public static readonly GUIContent ReflectionsDelayTooltip = EditorGUIUtility.TrTextContent("Reflections Delay", "Initial reflection delay time"); - public static readonly GUIContent ReverbTooltip = EditorGUIUtility.TrTextContent("Reverb", "Late reverberation level relative to room effect"); - public static readonly GUIContent ReverbDelayTooltip = EditorGUIUtility.TrTextContent("Reverb Delay", "Late reverberation delay time relative to initial reflection"); - public static readonly GUIContent HFReferenceTooltip = EditorGUIUtility.TrTextContent("HF Reference", "Reference high frequency (Hz)"); - public static readonly GUIContent LFReferenceTooltip = EditorGUIUtility.TrTextContent("LF Reference", "Reference low frequency (Hz)"); - public static readonly GUIContent DiffusionTooltip = EditorGUIUtility.TrTextContent("Diffusion", "Value that controls the echo density in the late reverberation decay"); - public static readonly GUIContent DensityTooltip = EditorGUIUtility.TrTextContent("Density", "Value that controls the modal density in the late reverberation decay"); + public static readonly GUIContent MinDistanceTooltip = L10n.TextContent("MinDistance", "The distance from the centerpoint that the reverb will have full effect at", null, null); + public static readonly GUIContent MaxDistanceTooltip = L10n.TextContent("MaxDistance", "The distance from the centerpoint that the reverb will not have any effect", null, null); + public static readonly GUIContent ReverbPresetTooltip = L10n.TextContent("ReverbPreset", "The reverb preset", null, null); + public static readonly GUIContent RoomTooltip = L10n.TextContent("Room", "Room effect level (at mid frequencies)", null, null); + public static readonly GUIContent RoomHFTooltip = L10n.TextContent("Room HF", "Relative room effect level at high frequencies", null, null); + public static readonly GUIContent RoomLFTooltip = L10n.TextContent("Room LF", "Relative room effect level at low frequencies", null, null); + public static readonly GUIContent DecayTimeTooltip = L10n.TextContent("Decay Time", "Reverberation decay time at mid frequencies", null, null); + public static readonly GUIContent DecayHFRatioTooltip = L10n.TextContent("Decay HF Ratio", "High-frequency to mid-frequency decay time ratio", null, null); + public static readonly GUIContent ReflectionsTooltip = L10n.TextContent("Reflections", "Early reflections level relative to room effect", null, null); + public static readonly GUIContent ReflectionsDelayTooltip = L10n.TextContent("Reflections Delay", "Initial reflection delay time", null, null); + public static readonly GUIContent ReverbTooltip = L10n.TextContent("Reverb", "Late reverberation level relative to room effect", null, null); + public static readonly GUIContent ReverbDelayTooltip = L10n.TextContent("Reverb Delay", "Late reverberation delay time relative to initial reflection", null, null); + public static readonly GUIContent HFReferenceTooltip = L10n.TextContent("HF Reference", "Reference high frequency (Hz)", null, null); + public static readonly GUIContent LFReferenceTooltip = L10n.TextContent("LF Reference", "Reference low frequency (Hz)", null, null); + public static readonly GUIContent DiffusionTooltip = L10n.TextContent("Diffusion", "Value that controls the echo density in the late reverberation decay", null, null); + public static readonly GUIContent DensityTooltip = L10n.TextContent("Density", "Value that controls the modal density in the late reverberation decay", null, null); } diff --git a/Editor/Mono/Inspector/AudioSourceInspector.cs b/Editor/Mono/Inspector/AudioSourceInspector.cs index ac10c5af9e..b8bf6c2caa 100644 --- a/Editor/Mono/Inspector/AudioSourceInspector.cs +++ b/Editor/Mono/Inspector/AudioSourceInspector.cs @@ -86,26 +86,26 @@ private enum AudioCurveType { Volume, SpatialBlend, Lowpass, Spread, ReverbZoneM internal static class Styles { public static readonly GUIStyle labelStyle = "ProfilerBadge"; - public static readonly GUIContent rolloffLabel = EditorGUIUtility.TrTextContent("Volume Rolloff", "Which type of rolloff curve to use"); + public static readonly GUIContent rolloffLabel = L10n.TextContent("Volume Rolloff", "Which type of rolloff curve to use", null, null); public const string controlledByCurveLabel = "Controlled by curve"; - public static readonly GUIContent audioGeneratorLabel = EditorGUIUtility.TrTextContent("Audio Generator", $"The Audio Generator object played by the {nameof(AudioSource)}, which can be assets like {nameof(AudioClip)}, {nameof(AudioRandomContainer)} or scripting {nameof(IAudioGenerator)} assets / components. Can be undefined if the {nameof(AudioSource)} is generating a live stream of audio via OnAudioFilterRead."); - public static readonly GUIContent panStereoLabel = EditorGUIUtility.TrTextContent("Stereo Pan", "Only valid for Mono and Stereo AudioClips. Mono sounds will be panned at constant power left and right. Stereo sounds will have each left/right value faded up and down according to the specified pan value."); - public static readonly GUIContent spatialBlendLabel = EditorGUIUtility.TrTextContent("Spatial Blend", "Sets how much this AudioSource is treated as a 3D source. 3D sources are affected by spatial position and spread. If 3D Pan Level is 0, all spatial attenuation is ignored."); - public static readonly GUIContent reverbZoneMixLabel = EditorGUIUtility.TrTextContent("Reverb Zone Mix", "Sets how much of the signal this AudioSource is mixing into the global reverb associated with the zones. [0, 1] is a linear range (like volume) while [1, 1.1] lets you boost the reverb mix by 10 dB."); - public static readonly GUIContent dopplerLevelLabel = EditorGUIUtility.TrTextContent("Doppler Level", "Specifies how much the pitch is changed based on the relative velocity between AudioListener and AudioSource."); - public static readonly GUIContent spreadLabel = EditorGUIUtility.TrTextContent("Spread", "Sets the spread of a 3d sound in speaker space"); - public static readonly GUIContent outputMixerGroupLabel = EditorGUIUtility.TrTextContent("Output", "Set whether the sound should play through an Audio Mixer first or directly to the Audio Listener"); - public static readonly GUIContent volumeLabel = EditorGUIUtility.TrTextContent("Volume", "Sets the overall volume of the sound."); - public static readonly GUIContent pitchLabel = EditorGUIUtility.TrTextContent("Pitch", "Sets the frequency of the sound. Use this to slow down or speed up the sound."); - public static readonly GUIContent priorityLabel = EditorGUIUtility.TrTextContent("Priority", "Sets the priority of the source. Note that a sound with a larger priority value will more likely be stolen by sounds with smaller priority values."); - public static readonly GUIContent spatializeLabel = EditorGUIUtility.TrTextContent("Spatialize", "Enables or disables custom spatialization for the AudioSource."); - public static readonly GUIContent spatializePostEffectsLabel = EditorGUIUtility.TrTextContent("Spatialize Post Effects", "Determines if the custom spatializer is applied before or after the effect filters attached to the AudioSource. This flag only has an effect if the spatialize flag is enabled on the AudioSource."); - public static readonly GUIContent priorityLeftLabel = EditorGUIUtility.TrTextContent("High"); - public static readonly GUIContent priorityRightLabel = EditorGUIUtility.TrTextContent("Low"); - public static readonly GUIContent spatialLeftLabel = EditorGUIUtility.TrTextContent("2D"); - public static readonly GUIContent spatialRightLabel = EditorGUIUtility.TrTextContent("3D"); - public static readonly GUIContent panLeftLabel = EditorGUIUtility.TrTextContent("Left"); - public static readonly GUIContent panRightLabel = EditorGUIUtility.TrTextContent("Right"); + public static readonly GUIContent audioGeneratorLabel = L10n.TextContent("Audio Generator", $"The Audio Generator object played by the {nameof(AudioSource)}, which can be assets like {nameof(AudioClip)}, {nameof(AudioRandomContainer)} or scripting {nameof(IAudioGenerator)} assets / components. Can be undefined if the {nameof(AudioSource)} is generating a live stream of audio via OnAudioFilterRead.", null, null); + public static readonly GUIContent panStereoLabel = L10n.TextContent("Stereo Pan", "Only valid for Mono and Stereo AudioClips. Mono sounds will be panned at constant power left and right. Stereo sounds will have each left/right value faded up and down according to the specified pan value.", null, null); + public static readonly GUIContent spatialBlendLabel = L10n.TextContent("Spatial Blend", "Sets how much this AudioSource is treated as a 3D source. 3D sources are affected by spatial position and spread. If 3D Pan Level is 0, all spatial attenuation is ignored.", null, null); + public static readonly GUIContent reverbZoneMixLabel = L10n.TextContent("Reverb Zone Mix", "Sets how much of the signal this AudioSource is mixing into the global reverb associated with the zones. [0, 1] is a linear range (like volume) while [1, 1.1] lets you boost the reverb mix by 10 dB.", null, null); + public static readonly GUIContent dopplerLevelLabel = L10n.TextContent("Doppler Level", "Specifies how much the pitch is changed based on the relative velocity between AudioListener and AudioSource.", null, null); + public static readonly GUIContent spreadLabel = L10n.TextContent("Spread", "Sets the spread of a 3d sound in speaker space", null, null); + public static readonly GUIContent outputMixerGroupLabel = L10n.TextContent("Output", "Set whether the sound should play through an Audio Mixer first or directly to the Audio Listener", null, null); + public static readonly GUIContent volumeLabel = L10n.TextContent("Volume", "Sets the overall volume of the sound.", null, null); + public static readonly GUIContent pitchLabel = L10n.TextContent("Pitch", "Sets the frequency of the sound. Use this to slow down or speed up the sound.", null, null); + public static readonly GUIContent priorityLabel = L10n.TextContent("Priority", "Sets the priority of the source. Note that a sound with a larger priority value will more likely be stolen by sounds with smaller priority values.", null, null); + public static readonly GUIContent spatializeLabel = L10n.TextContent("Spatialize", "Enables or disables custom spatialization for the AudioSource.", null, null); + public static readonly GUIContent spatializePostEffectsLabel = L10n.TextContent("Spatialize Post Effects", "Determines if the custom spatializer is applied before or after the effect filters attached to the AudioSource. This flag only has an effect if the spatialize flag is enabled on the AudioSource.", null, null); + public static readonly GUIContent priorityLeftLabel = L10n.TextContent("High", null, null, null); + public static readonly GUIContent priorityRightLabel = L10n.TextContent("Low", null, null, null); + public static readonly GUIContent spatialLeftLabel = L10n.TextContent("2D", null, null, null); + public static readonly GUIContent spatialRightLabel = L10n.TextContent("3D", null, null, null); + public static readonly GUIContent panLeftLabel = L10n.TextContent("Left", null, null, null); + public static readonly GUIContent panRightLabel = L10n.TextContent("Right", null, null, null); public static readonly string xAxisLabel = L10n.Tr("Distance", null); } diff --git a/Editor/Mono/Inspector/AutodeskInteractiveShaderGUI.cs b/Editor/Mono/Inspector/AutodeskInteractiveShaderGUI.cs index f86728ce7d..3179b3c7d0 100644 --- a/Editor/Mono/Inspector/AutodeskInteractiveShaderGUI.cs +++ b/Editor/Mono/Inspector/AutodeskInteractiveShaderGUI.cs @@ -19,21 +19,21 @@ public enum BlendMode private static class Styles { - public static readonly GUIContent uvSetLabel = EditorGUIUtility.TrTextContent("UV Set"); - - public static readonly GUIContent albedoText = EditorGUIUtility.TrTextContent("Albedo", "Albedo (RGB) and Transparency (A)"); - public static readonly GUIContent alphaCutoffText = EditorGUIUtility.TrTextContent("Alpha Cutoff", "Threshold for alpha cutoff"); - public static readonly GUIContent metallicMapText = EditorGUIUtility.TrTextContent("Metallic", "Metallic (R) and Smoothness (A)"); - public static readonly GUIContent roughnessText = EditorGUIUtility.TrTextContent("Roughness", "Roughness value"); - public static readonly GUIContent highlightsText = EditorGUIUtility.TrTextContent("Specular Highlights", "Specular Highlights"); - public static readonly GUIContent reflectionsText = EditorGUIUtility.TrTextContent("Reflections", "Glossy Reflections"); - public static readonly GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map"); - public static readonly GUIContent heightMapText = EditorGUIUtility.TrTextContent("Height Map", "Height Map (G)"); - public static readonly GUIContent occlusionText = EditorGUIUtility.TrTextContent("Occlusion", "Occlusion (G)"); - public static readonly GUIContent emissionText = EditorGUIUtility.TrTextContent("Color", "Emission (RGB)"); - public static readonly GUIContent detailMaskText = EditorGUIUtility.TrTextContent("Detail Mask", "Mask for Secondary Maps (A)"); - public static readonly GUIContent detailAlbedoText = EditorGUIUtility.TrTextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2"); - public static readonly GUIContent detailNormalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map"); + public static readonly GUIContent uvSetLabel = L10n.TextContent("UV Set", null, null, null); + + public static readonly GUIContent albedoText = L10n.TextContent("Albedo", "Albedo (RGB) and Transparency (A)", null, null); + public static readonly GUIContent alphaCutoffText = L10n.TextContent("Alpha Cutoff", "Threshold for alpha cutoff", null, null); + public static readonly GUIContent metallicMapText = L10n.TextContent("Metallic", "Metallic (R) and Smoothness (A)", null, null); + public static readonly GUIContent roughnessText = L10n.TextContent("Roughness", "Roughness value", null, null); + public static readonly GUIContent highlightsText = L10n.TextContent("Specular Highlights", "Specular Highlights", null, null); + public static readonly GUIContent reflectionsText = L10n.TextContent("Reflections", "Glossy Reflections", null, null); + public static readonly GUIContent normalMapText = L10n.TextContent("Normal Map", "Normal Map", null, null); + public static readonly GUIContent heightMapText = L10n.TextContent("Height Map", "Height Map (G)", null, null); + public static readonly GUIContent occlusionText = L10n.TextContent("Occlusion", "Occlusion (G)", null, null); + public static readonly GUIContent emissionText = L10n.TextContent("Color", "Emission (RGB)", null, null); + public static readonly GUIContent detailMaskText = L10n.TextContent("Detail Mask", "Mask for Secondary Maps (A)", null, null); + public static readonly GUIContent detailAlbedoText = L10n.TextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2", null, null); + public static readonly GUIContent detailNormalMapText = L10n.TextContent("Normal Map", "Normal Map", null, null); public static readonly string primaryMapsText = "Main Maps"; public static readonly string secondaryMapsText = "Secondary Maps"; diff --git a/Editor/Mono/Inspector/Avatar/AvatarControl.cs b/Editor/Mono/Inspector/Avatar/AvatarControl.cs index 466b53d718..934ab1ee8c 100644 --- a/Editor/Mono/Inspector/Avatar/AvatarControl.cs +++ b/Editor/Mono/Inspector/Avatar/AvatarControl.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEngine; using System; using System.Collections.Generic; @@ -285,4 +284,3 @@ static protected void DrawBone(int shownBodyView, int i, Rect rect, AvatarSetupT } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Avatar/AvatarEditor.cs b/Editor/Mono/Inspector/Avatar/AvatarEditor.cs index a4bc99b65d..3f3d96d954 100644 --- a/Editor/Mono/Inspector/Avatar/AvatarEditor.cs +++ b/Editor/Mono/Inspector/Avatar/AvatarEditor.cs @@ -156,15 +156,15 @@ private class Styles { public GUIContent[] tabs = { - EditorGUIUtility.TrTextContent("Mapping"), - EditorGUIUtility.TrTextContent("Muscles & Settings"), + L10n.TextContent("Mapping", null, null, null), + L10n.TextContent("Muscles & Settings", null, null, null), //EditorGUIUtility.TrTextContent ("Handle"), //EditorGUIUtility.TrTextContent ("Collider") }; - public GUIContent editCharacter = EditorGUIUtility.TrTextContent("Configure Avatar"); + public GUIContent editCharacter = L10n.TextContent("Configure Avatar", null, null, null); - public GUIContent reset = EditorGUIUtility.TrTextContent("Reset"); + public GUIContent reset = L10n.TextContent("Reset", null, null, null); } static Styles styles => s_Styles; diff --git a/Editor/Mono/Inspector/Avatar/AvatarMappingEditor.cs b/Editor/Mono/Inspector/Avatar/AvatarMappingEditor.cs index 652fe49dd9..12da18f900 100644 --- a/Editor/Mono/Inspector/Avatar/AvatarMappingEditor.cs +++ b/Editor/Mono/Inspector/Avatar/AvatarMappingEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEngine; using UnityEditor; using System; @@ -33,35 +32,35 @@ internal class Styles { public GUIContent[] BodyPartMapping = { - EditorGUIUtility.TrTextContent("Avatar"), - EditorGUIUtility.TrTextContent("Body"), - EditorGUIUtility.TrTextContent("Head"), - EditorGUIUtility.TrTextContent("Left Arm"), - EditorGUIUtility.TrTextContent("Left Fingers"), - EditorGUIUtility.TrTextContent("Right Arm"), - EditorGUIUtility.TrTextContent("Right Fingers"), - EditorGUIUtility.TrTextContent("Left Leg"), - EditorGUIUtility.TrTextContent("Right Leg") + L10n.TextContent("Avatar", null, null, null), + L10n.TextContent("Body", null, null, null), + L10n.TextContent("Head", null, null, null), + L10n.TextContent("Left Arm", null, null, null), + L10n.TextContent("Left Fingers", null, null, null), + L10n.TextContent("Right Arm", null, null, null), + L10n.TextContent("Right Fingers", null, null, null), + L10n.TextContent("Left Leg", null, null, null), + L10n.TextContent("Right Leg", null, null, null) }; - public GUIContent RequiredBone = EditorGUIUtility.TrTextContent("Optional Bones"); - public GUIContent DoneCharacter = EditorGUIUtility.TrTextContent("Done"); + public GUIContent RequiredBone = L10n.TextContent("Optional Bones", null, null, null); + public GUIContent DoneCharacter = L10n.TextContent("Done", null, null, null); - public GUIContent mapping = EditorGUIUtility.TrTextContent("Mapping"); - public GUIContent clearMapping = EditorGUIUtility.TrTextContent("Clear"); - public GUIContent autoMapping = EditorGUIUtility.TrTextContent("Automap"); - public GUIContent bipedMapping = EditorGUIUtility.TrTextContent("Biped"); - public GUIContent loadMapping = EditorGUIUtility.TrTextContent("Load"); - public GUIContent saveMapping = EditorGUIUtility.TrTextContent("Save"); + public GUIContent mapping = L10n.TextContent("Mapping", null, null, null); + public GUIContent clearMapping = L10n.TextContent("Clear", null, null, null); + public GUIContent autoMapping = L10n.TextContent("Automap", null, null, null); + public GUIContent bipedMapping = L10n.TextContent("Biped", null, null, null); + public GUIContent loadMapping = L10n.TextContent("Load", null, null, null); + public GUIContent saveMapping = L10n.TextContent("Save", null, null, null); - public GUIContent pose = EditorGUIUtility.TrTextContent("Pose"); - public GUIContent resetPose = EditorGUIUtility.TrTextContent("Reset"); - public GUIContent sampleBindPose = EditorGUIUtility.TrTextContent("Sample Bind-Pose"); - public GUIContent enforceTPose = EditorGUIUtility.TrTextContent("Enforce T-Pose"); - public GUIContent bipedPose = EditorGUIUtility.TrTextContent("Biped Pose"); + public GUIContent pose = L10n.TextContent("Pose", null, null, null); + public GUIContent resetPose = L10n.TextContent("Reset", null, null, null); + public GUIContent sampleBindPose = L10n.TextContent("Sample Bind-Pose", null, null, null); + public GUIContent enforceTPose = L10n.TextContent("Enforce T-Pose", null, null, null); + public GUIContent bipedPose = L10n.TextContent("Biped Pose", null, null, null); - public GUIContent ShowError = EditorGUIUtility.TrTextContent("Show Error(s)..."); - public GUIContent CloseError = EditorGUIUtility.TrTextContent("Close Error(s)"); + public GUIContent ShowError = L10n.TextContent("Show Error(s)...", null, null, null); + public GUIContent CloseError = L10n.TextContent("Close Error(s)", null, null, null); public GUIContent dotFill = EditorGUIUtility.IconContent("AvatarInspector/DotFill"); public GUIContent dotFrame = EditorGUIUtility.IconContent("AvatarInspector/DotFrame"); @@ -899,4 +898,3 @@ public override void OnSceneGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Avatar/AvatarMuscleEditor.cs b/Editor/Mono/Inspector/Avatar/AvatarMuscleEditor.cs index b3701c86e4..01f4b75752 100644 --- a/Editor/Mono/Inspector/Avatar/AvatarMuscleEditor.cs +++ b/Editor/Mono/Inspector/Avatar/AvatarMuscleEditor.cs @@ -18,35 +18,35 @@ class Styles { public GUIContent[] muscleBodyGroup = { - EditorGUIUtility.TrTextContent("Body"), - EditorGUIUtility.TrTextContent("Head"), - EditorGUIUtility.TrTextContent("Left Arm"), - EditorGUIUtility.TrTextContent("Left Fingers"), - EditorGUIUtility.TrTextContent("Right Arm"), - EditorGUIUtility.TrTextContent("Right Fingers"), - EditorGUIUtility.TrTextContent("Left Leg"), - EditorGUIUtility.TrTextContent("Right Leg") + L10n.TextContent("Body", null, null, null), + L10n.TextContent("Head", null, null, null), + L10n.TextContent("Left Arm", null, null, null), + L10n.TextContent("Left Fingers", null, null, null), + L10n.TextContent("Right Arm", null, null, null), + L10n.TextContent("Right Fingers", null, null, null), + L10n.TextContent("Left Leg", null, null, null), + L10n.TextContent("Right Leg", null, null, null) }; public GUIContent[] muscleTypeGroup = { - EditorGUIUtility.TrTextContent("Open Close"), - EditorGUIUtility.TrTextContent("Left Right"), - EditorGUIUtility.TrTextContent("Roll Left Right"), - EditorGUIUtility.TrTextContent("In Out"), - EditorGUIUtility.TrTextContent("Roll In Out"), - EditorGUIUtility.TrTextContent("Finger Open Close"), - EditorGUIUtility.TrTextContent("Finger In Out") + L10n.TextContent("Open Close", null, null, null), + L10n.TextContent("Left Right", null, null, null), + L10n.TextContent("Roll Left Right", null, null, null), + L10n.TextContent("In Out", null, null, null), + L10n.TextContent("Roll In Out", null, null, null), + L10n.TextContent("Finger Open Close", null, null, null), + L10n.TextContent("Finger In Out", null, null, null) }; - public GUIContent armTwist = EditorGUIUtility.TrTextContent("Upper Arm Twist"); - public GUIContent foreArmTwist = EditorGUIUtility.TrTextContent("Lower Arm Twist"); - public GUIContent upperLegTwist = EditorGUIUtility.TrTextContent("Upper Leg Twist"); - public GUIContent legTwist = EditorGUIUtility.TrTextContent("Lower Leg Twist"); - public GUIContent armStretch = EditorGUIUtility.TrTextContent("Arm Stretch"); - public GUIContent legStretch = EditorGUIUtility.TrTextContent("Leg Stretch"); - public GUIContent feetSpacing = EditorGUIUtility.TrTextContent("Feet Spacing"); - public GUIContent hasTranslationDoF = EditorGUIUtility.TrTextContent("Translation DoF"); + public GUIContent armTwist = L10n.TextContent("Upper Arm Twist", null, null, null); + public GUIContent foreArmTwist = L10n.TextContent("Lower Arm Twist", null, null, null); + public GUIContent upperLegTwist = L10n.TextContent("Upper Leg Twist", null, null, null); + public GUIContent legTwist = L10n.TextContent("Lower Leg Twist", null, null, null); + public GUIContent armStretch = L10n.TextContent("Arm Stretch", null, null, null); + public GUIContent legStretch = L10n.TextContent("Leg Stretch", null, null, null); + public GUIContent feetSpacing = L10n.TextContent("Feet Spacing", null, null, null); + public GUIContent hasTranslationDoF = L10n.TextContent("Translation DoF", null, null, null); public GUIStyle box = "OL box noexpand"; public GUIStyle title = "OL TITLE"; @@ -54,8 +54,8 @@ class Styles public GUIStyle toolbar = "TE Toolbar"; public GUIStyle toolbarDropDown = "TE ToolbarDropDown"; - public GUIContent muscle = EditorGUIUtility.TrTextContent("Muscles"); - public GUIContent resetMuscle = EditorGUIUtility.TrTextContent("Reset"); + public GUIContent muscle = L10n.TextContent("Muscles", null, null, null); + public GUIContent resetMuscle = L10n.TextContent("Reset", null, null, null); } [AutoStaticsCleanupOnCodeReload] diff --git a/Editor/Mono/Inspector/Avatar/AvatarSkeletonDrawer.cs b/Editor/Mono/Inspector/Avatar/AvatarSkeletonDrawer.cs index 8f4073841e..1007bea407 100644 --- a/Editor/Mono/Inspector/Avatar/AvatarSkeletonDrawer.cs +++ b/Editor/Mono/Inspector/Avatar/AvatarSkeletonDrawer.cs @@ -71,7 +71,7 @@ public static void DrawSkeleton(Transform reference, Dictionary style.alignment = TextAnchor.MiddleLeft; style.fontSize = 20; - GUIContent content = EditorGUIUtility.TrTextContent("Character is not in T pose"); + GUIContent content = L10n.TextContent("Character is not in T pose", null, null, null); Rect rect = GUILayoutUtility.GetRect(content, style); diff --git a/Editor/Mono/Inspector/AvatarMaskInspector.cs b/Editor/Mono/Inspector/AvatarMaskInspector.cs index 09c4e360e6..6a3675d79f 100644 --- a/Editor/Mono/Inspector/AvatarMaskInspector.cs +++ b/Editor/Mono/Inspector/AvatarMaskInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using System; using UnityEngine; using System.Collections.Generic; @@ -165,27 +164,27 @@ internal class AvatarMaskInspector : Editor private static class Styles { // Model Importer related options - public static readonly GUIContent MaskDefinition = EditorGUIUtility.TrTextContent("Definition", "Choose between Create From This Model, Copy From Other Avatar. The first one creates a Mask for this file and the second one uses a Mask from another file to import animation."); + public static readonly GUIContent MaskDefinition = L10n.TextContent("Definition", "Choose between Create From This Model, Copy From Other Avatar. The first one creates a Mask for this file and the second one uses a Mask from another file to import animation.", null, null); public static readonly GUIContent[] MaskDefinitionOpt = { - EditorGUIUtility.TrTextContent("Create From This Model", "Create a Mask based on the model from this file. For Humanoid rig all the human transforms are always imported and converted to muscle curve, thus they cannot be unchecked."), - EditorGUIUtility.TrTextContent("Copy From Other Mask", "Copy a Mask from another file to import animation clip."), - EditorGUIUtility.TrTextContent("None ", " Import Everything") + L10n.TextContent("Create From This Model", "Create a Mask based on the model from this file. For Humanoid rig all the human transforms are always imported and converted to muscle curve, thus they cannot be unchecked.", null, null), + L10n.TextContent("Copy From Other Mask", "Copy a Mask from another file to import animation clip.", null, null), + L10n.TextContent("None ", " Import Everything", null, null) }; - public static readonly GUIContent CopyFromOtherSource = EditorGUIUtility.TrTextContent("Source", "Select from which AvatarMask the animation should take the mask information"); - public static readonly GUIContent CreateMask = EditorGUIUtility.TrTextContent("Create Mask", "Create a new mask from this model avatar."); + public static readonly GUIContent CopyFromOtherSource = L10n.TextContent("Source", "Select from which AvatarMask the animation should take the mask information", null, null); + public static readonly GUIContent CreateMask = L10n.TextContent("Create Mask", "Create a new mask from this model avatar.", null, null); // Avatar mask options - public static readonly GUIContent SelectAvatarReference = EditorGUIUtility.TrTextContent("Use skeleton from", "The selected avatar is never linked here and only used to populate the list of transform."); - public static readonly GUIContent ImportAvatarReference = EditorGUIUtility.TrTextContent("Import skeleton", "Generates new transform data based on the selected avatar skeleton"); + public static readonly GUIContent SelectAvatarReference = L10n.TextContent("Use skeleton from", "The selected avatar is never linked here and only used to populate the list of transform.", null, null); + public static readonly GUIContent ImportAvatarReference = L10n.TextContent("Import skeleton", "Generates new transform data based on the selected avatar skeleton", null, null); // Avatar mask foldouts - public static readonly GUIContent BodyMask = EditorGUIUtility.TrTextContent("Humanoid", "Define which body part are active. Also define which animation curves will be imported for an Animation Clip."); - public static readonly GUIContent TransformMask = EditorGUIUtility.TrTextContent("Transform", "Define which transform are active. Also define which animation curves will be imported for an Animation Clip."); + public static readonly GUIContent BodyMask = L10n.TextContent("Humanoid", "Define which body part are active. Also define which animation curves will be imported for an Animation Clip.", null, null); + public static readonly GUIContent TransformMask = L10n.TextContent("Transform", "Define which transform are active. Also define which animation curves will be imported for an Animation Clip.", null, null); // TreeView columns - public static readonly GUIContent TransformName = EditorGUIUtility.TrTextContent("Node Name"); - public static readonly GUIContent EnableName = EditorGUIUtility.TrTextContent("Use", "Maintain Alt/Option key to enable or disable all children"); + public static readonly GUIContent TransformName = L10n.TextContent("Node Name", null, null, null); + public static readonly GUIContent EnableName = L10n.TextContent("Use", "Maintain Alt/Option key to enable or disable all children", null, null); } //Interpolation strings for foldout settings, both embedded and standalone. @@ -793,4 +792,3 @@ static bool GetFirstActiveValue(SerializedNodeInfo parent, out bool value) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/AvatarPreview.cs b/Editor/Mono/Inspector/AvatarPreview.cs index 3204053949..8b26da88cb 100644 --- a/Editor/Mono/Inspector/AvatarPreview.cs +++ b/Editor/Mono/Inspector/AvatarPreview.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using System.Globalization; using UnityEngine; using UnityEngine.Assertions; @@ -31,7 +30,9 @@ public static void Start(AvatarPreview owner) { var operation = ScriptableObject.CreateInstance(); operation.m_Owner = owner; +#pragma warning disable UAL0018 // m_Selector lives on this ObjectSelectorOperation ScriptableObject, which a code reload recreates along with the picker session it drives; a reload closes the picker, so the operation never outlives the selector it captured operation.m_Selector = ObjectSelector.get; +#pragma warning restore UAL0018 operation.Execute(); } @@ -196,10 +197,10 @@ public Vector3 rootPosition private class Styles { - public GUIContent pivot = EditorGUIUtility.TrIconContent("AvatarPivot", "Displays avatar's pivot and mass center"); - public GUIContent ik = EditorGUIUtility.TrTextContent("IK", "Toggles feet IK preview"); - public GUIContent is2D = EditorGUIUtility.TrIconContent("SceneView2D", "Toggles 2D preview mode"); - public GUIContent avatarIcon = EditorGUIUtility.TrIconContent("AvatarSelector", "Changes the model to use for previewing."); + public GUIContent pivot = L10n.IconContent("AvatarPivot", "Displays avatar's pivot and mass center", null); + public GUIContent ik = L10n.TextContent("IK", "Toggles feet IK preview", null, null); + public GUIContent is2D = L10n.IconContent("SceneView2D", "Toggles 2D preview mode", null); + public GUIContent avatarIcon = L10n.IconContent("AvatarSelector", "Changes the model to use for previewing.", null); public GUIStyle preButton = "toolbarbutton"; public GUIStyle preSlider = "preSlider"; @@ -562,9 +563,9 @@ public void DoPreviewSettings() if (EditorGUILayout.DropdownButton(styles.avatarIcon, FocusType.Passive, EditorStyles.toolbarDropDownRight)) { GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Auto"), false, SetPreviewAvatarOption, PreviewPopupOptions.Auto); - menu.AddItem(EditorGUIUtility.TrTextContent("Unity Model"), false, SetPreviewAvatarOption, PreviewPopupOptions.DefaultModel); - menu.AddItem(EditorGUIUtility.TrTextContent("Other..."), false, SetPreviewAvatarOption, PreviewPopupOptions.Other); + menu.AddItem(L10n.TextContent("Auto", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.Auto); + menu.AddItem(L10n.TextContent("Unity Model", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.DefaultModel); + menu.AddItem(L10n.TextContent("Other...", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.Other); menu.ShowAsContext(); } } @@ -877,7 +878,7 @@ public void AvatarTimeControlGUI(Rect rect) sliderControlRect.xMin = sliderControlRect.xMax - kSliderWidth + kSpacing; timeControl.DoTimeControl(timeControlRect); - Rect labelRect = new Rect(new Vector2(rect.x, rect.y), EditorStyles.toolbarLabel.CalcSize(EditorGUIUtility.TrTempContent("xxxxxx")));; + Rect labelRect = new Rect(new Vector2(rect.x, rect.y), EditorStyles.toolbarLabel.CalcSize(L10n.TempContent("xxxxxx", null)));; labelRect.x = rect.xMax - labelRect.width; labelRect.yMin = rect.yMin; labelRect.yMax = rect.yMax; @@ -1094,9 +1095,9 @@ public void DoAvatarPreview(Rect rect, GUIStyle background) if (EditorGUI.DropdownButton(choserRect, GUIContent.none, FocusType.Passive, GUIStyle.none)) { GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Auto"), false, SetPreviewAvatarOption, PreviewPopupOptions.Auto); - menu.AddItem(EditorGUIUtility.TrTextContent("Unity Model"), false, SetPreviewAvatarOption, PreviewPopupOptions.DefaultModel); - menu.AddItem(EditorGUIUtility.TrTextContent("Other..."), false, SetPreviewAvatarOption, PreviewPopupOptions.Other); + menu.AddItem(L10n.TextContent("Auto", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.Auto); + menu.AddItem(L10n.TextContent("Unity Model", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.DefaultModel); + menu.AddItem(L10n.TextContent("Other...", null, null, null), false, SetPreviewAvatarOption, PreviewPopupOptions.Other); menu.ShowAsContext(); } @@ -1186,4 +1187,3 @@ int Repeat(int t, int length) } } // class AvatarPreview } // namespace UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/BillboardAssetInspector.cs b/Editor/Mono/Inspector/BillboardAssetInspector.cs index b69a94b6c5..d5329af3af 100644 --- a/Editor/Mono/Inspector/BillboardAssetInspector.cs +++ b/Editor/Mono/Inspector/BillboardAssetInspector.cs @@ -37,8 +37,8 @@ internal class BillboardAssetInspector : Editor private class GUIStyles { - public readonly GUIContent m_Shaded = EditorGUIUtility.TrTextContent("Shaded"); - public readonly GUIContent m_Geometry = EditorGUIUtility.TrTextContent("Geometry"); + public readonly GUIContent m_Shaded = L10n.TextContent("Shaded", null, null, null); + public readonly GUIContent m_Geometry = L10n.TextContent("Geometry", null, null, null); public readonly GUIStyle m_DropdownButton = "MiniPopup"; } diff --git a/Editor/Mono/Inspector/BillboardRendererInspector.cs b/Editor/Mono/Inspector/BillboardRendererInspector.cs index f82badd21f..506666dac7 100644 --- a/Editor/Mono/Inspector/BillboardRendererInspector.cs +++ b/Editor/Mono/Inspector/BillboardRendererInspector.cs @@ -13,7 +13,7 @@ internal class BillboardRendererInspector : RendererEditorBase { class Styles { - public static readonly GUIContent billboard = EditorGUIUtility.TrTextContent("Billboard"); + public static readonly GUIContent billboard = L10n.TextContent("Billboard", null, null, null); } private SerializedProperty m_Billboard; diff --git a/Editor/Mono/Inspector/BlendTreeInspector.cs b/Editor/Mono/Inspector/BlendTreeInspector.cs index 7d2d0a276d..97b238a9b0 100644 --- a/Editor/Mono/Inspector/BlendTreeInspector.cs +++ b/Editor/Mono/Inspector/BlendTreeInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEditor.AnimatedValues; using UnityEngine; using UnityEditor; @@ -1332,7 +1331,7 @@ private void DrawHeader(Rect headerRect) public void AddButton(Rect rect, UnityEditorInternal.ReorderableList list) { GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Add Motion Field"), false, AddChildAnimation); + menu.AddItem(L10n.TextContent("Add Motion Field", null, null, null), false, AddChildAnimation); menu.AddItem(EditorGUIUtility.TempContent("New Blend Tree"), false, AddBlendTreeCallback); menu.Popup(rect, 0); } @@ -1581,8 +1580,8 @@ private void AutoCompute() } else { - menu.AddItem(EditorGUIUtility.TrTextContent("Velocity XZ"), false, ComputePositionsFromVelocity); - menu.AddItem(EditorGUIUtility.TrTextContent("Speed And Angular Speed"), false, ComputePositionsFromSpeedAndAngularSpeed); + menu.AddItem(L10n.TextContent("Velocity XZ", null, null, null), false, ComputePositionsFromVelocity); + menu.AddItem(L10n.TextContent("Speed And Angular Speed", null, null, null), false, ComputePositionsFromSpeedAndAngularSpeed); AddComputeMenuItems(menu, "X Position From/", ChildPropertyToCompute.PositionX); AddComputeMenuItems(menu, "Y Position From/", ChildPropertyToCompute.PositionY); } @@ -1599,8 +1598,8 @@ private void AutoCompute() if (EditorGUI.DropdownButton(controlRect, EditorGUIUtility.TempContent("Select"), FocusType.Passive, EditorStyles.popup)) { GenericMenu menu = new GenericMenu(); - menu.AddItem(EditorGUIUtility.TrTextContent("Homogeneous Speed"), false, ComputeTimeScaleFromSpeed); - menu.AddItem(EditorGUIUtility.TrTextContent("Reset Time Scale"), false, ResetTimeScale); + menu.AddItem(L10n.TextContent("Homogeneous Speed", null, null, null), false, ComputeTimeScaleFromSpeed); + menu.AddItem(L10n.TextContent("Reset Time Scale", null, null, null), false, ResetTimeScale); menu.DropDown(controlRect); } } @@ -2271,4 +2270,3 @@ public void OnInteractivePreviewGUI(Rect r, GUIStyle background) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/CameraEditor.cs b/Editor/Mono/Inspector/CameraEditor.cs index 1a67df8cd4..6254dceaea 100644 --- a/Editor/Mono/Inspector/CameraEditor.cs +++ b/Editor/Mono/Inspector/CameraEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Camera not yet converted using System; using System.Collections.Generic; using System.ComponentModel; @@ -28,41 +27,41 @@ public partial class CameraEditor : Editor { internal static class Styles { - public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove command buffer"); - public static readonly GUIContent clearFlags = EditorGUIUtility.TrTextContent("Clear Flags", "What to display in empty areas of this Camera's view.\n\nChoose Skybox to display a skybox in empty areas, defaulting to a background color if no skybox is found.\n\nChoose Solid Color to display a background color in empty areas.\n\nChoose Depth Only to display nothing in empty areas.\n\nChoose Don't Clear to display whatever was displayed in the previous frame in empty areas."); - public static readonly GUIContent background = EditorGUIUtility.TrTextContent("Background", "The Camera clears the screen to this color before rendering."); - public static readonly GUIContent cullingMask = EditorGUIUtility.TrTextContent("Culling Mask"); - public static readonly GUIContent projection = EditorGUIUtility.TrTextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective."); - public static readonly GUIContent size = EditorGUIUtility.TrTextContent("Size", "The vertical size of the camera view."); - public static readonly GUIContent fieldOfView = EditorGUIUtility.TrTextContent("Field of View", "The camera's view angle measured in degrees along the selected axis."); - public static readonly GUIContent viewportRect = EditorGUIUtility.TrTextContent("Viewport Rect", "Four values that indicate where on the screen this camera view will be drawn. Measured in Viewport Coordinates (values 0-1)."); - public static readonly GUIContent sensorSize = EditorGUIUtility.TrTextContent("Sensor Size", "The size of the camera sensor in millimeters."); - public static readonly GUIContent lensShift = EditorGUIUtility.TrTextContent("Lens Shift", "Offset from the camera sensor. Use these properties to simulate a shift lens. Measured as a multiple of the sensor size."); - public static readonly GUIContent iso = EditorGUIUtility.TrTextContent("ISO", "The sensor sensitivity (ISO)."); - public static readonly GUIContent shutterSpeed = EditorGUIUtility.TrTextContent("Shutter Speed", "The exposure time, in second."); - public static readonly GUIContent aperture = EditorGUIUtility.TrTextContent("Aperture", "The aperture number, in f-stop."); - public static readonly GUIContent focusDistance = EditorGUIUtility.TrTextContent("Focus Distance", "The focus distance of the lens. The Depth of Field Volume override uses this value if you set focusDistanceMode to FocusDistanceMode.Camera."); - public static readonly GUIContent bladeCount = EditorGUIUtility.TrTextContent("Blade Count", "The number of diaphragm blades."); - public static readonly GUIContent curvature = EditorGUIUtility.TrTextContent("Curvature", "Maps an aperture range to blade curvature."); - public static readonly GUIContent barrelClipping = EditorGUIUtility.TrTextContent("Barrel Clipping", "The strength of the \"cat eye\" effect on bokeh (optical vignetting)."); - public static readonly GUIContent anamorphism = EditorGUIUtility.TrTextContent("Anamorphism", "Stretches the sensor to simulate an anamorphic look. Positive values distort the Camera vertically, negative will distort the Camera horizontally."); - public static readonly GUIContent physicalCamera = EditorGUIUtility.TrTextContent("Physical Camera", "Enables Physical camera mode. When checked, the field of view is calculated from properties for simulating physical attributes (focal length, sensor size, and lens shift)"); - public static readonly GUIContent cameraType = EditorGUIUtility.TrTextContent("Sensor Type", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings."); - public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Rendering Path", "Choose a rendering method for this camera.\n\nUse Graphics Settings to use the rendering path specified in graphics settings.\n\nUse Forward to render all objects with one pass per light.\n\nUse Deferred to draw all objects once without lighting and then draw the lighting of all objects at the end of the render queue.\n\nUse Legacy Vertex Lit to render all lights in a single pass, calculated at vertices."); - public static readonly GUIContent focalLength = EditorGUIUtility.TrTextContent("Focal Length", "The simulated distance between the lens and the sensor of the physical camera. Larger values give a narrower field of view."); - public static readonly GUIContent allowOcclusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "Occlusion Culling disables rendering of objects when they are not currently seen by the camera because they are obscured (occluded) by other objects."); - public static readonly GUIContent allowHDR = EditorGUIUtility.TrTextContent("HDR", "High Dynamic Range gives you a wider range of light intensities, so your lighting looks more realistic. With it, you can still see details and experience less saturation even with bright light."); - public static readonly GUIContent allowMSAA = EditorGUIUtility.TrTextContent("MSAA", "Use Multi Sample Anti-aliasing to reduce aliasing."); - public static readonly GUIContent gateFit = EditorGUIUtility.TrTextContent("Gate Fit", "Determines how the rendered area (resolution gate) fits into the sensor area (film gate)."); - public static readonly GUIContent allowDynamicResolution = EditorGUIUtility.TrTextContent("Allow Dynamic Resolution", "Scales render textures to support dynamic resolution if the target platform/graphics API supports it."); - public static readonly GUIContent FOVAxisMode = EditorGUIUtility.TrTextContent("FOV Axis", "Field of view axis."); - public static readonly GUIContent targetDisplay = EditorGUIUtility.TrTextContent("Target Display", "Set the target display for this camera."); - public static readonly GUIContent xrTargetEye = EditorGUIUtility.TrTextContent("Target Eye", "Allows XR rendering for target eye. This disables stereo rendering and only works for the selected eye."); - - public static readonly GUIContent orthoDeferredWarning = EditorGUIUtility.TrTextContent("Deferred rendering does not work with Orthographic camera, will use Forward."); + public static readonly GUIContent iconRemove = L10n.IconContent("Toolbar Minus", "Remove command buffer", null); + public static readonly GUIContent clearFlags = L10n.TextContent("Clear Flags", "What to display in empty areas of this Camera's view.\n\nChoose Skybox to display a skybox in empty areas, defaulting to a background color if no skybox is found.\n\nChoose Solid Color to display a background color in empty areas.\n\nChoose Depth Only to display nothing in empty areas.\n\nChoose Don't Clear to display whatever was displayed in the previous frame in empty areas.", null, null); + public static readonly GUIContent background = L10n.TextContent("Background", "The Camera clears the screen to this color before rendering.", null, null); + public static readonly GUIContent cullingMask = L10n.TextContent("Culling Mask", null, null, null); + public static readonly GUIContent projection = L10n.TextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective.", null, null); + public static readonly GUIContent size = L10n.TextContent("Size", "The vertical size of the camera view.", null, null); + public static readonly GUIContent fieldOfView = L10n.TextContent("Field of View", "The camera's view angle measured in degrees along the selected axis.", null, null); + public static readonly GUIContent viewportRect = L10n.TextContent("Viewport Rect", "Four values that indicate where on the screen this camera view will be drawn. Measured in Viewport Coordinates (values 0-1).", null, null); + public static readonly GUIContent sensorSize = L10n.TextContent("Sensor Size", "The size of the camera sensor in millimeters.", null, null); + public static readonly GUIContent lensShift = L10n.TextContent("Lens Shift", "Offset from the camera sensor. Use these properties to simulate a shift lens. Measured as a multiple of the sensor size.", null, null); + public static readonly GUIContent iso = L10n.TextContent("ISO", "The sensor sensitivity (ISO).", null, null); + public static readonly GUIContent shutterSpeed = L10n.TextContent("Shutter Speed", "The exposure time, in second.", null, null); + public static readonly GUIContent aperture = L10n.TextContent("Aperture", "The aperture number, in f-stop.", null, null); + public static readonly GUIContent focusDistance = L10n.TextContent("Focus Distance", "The focus distance of the lens. The Depth of Field Volume override uses this value if you set focusDistanceMode to FocusDistanceMode.Camera.", null, null); + public static readonly GUIContent bladeCount = L10n.TextContent("Blade Count", "The number of diaphragm blades.", null, null); + public static readonly GUIContent curvature = L10n.TextContent("Curvature", "Maps an aperture range to blade curvature.", null, null); + public static readonly GUIContent barrelClipping = L10n.TextContent("Barrel Clipping", "The strength of the \"cat eye\" effect on bokeh (optical vignetting).", null, null); + public static readonly GUIContent anamorphism = L10n.TextContent("Anamorphism", "Stretches the sensor to simulate an anamorphic look. Positive values distort the Camera vertically, negative will distort the Camera horizontally.", null, null); + public static readonly GUIContent physicalCamera = L10n.TextContent("Physical Camera", "Enables Physical camera mode. When checked, the field of view is calculated from properties for simulating physical attributes (focal length, sensor size, and lens shift)", null, null); + public static readonly GUIContent cameraType = L10n.TextContent("Sensor Type", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings.", null, null); + public static readonly GUIContent renderingPath = L10n.TextContent("Rendering Path", "Choose a rendering method for this camera.\n\nUse Graphics Settings to use the rendering path specified in graphics settings.\n\nUse Forward to render all objects with one pass per light.\n\nUse Deferred to draw all objects once without lighting and then draw the lighting of all objects at the end of the render queue.\n\nUse Legacy Vertex Lit to render all lights in a single pass, calculated at vertices.", null, null); + public static readonly GUIContent focalLength = L10n.TextContent("Focal Length", "The simulated distance between the lens and the sensor of the physical camera. Larger values give a narrower field of view.", null, null); + public static readonly GUIContent allowOcclusionCulling = L10n.TextContent("Occlusion Culling", "Occlusion Culling disables rendering of objects when they are not currently seen by the camera because they are obscured (occluded) by other objects.", null, null); + public static readonly GUIContent allowHDR = L10n.TextContent("HDR", "High Dynamic Range gives you a wider range of light intensities, so your lighting looks more realistic. With it, you can still see details and experience less saturation even with bright light.", null, null); + public static readonly GUIContent allowMSAA = L10n.TextContent("MSAA", "Use Multi Sample Anti-aliasing to reduce aliasing.", null, null); + public static readonly GUIContent gateFit = L10n.TextContent("Gate Fit", "Determines how the rendered area (resolution gate) fits into the sensor area (film gate).", null, null); + public static readonly GUIContent allowDynamicResolution = L10n.TextContent("Allow Dynamic Resolution", "Scales render textures to support dynamic resolution if the target platform/graphics API supports it.", null, null); + public static readonly GUIContent FOVAxisMode = L10n.TextContent("FOV Axis", "Field of view axis.", null, null); + public static readonly GUIContent targetDisplay = L10n.TextContent("Target Display", "Set the target display for this camera.", null, null); + public static readonly GUIContent xrTargetEye = L10n.TextContent("Target Eye", "Allows XR rendering for target eye. This disables stereo rendering and only works for the selected eye.", null, null); + + public static readonly GUIContent orthoDeferredWarning = L10n.TextContent("Deferred rendering does not work with Orthographic camera, will use Forward.", null, null, null); public static readonly GUIContent orthoXRWarning = EditorGUIUtility.TrTextContent("Orthographic projection is not supported when running in XR.", "One or more XR Plug-in providers were detected in your project. Using Orthographic projection is not supported when running in XR and enabling this may cause problems.", EditorGUIUtility.warningIcon); - public static readonly GUIContent deferredMSAAWarning = EditorGUIUtility.TrTextContent("The target texture is using MSAA. Note that this will not affect MSAA behaviour of this camera. MSAA rendering for cameras is configured through the 'MSAA' camera setting and related project settings. The target texture will always contain resolved pixel data."); - public static readonly GUIContent dynamicResolutionTimingWarning = EditorGUIUtility.TrTextContent("It is recommended to enable Frame Timing Statistics under Rendering Player Settings when using dynamic resolution cameras."); + public static readonly GUIContent deferredMSAAWarning = L10n.TextContent("The target texture is using MSAA. Note that this will not affect MSAA behaviour of this camera. MSAA rendering for cameras is configured through the 'MSAA' camera setting and related project settings. The target texture will always contain resolved pixel data.", null, null, null); + public static readonly GUIContent dynamicResolutionTimingWarning = L10n.TextContent("It is recommended to enable Frame Timing Statistics under Rendering Player Settings when using dynamic resolution cameras.", null, null, null); public static readonly GUIStyle invisibleButton = new GUIStyle("InvisibleButton"); @@ -174,10 +173,10 @@ public Settings(SerializedObject so) // in different order than they appear in the enum. internal static readonly GUIContent[] k_CameraRenderPaths = { - EditorGUIUtility.TrTextContent("Use Graphics Settings"), - EditorGUIUtility.TrTextContent("Forward"), - EditorGUIUtility.TrTextContent("Deferred"), - EditorGUIUtility.TrTextContent("Legacy Vertex Lit") + L10n.TextContent("Use Graphics Settings", null, null, null), + L10n.TextContent("Forward", null, null, null), + L10n.TextContent("Deferred", null, null, null), + L10n.TextContent("Legacy Vertex Lit", null, null, null) }; internal static readonly int[] k_CameraRenderPathValues = @@ -190,8 +189,8 @@ public Settings(SerializedObject so) internal static readonly GUIContent[] k_DefaultOptions = { - EditorGUIUtility.TrTextContent("Off"), - EditorGUIUtility.TrTextContent("Use Graphics Settings"), + L10n.TextContent("Off", null, null, null), + L10n.TextContent("Use Graphics Settings", null, null, null), }; internal static readonly int[] k_DefaultOptionValues = @@ -202,10 +201,10 @@ public Settings(SerializedObject so) internal static readonly GUIContent[] k_TargetEyes = { - EditorGUIUtility.TrTextContent("Both"), - EditorGUIUtility.TrTextContent("Left"), - EditorGUIUtility.TrTextContent("Right"), - EditorGUIUtility.TrTextContent("None (Main Display)"), + L10n.TextContent("Both", null, null, null), + L10n.TextContent("Left", null, null, null), + L10n.TextContent("Right", null, null, null), + L10n.TextContent("None (Main Display)", null, null, null), }; internal static readonly int[] k_TargetEyeValues = @@ -1304,4 +1303,3 @@ void SetupProjectionParameters(VisualElement contents) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/CameraOverlay.cs b/Editor/Mono/Inspector/CameraOverlay.cs index b8dc6a347c..4b5b9f3505 100644 --- a/Editor/Mono/Inspector/CameraOverlay.cs +++ b/Editor/Mono/Inspector/CameraOverlay.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using UnityEditor.Overlays; @@ -31,6 +30,11 @@ partial class SceneViewCameraOverlay : IMGUIOverlay Camera selectedCamera => m_SelectedCamera; [AutoStaticsCleanupOnCodeReload] + // Refcounted registry of live camera preview overlays: each overlay registers itself when it is + // created and unregisters when it goes away. The overlay instances are plain managed objects that + // do not survive a code reload either — they are recreated with the SceneView's overlay canvas — + // so the registry and the live overlay set reset together and stay consistent. + [IgnoreForUAL0015("Live-overlay registry refilled as camera preview overlays are recreated")] static Dictionary s_CameraOverlays = new Dictionary(); SceneViewCameraOverlay(Camera camera) @@ -152,4 +156,3 @@ public override void OnGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/CanvasEditor.cs b/Editor/Mono/Inspector/CanvasEditor.cs index 8a71cff71e..8bcb845596 100644 --- a/Editor/Mono/Inspector/CanvasEditor.cs +++ b/Editor/Mono/Inspector/CanvasEditor.cs @@ -37,18 +37,18 @@ internal class CanvasEditor : Editor private static class Styles { - public static readonly GUIContent eventCamera = EditorGUIUtility.TrTextContent("Event Camera", "The Camera which the events are triggered through. This is used to determine clicking and hover positions if the Canvas is in World Space render mode."); - public static readonly GUIContent renderCamera = EditorGUIUtility.TrTextContent("Render Camera", "The Camera which will render the canvas. This is also the camera used to send events."); - public static readonly GUIContent sortingOrder = EditorGUIUtility.TrTextContent("Sort Order", "The order in which Screen Space - Overlay canvas will render"); + public static readonly GUIContent eventCamera = L10n.TextContent("Event Camera", "The Camera which the events are triggered through. This is used to determine clicking and hover positions if the Canvas is in World Space render mode.", null, null); + public static readonly GUIContent renderCamera = L10n.TextContent("Render Camera", "The Camera which will render the canvas. This is also the camera used to send events.", null, null); + public static readonly GUIContent sortingOrder = L10n.TextContent("Sort Order", "The order in which Screen Space - Overlay canvas will render", null, null); public static readonly string s_RootAndNestedMessage = "Cannot multi-edit root Canvas together with nested Canvas."; - public static readonly GUIContent m_SortingLayerStyle = EditorGUIUtility.TrTextContent("Sorting Layer", "Name of the Renderer's sorting layer"); - public static readonly GUIContent targetDisplay = EditorGUIUtility.TrTextContent("Target Display", "Display on which to render the canvas when in overlay mode"); - public static readonly GUIContent m_SortingOrderStyle = EditorGUIUtility.TrTextContent("Order in Layer", "Renderer's order within a sorting layer"); - public static readonly GUIContent m_ShaderChannel = EditorGUIUtility.TrTextContent("Additional Shader Channels"); - public static readonly GUIContent pixelPerfectContent = EditorGUIUtility.TrTextContent("Pixel Perfect"); - public static readonly GUIContent standaloneRenderResize = EditorGUIUtility.TrTextContent("Resize Canvas", "For manual Camera.Render calls should the canvas resize to match the destination target."); - public static readonly GUIContent vertexColorAlwaysGammaSpace = EditorGUIUtility.TrTextContent("Vertex Color Always In Gamma Color Space", "UI vertex colors are always in gamma color space disregard of the player settings"); - public static readonly GUIContent useReflectionProbes = EditorGUIUtility.TrTextContent("Reflection Probes", "Allows shaders in the canvas to access data from Reflection Probes"); + public static readonly GUIContent m_SortingLayerStyle = L10n.TextContent("Sorting Layer", "Name of the Renderer's sorting layer", null, null); + public static readonly GUIContent targetDisplay = L10n.TextContent("Target Display", "Display on which to render the canvas when in overlay mode", null, null); + public static readonly GUIContent m_SortingOrderStyle = L10n.TextContent("Order in Layer", "Renderer's order within a sorting layer", null, null); + public static readonly GUIContent m_ShaderChannel = L10n.TextContent("Additional Shader Channels", null, null, null); + public static readonly GUIContent pixelPerfectContent = L10n.TextContent("Pixel Perfect", null, null, null); + public static readonly GUIContent standaloneRenderResize = L10n.TextContent("Resize Canvas", "For manual Camera.Render calls should the canvas resize to match the destination target.", null, null); + public static readonly GUIContent vertexColorAlwaysGammaSpace = L10n.TextContent("Vertex Color Always In Gamma Color Space", "UI vertex colors are always in gamma color space disregard of the player settings", null, null); + public static readonly GUIContent useReflectionProbes = L10n.TextContent("Reflection Probes", "Allows shaders in the canvas to access data from Reflection Probes", null, null); } private bool m_AllNested = false; diff --git a/Editor/Mono/Inspector/CanvasRendererEditor.cs b/Editor/Mono/Inspector/CanvasRendererEditor.cs index f29b5a0340..5c75382899 100644 --- a/Editor/Mono/Inspector/CanvasRendererEditor.cs +++ b/Editor/Mono/Inspector/CanvasRendererEditor.cs @@ -12,7 +12,7 @@ internal class CanvasRendererEditor : Editor { class Styles { - public static readonly GUIContent cullTransparentMeshContent = EditorGUIUtility.TrTextContent("Cull Transparent Mesh", "Cull if the vertex color alpha is close to zero for every vertex of the mesh."); + public static readonly GUIContent cullTransparentMeshContent = L10n.TextContent("Cull Transparent Mesh", "Cull if the vertex color alpha is close to zero for every vertex of the mesh.", null, null); } private SerializedProperty m_CullTransparentMeshProperty; diff --git a/Editor/Mono/Inspector/ComputeShaderImporterInspector.cs b/Editor/Mono/Inspector/ComputeShaderImporterInspector.cs index ea44af3071..143a9f29dd 100644 --- a/Editor/Mono/Inspector/ComputeShaderImporterInspector.cs +++ b/Editor/Mono/Inspector/ComputeShaderImporterInspector.cs @@ -18,7 +18,7 @@ internal class ComputeShaderImporterInspector : AssetImporterEditor { internal class Styles { - public static readonly GUIContent overridePreprocessor = EditorGUIUtility.TrTextContent("Override preprocessor", "Select preprocessor to use for this shader."); + public static readonly GUIContent overridePreprocessor = L10n.TextContent("Override preprocessor", "Select preprocessor to use for this shader.", null, null); } internal override void OnHeaderControlsGUI() diff --git a/Editor/Mono/Inspector/ComputeShaderInspector.cs b/Editor/Mono/Inspector/ComputeShaderInspector.cs index 467e003b40..2aa3b34f11 100644 --- a/Editor/Mono/Inspector/ComputeShaderInspector.cs +++ b/Editor/Mono/Inspector/ComputeShaderInspector.cs @@ -31,10 +31,10 @@ class KernelInfo internal class Styles { - public static readonly GUIContent togglePreprocess = EditorGUIUtility.TrTextContent("Preprocess only", "Show preprocessor output instead of compiled shader code"); - public static readonly GUIContent toggleStripLineDirective = EditorGUIUtility.TrTextContent("Strip #line directives", "Strip #line directives from preprocessor output"); - public static readonly GUIContent showCompiled = EditorGUIUtility.TrTextContent("Show compiled code"); - public static readonly GUIContent kernelsHeading = EditorGUIUtility.TrTextContent("Kernels:"); + public static readonly GUIContent togglePreprocess = L10n.TextContent("Preprocess only", "Show preprocessor output instead of compiled shader code", null, null); + public static readonly GUIContent toggleStripLineDirective = L10n.TextContent("Strip #line directives", "Strip #line directives from preprocessor output", null, null); + public static readonly GUIContent showCompiled = L10n.TextContent("Show compiled code", null, null, null); + public static readonly GUIContent kernelsHeading = L10n.TextContent("Kernels:", null, null, null); } static List GetKernelDisplayInfo(ComputeShader cs) diff --git a/Editor/Mono/Inspector/ConstrainProportionsTransformScale.cs b/Editor/Mono/Inspector/ConstrainProportionsTransformScale.cs index 0fe37f5bc8..cfe4f4d665 100644 --- a/Editor/Mono/Inspector/ConstrainProportionsTransformScale.cs +++ b/Editor/Mono/Inspector/ConstrainProportionsTransformScale.cs @@ -33,7 +33,7 @@ internal Vector3 DoGUI(Rect rect, GUIContent scaleContent, Vector3 value, Unity bool previousIsProportionalScale = m_ConstrainProportionsScale; uint mixedValues = property != null ? GetMixedValueFields(property) : 0; Vector3 scale = EditorGUI.LinkedVector3Field(rect, - scaleContent, EditorGUIUtility.TrTextContent("", (constrainProportionsScale ? "Disable" : "Enable") + " constrained proportions"), value, + scaleContent, L10n.TextContent("", (constrainProportionsScale ? "Disable" : "Enable") + " constrained proportions", null, null), value, ref m_ConstrainProportionsScale, m_InitialScale, mixedValues, ref axisModified, property, constrainProportionsProperty); if (previousIsProportionalScale != m_ConstrainProportionsScale) diff --git a/Editor/Mono/Inspector/ConstraintEditorBase.cs b/Editor/Mono/Inspector/ConstraintEditorBase.cs index 276c55def1..aaba5fbc2d 100644 --- a/Editor/Mono/Inspector/ConstraintEditorBase.cs +++ b/Editor/Mono/Inspector/ConstraintEditorBase.cs @@ -12,15 +12,15 @@ namespace UnityEditor { internal abstract class ConstraintStyleBase { - GUIContent m_Activate = EditorGUIUtility.TrTextContent("Activate", "Activate the constraint at the current offset from the sources."); - GUIContent m_Zero = EditorGUIUtility.TrTextContent("Zero", "Activate the constraint at zero offset from the sources."); + GUIContent m_Activate = L10n.TextContent("Activate", "Activate the constraint at the current offset from the sources.", null, null); + GUIContent m_Zero = L10n.TextContent("Zero", "Activate the constraint at zero offset from the sources.", null, null); - GUIContent m_Sources = EditorGUIUtility.TrTextContent("Sources"); + GUIContent m_Sources = L10n.TextContent("Sources", null, null, null); - GUIContent m_Weight = EditorGUIUtility.TrTextContent("Weight"); + GUIContent m_Weight = L10n.TextContent("Weight", null, null, null); - GUIContent m_IsActive = EditorGUIUtility.TrTextContent("Is Active", "When set, the constraint is being evaluated."); - GUIContent m_IsLocked = EditorGUIUtility.TrTextContent("Lock", "When set, evaluate with the current offset. When not set, update the offset based on the current transform."); + GUIContent m_IsActive = L10n.TextContent("Is Active", "When set, the constraint is being evaluated.", null, null); + GUIContent m_IsLocked = L10n.TextContent("Lock", "When set, evaluate with the current offset. When not set, update the offset based on the current transform.", null, null); GUIContent[] m_Axes = { @@ -29,7 +29,7 @@ internal abstract class ConstraintStyleBase EditorGUIUtility.TextContent("Z") }; - GUIContent m_ConstraintSettings = EditorGUIUtility.TrTextContent("Constraint Settings"); + GUIContent m_ConstraintSettings = L10n.TextContent("Constraint Settings", null, null, null); public virtual GUIContent Activate { get { return m_Activate; } } public virtual GUIContent Zero { get { return m_Zero; } } diff --git a/Editor/Mono/Inspector/Core/AddComponent/AddComponentWindow.cs b/Editor/Mono/Inspector/Core/AddComponent/AddComponentWindow.cs index 1ad0379117..a35e203fdc 100644 --- a/Editor/Mono/Inspector/Core/AddComponent/AddComponentWindow.cs +++ b/Editor/Mono/Inspector/Core/AddComponent/AddComponentWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Linq; using Unity.Scripting.LifecycleManagement; @@ -180,4 +179,3 @@ private static InspectorWindow FirstInspectorWithGameObject() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs index 9f9eb74cb0..ed7de3be3f 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs @@ -16,14 +16,13 @@ internal class AdvancedDropdownGUI { private static class Styles { - public static readonly GUIStyle itemStyle = "DD ItemStyle"; - public static readonly GUIStyle header = "DD HeaderStyle"; - [NoAutoStaticsCleanup] // mutated in static ctor (padding/clipping), cannot be readonly - public static GUIStyle headerEllipsis = "DD HeaderStyle"; - public static readonly GUIStyle checkMark = "DD ItemCheckmark"; - public static readonly GUIStyle lineSeparator = "DefaultLineSeparator"; - public static readonly GUIStyle rightArrow = "ArrowNavigationRight"; - public static readonly GUIStyle leftArrow = "ArrowNavigationLeft"; + public static GUIStyle itemStyle => EditorStyles.advancedDropdownItem; + public static GUIStyle header => EditorStyles.advancedDropdownHeader; + public static GUIStyle headerEllipsis => EditorStyles.advancedDropdownHeader; + public static GUIStyle checkMark => EditorStyles.advancedDropdownCheckmark; + public static GUIStyle lineSeparator => EditorStyles.defaultLineSeparator; + public static GUIStyle rightArrow => EditorStyles.arrowNavigationRight; + public static GUIStyle leftArrow => EditorStyles.arrowNavigationLeft; public static readonly GUIStyle searchFieldStyle = new GUIStyle(EditorStyles.toolbarSearchField) { margin = new RectOffset(5, 4, 4, 5) @@ -39,8 +38,6 @@ private static class Styles static Styles() { - headerEllipsis.padding.left = 20; - headerEllipsis.clipping = TextClipping.Ellipsis; helpBox = new GUIStyle(EditorStyles.helpBox) { padding = new RectOffset(8, 8, 8, 8), @@ -294,39 +291,43 @@ internal Vector2 CalculateContentSize(AdvancedDropdownDataSource dataSource) internal Vector2 CalculateContentSize(AdvancedDropdownDataSource dataSource, AdvancedDropdownItem currentLevel) { - float maxWidth = 0; - float maxHeight = 0; - bool includeArrow = false; - float arrowWidth = Styles.rightArrow.fixedWidth; + // Icons are drawn at iconSize, so they have to be measured at iconSize too + using (new EditorGUIUtility.IconSizeScope(iconSize)) + { + float maxWidth = 0; + float maxHeight = 0; + bool includeArrow = false; + float arrowWidth = Styles.rightArrow.fixedWidth; - // Calculate size for the specified level - CalculateTreeSize(currentLevel, ref maxWidth, ref maxHeight, ref includeArrow); + // Calculate size for the specified level + CalculateTreeSize(currentLevel, ref maxWidth, ref maxHeight, ref includeArrow); - if (includeArrow) - { - maxWidth += arrowWidth; - } + if (includeArrow) + { + maxWidth += arrowWidth; + } - // other size calculations may rely on m_HeaderRect and m_SearchRect, which wont be populated until the first time they are drawn - // so they need to be calculated here if needed. - if (m_HeaderRect == default(Rect)) - { - var headerContent = GUIContent.Temp(dataSource.mainTree.name, dataSource.mainTree.icon); - var headerSize = Styles.header.CalcSize(headerContent); - if (maxWidth > headerSize.x) - headerSize.x = maxWidth; - headerSize.y = Styles.header.CalcHeight(headerContent, maxWidth); - m_HeaderRect = new Rect(0, 0, headerSize.x, headerSize.y); - } - if (m_SearchRect == default(Rect)) - { - var controlRectSize = Styles.searchFieldStyle.CalcSize(GUIContent.none); - controlRectSize.x = maxWidth; - var controlRect = new Rect(0, 0, controlRectSize.x, controlRectSize.y); - m_SearchRect = CalculateSearchRect(ref controlRect); - } + // other size calculations may rely on m_HeaderRect and m_SearchRect, which wont be populated until the first time they are drawn + // so they need to be calculated here if needed. + if (m_HeaderRect == default(Rect)) + { + var headerContent = GUIContent.Temp(dataSource.mainTree.name, dataSource.mainTree.icon); + var headerSize = Styles.header.CalcSize(headerContent); + if (maxWidth > headerSize.x) + headerSize.x = maxWidth; + headerSize.y = Styles.header.CalcHeight(headerContent, maxWidth); + m_HeaderRect = new Rect(0, 0, headerSize.x, headerSize.y); + } + if (m_SearchRect == default(Rect)) + { + var controlRectSize = Styles.searchFieldStyle.CalcSize(GUIContent.none); + controlRectSize.x = maxWidth; + var controlRect = new Rect(0, 0, controlRectSize.x, controlRectSize.y); + m_SearchRect = CalculateSearchRect(ref controlRect); + } - return new Vector2(maxWidth, maxHeight); + return new Vector2(maxWidth, maxHeight); + } } private void CalculateTreeSize(AdvancedDropdownItem level, ref float maxWidth, ref float maxHeight, ref bool includeArrow) @@ -369,22 +370,26 @@ internal float GetSelectionHeight(AdvancedDropdownDataSource dataSource, Rect bu if (state.GetSelectedIndex(dataSource.mainTree) == -1) return 0; float height = 0; - for (int i = 0; i < dataSource.mainTree.childList.Count; i++) + + using (new EditorGUIUtility.IconSizeScope(iconSize)) { - var child = dataSource.mainTree.childList[i]; - var content = child.content; - if (state.GetSelectedIndex(dataSource.mainTree) == i) - { - var diff = (CalcItemHeight(content, 0) - buttonRect.height) / 2f; - return height + diff; - } - if (child.IsSeparator()) - { - height += Styles.lineSeparator.CalcHeight(content, 0) + Styles.lineSeparator.margin.vertical; - } - else + for (int i = 0; i < dataSource.mainTree.childList.Count; i++) { - height += CalcItemHeight(content, 0); + var child = dataSource.mainTree.childList[i]; + var content = child.content; + if (state.GetSelectedIndex(dataSource.mainTree) == i) + { + var diff = (CalcItemHeight(content, 0) - buttonRect.height) / 2f; + return height + diff; + } + if (child.IsSeparator()) + { + height += Styles.lineSeparator.CalcHeight(content, 0) + Styles.lineSeparator.margin.vertical; + } + else + { + height += CalcItemHeight(content, 0); + } } } return height; diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs index 16d15c2688..b9f45a46b9 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -16,14 +15,9 @@ namespace UnityEditor.IMGUI.Controls { internal class AdvancedDropdownWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal AdvancedDropdownWindow() { } - #pragma warning restore UAL0015 - private static class Styles { - [NoAutoStaticsCleanup] // mutated in static ctor (padding), cannot be readonly - public static GUIStyle background = "DD Background"; + public static GUIStyle background => EditorStyles.advancedDropdownBackground; [NoAutoStaticsCleanup] // mutated in static ctor (padding), cannot be readonly public static GUIStyle previewHeader = new GUIStyle(EditorStyles.label); [NoAutoStaticsCleanup] // mutated in static ctor (padding), cannot be readonly @@ -712,4 +706,3 @@ protected static void CloseAllOpenWindows() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/EditorGUI/StatelessAdvancedDropdown.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/EditorGUI/StatelessAdvancedDropdown.cs index 52422f5961..3d1f88c5f3 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/EditorGUI/StatelessAdvancedDropdown.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/EditorGUI/StatelessAdvancedDropdown.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIControls not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEditor.IMGUI.Controls; @@ -292,4 +291,3 @@ static int DoMaskField(Rect rect, int mask, string[] displayedOptions, GUIStyle } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/InspectorWindow.cs b/Editor/Mono/Inspector/Core/InspectorWindow.cs index 42d871bec8..6463fe2b28 100644 --- a/Editor/Mono/Inspector/Core/InspectorWindow.cs +++ b/Editor/Mono/Inspector/Core/InspectorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -19,10 +18,6 @@ namespace UnityEditor [EditorWindowTitle(title = k_InspectorWindowTitle, useTypeNameAsIconName = true)] internal partial class InspectorWindow : PropertyEditor, IPropertyView, IHasCustomMenu { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal InspectorWindow() { } - #pragma warning restore UAL0015 - const string k_InspectorWindowTitle = "Inspector"; const string k_InspectorWindowTitleDebug = "Inspector (Debug)"; const string k_InspectorWindowTitleDebugInternal = "Inspector (Debug Internal)"; @@ -303,7 +298,7 @@ internal static InspectorWindow[] GetAllInspectorWindows() public override void AddItemsToMenu(GenericMenu menu) { m_LockTracker.AddItemsToMenu(menu); - menu.AddItem(EditorGUIUtility.TrTextContent("Properties..."), false, () => OpenPropertyEditor(GetInspectedObjects())); + menu.AddItem(L10n.TextContent("Properties...", null, null, null), false, () => OpenPropertyEditor(GetInspectedObjects())); menu.AddSeparator(String.Empty); base.AddItemsToMenu(menu); } @@ -419,9 +414,9 @@ protected override void EndDrawPreviewAndLabels(Event evt, Rect rect, Rect dragR { GenericMenu menu = new GenericMenu(); menu.AddItem( - EditorGUIUtility.TrTextContent(m_PreviewWindow == null + L10n.TextContent(m_PreviewWindow == null ? "Convert to Floating Window" - : "Dock Preview to Inspector"), false, + : "Dock Preview to Inspector", null, null, null), false, () => { if (m_PreviewWindow == null) @@ -434,9 +429,9 @@ protected override void EndDrawPreviewAndLabels(Event evt, Rect rect, Rect dragR } }); menu.AddItem( - EditorGUIUtility.TrTextContent(m_PreviewResizer.GetExpanded() + L10n.TextContent(m_PreviewResizer.GetExpanded() ? "Minimize in Inspector" - : "Restore in Inspector"), false, + : "Restore in Inspector", null, null, null), false, () => { m_PreviewResizer.SetExpanded(position, k_InspectorPreviewMinTotalHeight, @@ -694,4 +689,3 @@ private static bool EditorForMultiEditingChanged(Editor editor, Object target) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/PreviewWindow.cs b/Editor/Mono/Inspector/Core/PreviewWindow.cs index 486e11eb9f..007cbd6a82 100644 --- a/Editor/Mono/Inspector/Core/PreviewWindow.cs +++ b/Editor/Mono/Inspector/Core/PreviewWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System.Collections.Generic; using UnityEngine; using UnityEngine.Pool; @@ -12,10 +11,6 @@ namespace UnityEditor { internal class PreviewWindow : InspectorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - internal PreviewWindow() { } - #pragma warning restore UAL0015 - [SerializeField] private InspectorWindow m_ParentInspectorWindow; @@ -69,7 +64,7 @@ protected override void OnDestroy() protected override void OnEnable() { - titleContent = EditorGUIUtility.TrTextContent("Preview"); + titleContent = L10n.TextContent("Preview", null, null, null); minSize = new Vector2(260, 220); AddInspectorWindow(this); @@ -303,7 +298,7 @@ IMGUIContainer DrawPreview(bool drawToolbar = false) public override void AddItemsToMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Dock Preview to Inspector"), false, Close); + menu.AddItem(L10n.TextContent("Dock Preview to Inspector", null, null, null), false, Close); } protected override void ShowButton(Rect r) {} @@ -317,4 +312,3 @@ internal override bool CanMaximize() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/PropertyEditor.cs b/Editor/Mono/Inspector/Core/PropertyEditor.cs index 0483601127..eac4f35302 100644 --- a/Editor/Mono/Inspector/Core/PropertyEditor.cs +++ b/Editor/Mono/Inspector/Core/PropertyEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using System.IO; @@ -115,6 +114,9 @@ partial class PropertyEditor : EditorWindow, IPropertyView, IHasCustomMenu private Object m_InspectedObject; private string m_ExpectedTitle; [AutoStaticsCleanupOnCodeReload] + // Only used to cascade the position of the next property editor window; ShowPropertyEditorWindow + // reassigns it every time such a window is opened. + [IgnoreForUAL0015("Last-opened window reference, reassigned whenever a property editor window is shown")] private static PropertyEditor s_LastPropertyEditor; protected EntityId m_LastInitialEditorEntityId; protected Component[] m_ComponentsInPrefabSource; @@ -223,31 +225,31 @@ protected static partial class Styles public static readonly GUIStyle dragHandle = "RL DragHandle"; public static readonly GUIStyle lockButton = "IN LockButton"; public static readonly GUIStyle insertionMarker = "InsertionMarker"; - public static readonly GUIContent preTitle = EditorGUIUtility.TrTextContent("Preview"); - public static readonly GUIContent labelTitle = EditorGUIUtility.TrTextContent("Asset Labels"); - public static readonly GUIContent addComponentLabel = EditorGUIUtility.TrTextContent("Add Component"); + public static readonly GUIContent preTitle = L10n.TextContent("Preview", null, null, null); + public static readonly GUIContent labelTitle = L10n.TextContent("Asset Labels", null, null, null); + public static readonly GUIContent addComponentLabel = L10n.TextContent("Add Component", null, null, null); public static readonly GUIStyle preBackground = "preBackground"; public static readonly GUIStyle footer = "IN Footer"; public static readonly GUIStyle preMargins = new GUIStyle() {margin = new RectOffset(0, 0, 0, 4)}; public static readonly GUIStyle preOptionsButton = new GUIStyle(EditorStyles.toolbarButtonRight) { padding = new RectOffset(), contentOffset = new Vector2(1, 0) }; public static readonly GUIStyle addComponentArea = EditorStyles.inspectorTitlebar; public static readonly GUIStyle addComponentButtonStyle = "AC Button"; - public static readonly GUIContent menuIcon = EditorGUIUtility.TrIconContent("_Menu"); + public static readonly GUIContent menuIcon = L10n.IconContent("_Menu", null, null); public static readonly GUIStyle previewMiniLabel = EditorStyles.whiteMiniLabel; public static readonly GUIStyle typeSelection = "IN TypeSelection"; public static readonly GUIContent vcsCheckoutHint = EditorGUIUtility.TrTextContent("Under Version Control\nCheck out this asset in order to make changes.", EditorGUIUtility.GetHelpIcon(MessageType.Info)); - public static readonly GUIContent vcsNotConnected = EditorGUIUtility.TrTextContent("VCS ({0}) is not connected"); - public static readonly GUIContent vcsOffline = EditorGUIUtility.TrTextContent("Work Offline option is active"); - public static readonly GUIContent vcsSettings = EditorGUIUtility.TrTextContent("Settings"); - public static readonly GUIContent vcsCheckout = EditorGUIUtility.TrTextContent("Check Out"); - public static readonly GUIContent vcsCheckoutMeta = EditorGUIUtility.TrTextContent("Check Out Meta"); - public static readonly GUIContent vcsAdd = EditorGUIUtility.TrTextContent("Add"); - public static readonly GUIContent vcsLock = EditorGUIUtility.TrTextContent("Lock"); - public static readonly GUIContent vcsUnlock = EditorGUIUtility.TrTextContent("Unlock"); - public static readonly GUIContent vcsSubmit = EditorGUIUtility.TrTextContent("Submit"); - public static readonly GUIContent vcsRevert = EditorGUIUtility.TrTextContent("Revert"); - public static readonly GUIContent vcsRevertUnchanged = EditorGUIUtility.TrTextContent("Revert Unchanged"); + public static readonly GUIContent vcsNotConnected = L10n.TextContent("VCS ({0}) is not connected", null, null, null); + public static readonly GUIContent vcsOffline = L10n.TextContent("Work Offline option is active", null, null, null); + public static readonly GUIContent vcsSettings = L10n.TextContent("Settings", null, null, null); + public static readonly GUIContent vcsCheckout = L10n.TextContent("Check Out", null, null, null); + public static readonly GUIContent vcsCheckoutMeta = L10n.TextContent("Check Out Meta", null, null, null); + public static readonly GUIContent vcsAdd = L10n.TextContent("Add", null, null, null); + public static readonly GUIContent vcsLock = L10n.TextContent("Lock", null, null, null); + public static readonly GUIContent vcsUnlock = L10n.TextContent("Unlock", null, null, null); + public static readonly GUIContent vcsSubmit = L10n.TextContent("Submit", null, null, null); + public static readonly GUIContent vcsRevert = L10n.TextContent("Revert", null, null, null); + public static readonly GUIContent vcsRevertUnchanged = L10n.TextContent("Revert Unchanged", null, null, null); [NoAutoStaticsCleanup] // array of auto-exempt GUIContent refs, safe to persist public static readonly GUIContent[] vcsRevertMenuNames = {vcsRevertUnchanged}; [NoAutoStaticsCleanup] // ok the static method assigned here is stateless @@ -347,9 +349,7 @@ public static VersionControlBarState Calculate(Editor[] assetEditors, Asset asse } } - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced internal PropertyEditor() - #pragma warning restore UAL0015 { editorDragging = new EditorDragging(this); minSize = new Vector2(k_MinimumWindowWidth, minSize.y); @@ -754,12 +754,12 @@ private void UpdateInspectorModeStyle() public virtual void AddDebugItemsToMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Normal"), m_InspectorMode == InspectorMode.Normal, SetNormal); - menu.AddItem(EditorGUIUtility.TrTextContent("Debug"), m_InspectorMode == InspectorMode.Debug, SetDebug); + menu.AddItem(L10n.TextContent("Normal", null, null, null), m_InspectorMode == InspectorMode.Normal, SetNormal); + menu.AddItem(L10n.TextContent("Debug", null, null, null), m_InspectorMode == InspectorMode.Debug, SetDebug); if (Unsupported.IsDeveloperMode()) { - menu.AddItem(EditorGUIUtility.TrTextContent("Debug-Internal"), m_InspectorMode == InspectorMode.DebugInternal, SetDebugInternal); + menu.AddItem(L10n.TextContent("Debug-Internal", null, null, null), m_InspectorMode == InspectorMode.DebugInternal, SetDebugInternal); } } @@ -769,14 +769,14 @@ public virtual void AddItemsToMenu(GenericMenu menu) menu.AddSeparator(String.Empty); if (IsAnyComponentCollapsed()) - menu.AddItem(EditorGUIUtility.TrTextContent("Expand All Components"), false, ExpandAllComponents); + menu.AddItem(L10n.TextContent("Expand All Components", null, null, null), false, ExpandAllComponents); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Expand All Components")); + menu.AddDisabledItem(L10n.TextContent("Expand All Components", null, null, null)); if (IsAnyComponentExpanded()) - menu.AddItem(EditorGUIUtility.TrTextContent("Collapse All Components"), false, CollapseAllComponents); + menu.AddItem(L10n.TextContent("Collapse All Components", null, null, null), false, CollapseAllComponents); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Collapse All Components")); + menu.AddDisabledItem(L10n.TextContent("Collapse All Components", null, null, null)); if (m_Tracker != null) { @@ -797,8 +797,8 @@ public virtual void AddItemsToMenu(GenericMenu menu) } menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Ping"), false, () => EditorGUIUtility.PingObject(GetInspectedObject())); - menu.AddItem(EditorGUIUtility.TrTextContent("Open in Import Activity Window"), false, () => ImportActivityWindow.OpenFromPropertyEditor(GetInspectedObject())); + menu.AddItem(L10n.TextContent("Ping", null, null, null), false, () => EditorGUIUtility.PingObject(GetInspectedObject())); + menu.AddItem(L10n.TextContent("Open in Import Activity Window", null, null, null), false, () => ImportActivityWindow.OpenFromPropertyEditor(GetInspectedObject())); } private void SetTrackerExpandedState(ActiveEditorTracker tracker, int editorIndex, bool expanded) @@ -3027,4 +3027,3 @@ protected virtual void OnUpdateSupportedDataModes(List supportedModes) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/RootEditor.cs b/Editor/Mono/Inspector/Core/RootEditor.cs index 511177e83b..81d178c7e2 100644 --- a/Editor/Mono/Inspector/Core/RootEditor.cs +++ b/Editor/Mono/Inspector/Core/RootEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -55,9 +54,13 @@ class RootEditorDesc public bool usesMetaData; } + // Transient guard toggled around a single root-editor query; false is the correct resting value. [AutoStaticsCleanupOnCodeReload] private static bool s_SuppressRootEditor = false; - [AutoStaticsCleanupOnCodeReload] // holds handler delegates found via reflection; Rebuild() (called from Initialize's [OnCodeLoaded]) clears and repopulates it + + // Holds handlers pointing at reloadable editor types, so it must not survive a reload; the + // [OnCodeLoaded] Initialize() below rebuilds it from the attributes on every load. + [AutoStaticsCleanupOnCodeReload] private static List kSRootEditor = new List(); [OnCodeLoaded] @@ -168,4 +171,3 @@ internal static void Rebuild() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/Implementations/ExposedReferenceDrawer.cs b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/Implementations/ExposedReferenceDrawer.cs index a6823b1fa4..76b2c438e4 100644 --- a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/Implementations/ExposedReferenceDrawer.cs +++ b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/Implementations/ExposedReferenceDrawer.cs @@ -19,10 +19,10 @@ abstract class BaseExposedPropertyDrawer : UnityEditor.PropertyDrawer protected static readonly string kClearExposedPropertyMsg = "Clear Exposed Property"; internal const string kVisualElementName = "ExposedReference"; - internal readonly GUIContent ExposePropertyContent = EditorGUIUtility.TrTextContent("Expose Property"); - internal readonly GUIContent UnexposePropertyContent = EditorGUIUtility.TrTextContent("Unexpose Property"); - protected readonly GUIContent NotFoundOn = EditorGUIUtility.TrTextContent("not found on"); - protected readonly GUIContent OverridenByContent = EditorGUIUtility.TrTextContent("Overridden by "); + internal readonly GUIContent ExposePropertyContent = L10n.TextContent("Expose Property", null, null, null); + internal readonly GUIContent UnexposePropertyContent = L10n.TextContent("Unexpose Property", null, null, null); + protected readonly GUIContent NotFoundOn = L10n.TextContent("not found on", null, null, null); + protected readonly GUIContent OverridenByContent = L10n.TextContent("Overridden by ", null, null, null); private GUIContent m_ModifiedLabel = new GUIContent(); diff --git a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/PropertyHandler.cs b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/PropertyHandler.cs index ae3379b4ac..6a2f7a3ee5 100644 --- a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/PropertyHandler.cs +++ b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/PropertyHandler.cs @@ -19,6 +19,9 @@ namespace UnityEditor internal partial class PropertyHandler : IDisposable { [AutoStaticsCleanupOnCodeReload] + // Reflection memo of a drawer type's default Object references: the miss path re-reads the fields and + // re-adds the entry, and it must be cleared so it does not hold the previous scope's types. + [IgnoreForUAL0015("Drawer default-reference reflection memo, re-read on the next miss")] readonly static Dictionary> s_DefaultObjectReferenceCache = new(); List m_PropertyDrawers; @@ -46,6 +49,9 @@ internal PropertyDrawer propertyDrawer bool isCurrentlyNested => m_NestingLevel > 0; [AutoStaticsCleanupOnCodeReload] + // Per-property list wrappers, re-created on the next miss while drawing; the dictionary is already + // cleared between inspector rebuilds, so an empty one just costs one recreate. + [IgnoreForUAL0015("Per-property list wrappers, re-created on the next draw after cleanup")] internal static Dictionary s_reorderableLists = new Dictionary(); [NoAutoStaticsCleanup] // transient inspector state counters, safe to persist static EntityId s_LastInspectionTarget; diff --git a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/ScriptAttributeUtility.cs b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/ScriptAttributeUtility.cs index 9093e5dcf8..610f3982e5 100644 --- a/Editor/Mono/Inspector/Core/ScriptAttributeGUI/ScriptAttributeUtility.cs +++ b/Editor/Mono/Inspector/Core/ScriptAttributeGUI/ScriptAttributeUtility.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using System.Reflection; @@ -34,28 +33,39 @@ public CustomPropertyDrawerContainer(Type drawerType, Type[] supportedRenderPipe } // Internal API members - [AutoStaticsCleanupOnCodeReload] // holds PropertyDrawer instances, which can be user-defined types + // Every cache below is keyed by, or holds, drawer and render-pipeline Types belonging to the + // current code-loaded scope, so each is cleared on reload and rebuilt by reflection on next use. + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Per-draw drawer stack, pushed and popped around each property draw")] internal static Stack s_DrawerStack = new Stack(); [NoAutoStaticsCleanup] private static Dictionary> s_BuiltinAttributes = null; - [AutoStaticsCleanupOnCodeReload] // keyed/valued by Type/FieldInfo, which can pin a user-script assembly + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Per-Type reflection memo, rebuilt on demand on the next miss")] static Dictionary> s_AutoLoadProperties; [NoAutoStaticsCleanup] private static PropertyHandler s_SharedNullHandler = new PropertyHandler(); - [AutoStaticsCleanupOnCodeReload] // reusable PropertyHandler scratch instance, can reference a user PropertyDrawer + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Scratch handler reused per property lookup and re-populated before each use")] private static PropertyHandler s_NextHandler = new PropertyHandler(); - [AutoStaticsCleanupOnCodeReload] // caches PropertyHandler instances, which can reference user PropertyDrawers + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Handler cache refilled on demand as properties are drawn")] private static PropertyHandlerCache s_GlobalCache = new PropertyHandlerCache(); - [AutoStaticsCleanupOnCodeReload] // caches PropertyHandler instances, which can reference user PropertyDrawers + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Points at whichever handler cache the current inspector pass is using")] private static PropertyHandlerCache s_CurrentCache = null; - [AutoStaticsCleanupOnCodeReload] // Lazy holder; values keyed by Type/CustomPropertyDrawerContainer.drawerType, which can be a user-defined type + // Replaced wholesale on cleanup so the next .Value re-runs BuildDrawerTypeForTypeDictionary. + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Lazy drawer table re-evaluated by BuildDrawerTypeForTypeDictionary on the next access")] static Lazy> k_DrawerTypeForType = new(BuildDrawerTypeForTypeDictionary); - [AutoStaticsCleanupOnCodeReload] // keyed/valued by Type, which can pin a user-script assembly; readonly removed per CS8785 - static Dictionary k_DrawerStaticTypesCache = new(); - [AutoStaticsCleanupOnCodeReload] // keyed/valued by Type, which can pin a user-script assembly; readonly removed per CS8785 - static Dictionary k_SupportedRenderPipelinesForSerializedObject = new(); + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Per-Type drawer memo, refilled on demand on the next miss")] + static readonly Dictionary k_DrawerStaticTypesCache = new(); + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Per-SerializedObject render-pipeline memo, refilled on demand on the next miss")] + static readonly Dictionary k_SupportedRenderPipelinesForSerializedObject = new(); [NoAutoStaticsCleanup] static readonly Comparer k_RenderPipelineTypeComparer @@ -68,7 +78,9 @@ static readonly Comparer k_RenderPipelineTypeComp }); - [AutoStaticsCleanupOnCodeReload] // caches a Type that can come from a user-defined render pipeline asset + // Holds render-pipeline asset Types from the current scope; re-derived by the property below. + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Re-derived from the active render pipeline by the currentRenderPipelineAssetTypeArray property")] static Type[] s_CurrentRenderPipelineAssetTypeArray; static Type[] currentRenderPipelineAssetTypeArray @@ -582,7 +594,10 @@ class FieldInfoCache public Type type; } - [AutoStaticsCleanupOnCodeReload] // FieldInfoCache holds FieldInfo/Type, which can pin a user-script assembly + // Caches FieldInfo and Type values belonging to the current code-loaded scope, so it is cleared on + // reload and refilled by GetFieldInfoFromPropertyPath on the next miss. + [AutoStaticsCleanupOnCodeReload] + [IgnoreForUAL0015("Per-property-path reflection memo, refilled on demand by GetFieldInfoFromPropertyPath")] static Dictionary s_FieldInfoFromPropertyPathCache = new Dictionary(); // Precompiled regexes used by GetFieldInfoFromPropertyPath on cache misses to avoid pattern parsing @@ -755,4 +770,3 @@ internal static List GetAutoLoadProperties(Type type) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs b/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs index 7bb4c5b21c..fbd6e4f9d3 100644 --- a/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs +++ b/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -242,4 +241,3 @@ public static void DrawAddedComponentBackground(Rect position, Object[] targets, } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs b/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs index 82b2178bd3..8896881052 100644 --- a/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs +++ b/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs @@ -53,6 +53,9 @@ public ObsoleteMessageContainer(string message, HelpBoxMessageType messageType, } [AutoStaticsCleanupOnCodeReload] // lazy cache of obsolete type messages, must reset on reload + // Lazy message cache: the lookup re-walks the obsolete types and refills the dictionary whenever it + // is null, so the next inspector draw rebuilds it. + [IgnoreForUAL0015("Lazy obsolete-message cache rebuilt on the next lookup after cleanup")] private static Dictionary s_ObsoleteTypeMessages; private static Type ResolveReplacementType(string typeName) diff --git a/Editor/Mono/Inspector/CubemapArrayInspector.cs b/Editor/Mono/Inspector/CubemapArrayInspector.cs index 82e7cc3316..d8b5854d5e 100644 --- a/Editor/Mono/Inspector/CubemapArrayInspector.cs +++ b/Editor/Mono/Inspector/CubemapArrayInspector.cs @@ -25,7 +25,7 @@ internal class CubemapArrayInspector : TextureInspector static class Styles { - public static readonly GUIContent slice = EditorGUIUtility.TrTextContent("Slice", "Displayed array slice"); + public static readonly GUIContent slice = L10n.TextContent("Slice", "Displayed array slice", null, null); public static readonly GUIStyle toolbarLabel = "toolbarLabel"; } diff --git a/Editor/Mono/Inspector/CubemapInspector.cs b/Editor/Mono/Inspector/CubemapInspector.cs index a8a11f2d1e..ce673895f5 100644 --- a/Editor/Mono/Inspector/CubemapInspector.cs +++ b/Editor/Mono/Inspector/CubemapInspector.cs @@ -27,7 +27,7 @@ internal static class Styles public static readonly int[] faceSizeOptionValues = { 16, 32, 64, 128, 256, 512, 1024, 2048 }; public static readonly string generateMipmapLabel = L10n.Tr("Generate Mipmap", null); - public static readonly GUIContent streamingMipmapLevelsContent = EditorGUIUtility.TrTextContent("Stream Mipmap Levels", "Don't load image data immediately but wait till image data is requested from script."); + public static readonly GUIContent streamingMipmapLevelsContent = L10n.TextContent("Stream Mipmap Levels", "Don't load image data immediately but wait till image data is requested from script.", null, null); public static readonly string linearLabel = L10n.Tr("Linear", null); diff --git a/Editor/Mono/Inspector/CubemapPreview.cs b/Editor/Mono/Inspector/CubemapPreview.cs index 7dcb2a260f..3c99591ec5 100644 --- a/Editor/Mono/Inspector/CubemapPreview.cs +++ b/Editor/Mono/Inspector/CubemapPreview.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Texture not yet converted using UnityEngine; namespace UnityEditor @@ -43,8 +42,8 @@ static class Styles public static readonly GUIStyle preLabel = "preLabel"; public static readonly GUIContent smallZoom = EditorGUIUtility.IconContent("PreTextureMipMapLow"); public static readonly GUIContent largeZoom = EditorGUIUtility.IconContent("PreTextureMipMapHigh"); - public static readonly GUIContent alphaIcon = EditorGUIUtility.TrIconContent("PreTextureAlpha", "Displaying RGB channels. Click to show alpha channel."); - public static readonly GUIContent RGBIcon = EditorGUIUtility.TrIconContent("PreTextureRGB", "Displaying alpha channel. Click to show RGB channels."); + public static readonly GUIContent alphaIcon = L10n.IconContent("PreTextureAlpha", "Displaying RGB channels. Click to show alpha channel.", null); + public static readonly GUIContent RGBIcon = L10n.IconContent("PreTextureRGB", "Displaying alpha channel. Click to show RGB channels.", null); } public void OnDisable() @@ -190,4 +189,3 @@ private void RenderCubemap(Texture t, Vector2 previewDir, float previewDistance, } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/CustomRenderTextureEditor.cs b/Editor/Mono/Inspector/CustomRenderTextureEditor.cs index 76c47691c0..3679392019 100644 --- a/Editor/Mono/Inspector/CustomRenderTextureEditor.cs +++ b/Editor/Mono/Inspector/CustomRenderTextureEditor.cs @@ -18,34 +18,34 @@ internal class CustomRenderTextureEditor : RenderTextureEditor { private class Styles { - public readonly GUIContent shaderPass = EditorGUIUtility.TrTextContent("Shader Pass", "Shader Pass used to update the Custom Render Texture."); - public readonly GUIContent needSwap = EditorGUIUtility.TrTextContent("Swap (Double Buffer)", "If ticked, and if the texture is double buffered, a request is made to swap the buffers before the next update. If this is not ticked, the buffers will not be swapped."); - public readonly GUIContent updateMode = EditorGUIUtility.TrTextContent("Update Mode", "Specify how the texture should be updated."); - public readonly GUIContent updatePeriod = EditorGUIUtility.TrTextContent("Period", "Period in seconds at which real-time textures are updated (0.0 will update every frame)."); - public readonly GUIContent doubleBuffered = EditorGUIUtility.TrTextContent("Double Buffered", "If ticked, the Custom Render Texture is double buffered so that you can access it during its own update. If unticked, the Custom Render Texture will be not be double buffered."); - public readonly GUIContent initializationMode = EditorGUIUtility.TrTextContent("Initialization Mode", "Specify how the texture should be initialized."); - public readonly GUIContent initSource = EditorGUIUtility.TrTextContent("Source", "Specify if the texture is initialized by a Material or by a Texture and a Color."); - public readonly GUIContent initColor = EditorGUIUtility.TrTextContent("Color", "Color with which the Custom Render Texture is initialized."); - public readonly GUIContent initTexture = EditorGUIUtility.TrTextContent("Texture", "Texture with which the Custom Render Texture is initialized (multiplied by the initialization color)."); - public readonly GUIContent initMaterial = EditorGUIUtility.TrTextContent("Material", "Material with which the Custom Render Texture is initialized."); - public readonly GUIContent updateZoneSpace = EditorGUIUtility.TrTextContent("Update Zone Space", "Space in which the update zones are expressed (Normalized or Pixel space)."); - public readonly GUIContent updateZoneList = EditorGUIUtility.TrTextContent("Update Zones", "List of partial update zones."); - public readonly GUIContent cubemapFacesLabel = EditorGUIUtility.TrTextContent("Cubemap Faces", "Enable or disable rendering on each face of the cubemap."); - public readonly GUIContent updateZoneCenter = EditorGUIUtility.TrTextContent("Center", "Center of the partial update zone."); - public readonly GUIContent updateZoneSize = EditorGUIUtility.TrTextContent("Size", "Size of the partial update zone."); - public readonly GUIContent updateZoneRotation = EditorGUIUtility.TrTextContent("Rotation", "Rotation of the update zone."); - public readonly GUIContent wrapUpdateZones = EditorGUIUtility.TrTextContent("Wrap Update Zones", "If ticked, Update zones will wrap around the border of the Custom Render Texture. If unticked, Update zones will be clamped at the border of the Custom Render Texture."); - - public readonly GUIContent[] updateModeStrings = { EditorGUIUtility.TrTextContent("On Load"), EditorGUIUtility.TrTextContent("Realtime"), EditorGUIUtility.TrTextContent("On Demand") }; + public readonly GUIContent shaderPass = L10n.TextContent("Shader Pass", "Shader Pass used to update the Custom Render Texture.", null, null); + public readonly GUIContent needSwap = L10n.TextContent("Swap (Double Buffer)", "If ticked, and if the texture is double buffered, a request is made to swap the buffers before the next update. If this is not ticked, the buffers will not be swapped.", null, null); + public readonly GUIContent updateMode = L10n.TextContent("Update Mode", "Specify how the texture should be updated.", null, null); + public readonly GUIContent updatePeriod = L10n.TextContent("Period", "Period in seconds at which real-time textures are updated (0.0 will update every frame).", null, null); + public readonly GUIContent doubleBuffered = L10n.TextContent("Double Buffered", "If ticked, the Custom Render Texture is double buffered so that you can access it during its own update. If unticked, the Custom Render Texture will be not be double buffered.", null, null); + public readonly GUIContent initializationMode = L10n.TextContent("Initialization Mode", "Specify how the texture should be initialized.", null, null); + public readonly GUIContent initSource = L10n.TextContent("Source", "Specify if the texture is initialized by a Material or by a Texture and a Color.", null, null); + public readonly GUIContent initColor = L10n.TextContent("Color", "Color with which the Custom Render Texture is initialized.", null, null); + public readonly GUIContent initTexture = L10n.TextContent("Texture", "Texture with which the Custom Render Texture is initialized (multiplied by the initialization color).", null, null); + public readonly GUIContent initMaterial = L10n.TextContent("Material", "Material with which the Custom Render Texture is initialized.", null, null); + public readonly GUIContent updateZoneSpace = L10n.TextContent("Update Zone Space", "Space in which the update zones are expressed (Normalized or Pixel space).", null, null); + public readonly GUIContent updateZoneList = L10n.TextContent("Update Zones", "List of partial update zones.", null, null); + public readonly GUIContent cubemapFacesLabel = L10n.TextContent("Cubemap Faces", "Enable or disable rendering on each face of the cubemap.", null, null); + public readonly GUIContent updateZoneCenter = L10n.TextContent("Center", "Center of the partial update zone.", null, null); + public readonly GUIContent updateZoneSize = L10n.TextContent("Size", "Size of the partial update zone.", null, null); + public readonly GUIContent updateZoneRotation = L10n.TextContent("Rotation", "Rotation of the update zone.", null, null); + public readonly GUIContent wrapUpdateZones = L10n.TextContent("Wrap Update Zones", "If ticked, Update zones will wrap around the border of the Custom Render Texture. If unticked, Update zones will be clamped at the border of the Custom Render Texture.", null, null); + + public readonly GUIContent[] updateModeStrings = { L10n.TextContent("On Load", null, null, null), L10n.TextContent("Realtime", null, null, null), L10n.TextContent("On Demand", null, null, null) }; public readonly int[] updateModeValues = { (int)CustomRenderTextureUpdateMode.OnLoad, (int)CustomRenderTextureUpdateMode.Realtime, (int)CustomRenderTextureUpdateMode.OnDemand }; - public readonly GUIContent[] initSourceStrings = { EditorGUIUtility.TrTextContent("Texture and Color"), EditorGUIUtility.TrTextContent("Material") }; + public readonly GUIContent[] initSourceStrings = { L10n.TextContent("Texture and Color", null, null, null), L10n.TextContent("Material", null, null, null) }; public readonly int[] initSourceValues = { (int)CustomRenderTextureInitializationSource.TextureAndColor, (int)CustomRenderTextureInitializationSource.Material }; - public readonly GUIContent[] updateZoneSpaceStrings = { EditorGUIUtility.TrTextContent("Normalized"), EditorGUIUtility.TrTextContent("Pixel") }; + public readonly GUIContent[] updateZoneSpaceStrings = { L10n.TextContent("Normalized", null, null, null), L10n.TextContent("Pixel", null, null, null) }; public readonly int[] updateZoneSpaceValues = { (int)CustomRenderTextureUpdateZoneSpace.Normalized, (int)CustomRenderTextureUpdateZoneSpace.Pixel }; - public readonly GUIContent[] cubemapFaces = { EditorGUIUtility.TextContent("+X"), EditorGUIUtility.TextContent("-X"), EditorGUIUtility.TextContent("+Y"), EditorGUIUtility.TextContent("-Y"), EditorGUIUtility.TrTextContent("+Z"), EditorGUIUtility.TrTextContent("-Z") }; + public readonly GUIContent[] cubemapFaces = { EditorGUIUtility.TextContent("+X"), EditorGUIUtility.TextContent("-X"), EditorGUIUtility.TextContent("+Y"), EditorGUIUtility.TextContent("-Y"), L10n.TextContent("+Z", null, null, null), L10n.TextContent("-Z", null, null, null) }; } [NoAutoStaticsCleanup] // GUIContent/int-array-only lazy Styles cache; contents survive code reload diff --git a/Editor/Mono/Inspector/DirectorEditor.cs b/Editor/Mono/Inspector/DirectorEditor.cs index d1bb333210..fa4e927ca8 100644 --- a/Editor/Mono/Inspector/DirectorEditor.cs +++ b/Editor/Mono/Inspector/DirectorEditor.cs @@ -18,15 +18,15 @@ internal class DirectorEditor : Editor { private static class Styles { - public static readonly GUIContent PlayableText = EditorGUIUtility.TrTextContent("Playable"); - public static readonly GUIContent InitialTimeContent = EditorGUIUtility.TrTextContent("Initial Time", "The time at which the Playable will begin playing"); - public static readonly GUIContent TimeContent = EditorGUIUtility.TrTextContent("Current Time", "The current Playable time"); - public static readonly GUIContent InitialStateContent = EditorGUIUtility.TrTextContent("Play On Awake", "Whether the Playable should be playing after it loads"); - public static readonly GUIContent UpdateMethod = EditorGUIUtility.TrTextContent("Update Method", "Controls how the Playable updates every frame"); - public static readonly GUIContent WrapModeContent = EditorGUIUtility.TrTextContent("Wrap Mode", "Controls the behaviour of evaluating the Playable outside its duration"); - public static readonly GUIContent NoBindingsContent = EditorGUIUtility.TrTextContent("This channel will not playback because it is not currently assigned"); - public static readonly GUIContent BindingsTitleContent = EditorGUIUtility.TrTextContent("Bindings"); - public static readonly GUIContent ClearUnused = EditorGUIUtility.TrTextContent("Show Unused", "A PlayableDirector may contain bindings to objects not referenced by the assigned Playable file.\nToggle this field to show them.\n It is recommended to remove unused bound objects if their Playable will be no longer used by this PlayableDirector."); + public static readonly GUIContent PlayableText = L10n.TextContent("Playable", null, null, null); + public static readonly GUIContent InitialTimeContent = L10n.TextContent("Initial Time", "The time at which the Playable will begin playing", null, null); + public static readonly GUIContent TimeContent = L10n.TextContent("Current Time", "The current Playable time", null, null); + public static readonly GUIContent InitialStateContent = L10n.TextContent("Play On Awake", "Whether the Playable should be playing after it loads", null, null); + public static readonly GUIContent UpdateMethod = L10n.TextContent("Update Method", "Controls how the Playable updates every frame", null, null); + public static readonly GUIContent WrapModeContent = L10n.TextContent("Wrap Mode", "Controls the behaviour of evaluating the Playable outside its duration", null, null); + public static readonly GUIContent NoBindingsContent = L10n.TextContent("This channel will not playback because it is not currently assigned", null, null, null); + public static readonly GUIContent BindingsTitleContent = L10n.TextContent("Bindings", null, null, null); + public static readonly GUIContent ClearUnused = L10n.TextContent("Show Unused", "A PlayableDirector may contain bindings to objects not referenced by the assigned Playable file.\nToggle this field to show them.\n It is recommended to remove unused bound objects if their Playable will be no longer used by this PlayableDirector.", null, null); } private static readonly int ObjectFieldControlID = "s_ObjectFieldHash".GetHashCode(); diff --git a/Editor/Mono/Inspector/Editor.cs b/Editor/Mono/Inspector/Editor.cs index 842f643cdf..532144259f 100644 --- a/Editor/Mono/Inspector/Editor.cs +++ b/Editor/Mono/Inspector/Editor.cs @@ -531,7 +531,7 @@ internal PropertyHandlerCache propertyHandlerCache static class BaseStyles { - public static readonly GUIContent open = EditorGUIUtility.TrTextContent("Open"); + public static readonly GUIContent open = L10n.TextContent("Open", null, null, null); public static readonly GUIStyle inspectorBig = new GUIStyle(EditorStyles.inspectorBig); public static readonly GUIStyle centerStyle = new GUIStyle(); public static readonly GUIStyle postLargeHeaderBackground = "IN BigTitle Post"; diff --git a/Editor/Mono/Inspector/EditorSettingsInspector.cs b/Editor/Mono/Inspector/EditorSettingsInspector.cs index c1654b282c..237c573266 100644 --- a/Editor/Mono/Inspector/EditorSettingsInspector.cs +++ b/Editor/Mono/Inspector/EditorSettingsInspector.cs @@ -20,87 +20,87 @@ internal partial class EditorSettingsInspector : ProjectSettingsBaseEditor { class Content { - public static readonly GUIContent unityRemote = EditorGUIUtility.TrTextContent("Unity Remote"); - public static readonly GUIContent device = EditorGUIUtility.TrTextContent("Device"); - public static readonly GUIContent compression = EditorGUIUtility.TrTextContent("Compression"); - public static readonly GUIContent resolution = EditorGUIUtility.TrTextContent("Resolution"); - public static readonly GUIContent joystickSource = EditorGUIUtility.TrTextContent("Joystick Source"); - - public static readonly GUIContent mode = EditorGUIUtility.TrTextContent("Mode"); - public static readonly GUIContent parallelImport = EditorGUIUtility.TrTextContent("Parallel Import", "During an asset database refresh some asset imports can be performed in parallel in sub processes."); - public static readonly GUIContent parallelImportLearnMore = EditorGUIUtility.TrTextContent("Learn more...", "During an asset database refresh some asset imports can be performed in parallel in sub processes."); - public static readonly GUIContent desiredImportWorkerCountOverride = EditorGUIUtility.TrTextContent("Override Desired Worker Count", "Override the desired worker count specified in the preferences."); - public static readonly GUIContent desiredImportWorkerCount = EditorGUIUtility.TrTextContent("Desired Import Worker Count", "The desired number of import worker processes to use for importing. The actual number of worker processes on the system can be both lower or higher that this, but the system will seek towards this number when importing."); - public static readonly GUIContent standbyImportWorkerCount = EditorGUIUtility.TrTextContent("Standby Import Worker Count", "The number of import worker processes to keep around in standby and ready for importing. The actual number of worker processes on the system can be both lower or higher that this, but the system will seek towards this number when worker processes are idle."); - public static readonly GUIContent idleWorkerShutdownDelay = EditorGUIUtility.TrTextContent("Idle Import Worker Shutdown Delay", "When an importer worker has been idle for this amount of seconds in will be shutdown unless it would take the worker count below the standby worker count setting."); - - public static readonly GUIContent cacheServer = EditorGUIUtility.TrTextContent("Accelerator Cache Server (project specific)"); - public static readonly GUIContent checkConnection = EditorGUIUtility.TrTextContent("Check Connection"); - public static readonly GUIContent assetPipeline = EditorGUIUtility.TrTextContent("Asset Pipeline"); - public static readonly GUIContent artifactGarbageCollection = EditorGUIUtility.TrTextContent("Remove unused Artifacts on Restart", "By default, when you start the Editor, Unity removes unused artifact files in the Library folder, and removes their entries in the asset database. This is a form of \"garbage collection\". This setting allows you to turn off the asset database garbage collection, so that previous artifact revisions which are no longer used are still preserved after restarting the Editor. This is useful if you need to debug unexpected import results."); - public static readonly GUIContent cacheServerIPLabel = EditorGUIUtility.TrTextContent("IP address"); - public static readonly GUIContent cacheServerNamespacePrefixLabel = EditorGUIUtility.TrTextContent("Namespace prefix", "The namespace used for looking up and storing values on the cache server"); - public static readonly GUIContent cacheServerEnableImportResultCachingLabel = EditorGUIUtility.TrTextContent("Import Result Caching", "Enables import result caching on the cache server."); - public static readonly GUIContent cacheServerEnableDownloadLabel = EditorGUIUtility.TrTextContent("Download", "Enables downloads from the cache server."); - public static readonly GUIContent cacheServerEnableUploadLabel = EditorGUIUtility.TrTextContent("Upload", "Enables uploads to the cache server."); - public static readonly GUIContent cacheServerEnableTlsLabel = EditorGUIUtility.TrTextContent("TLS/SSL", "Enabled encryption on the cache server connection."); - public static readonly GUIContent cacheServerValidationLabel = EditorGUIUtility.TrTextContent("Content Validation"); - public static readonly GUIContent cacheServerDownloadBatchSizeLabel = EditorGUIUtility.TrTextContent("Download Batch Size"); + public static readonly GUIContent unityRemote = L10n.TextContent("Unity Remote", null, null, null); + public static readonly GUIContent device = L10n.TextContent("Device", null, null, null); + public static readonly GUIContent compression = L10n.TextContent("Compression", null, null, null); + public static readonly GUIContent resolution = L10n.TextContent("Resolution", null, null, null); + public static readonly GUIContent joystickSource = L10n.TextContent("Joystick Source", null, null, null); + + public static readonly GUIContent mode = L10n.TextContent("Mode", null, null, null); + public static readonly GUIContent parallelImport = L10n.TextContent("Parallel Import", "During an asset database refresh some asset imports can be performed in parallel in sub processes.", null, null); + public static readonly GUIContent parallelImportLearnMore = L10n.TextContent("Learn more...", "During an asset database refresh some asset imports can be performed in parallel in sub processes.", null, null); + public static readonly GUIContent desiredImportWorkerCountOverride = L10n.TextContent("Override Desired Worker Count", "Override the desired worker count specified in the preferences.", null, null); + public static readonly GUIContent desiredImportWorkerCount = L10n.TextContent("Desired Import Worker Count", $"The desired number of import worker processes to use for importing. The actual number of worker processes on the system can be either lower or higher than this, but the system will seek towards this number when importing. Accepted values range from {kMinWorkerCount} to {kMaxWorkerCount}.", null, null); + public static readonly GUIContent standbyImportWorkerCount = L10n.TextContent("Standby Import Worker Count", $"The number of import worker processes to keep around in standby and ready for importing. The actual number of worker processes on the system can be either lower or higher than this, but the system will seek towards this number when worker processes are idle. Accepted values range from {kMinWorkerCount} to the Desired Import Worker Count.", null, null); + public static readonly GUIContent idleWorkerShutdownDelay = L10n.TextContent("Idle Import Worker Shutdown Delay", "When an import worker has been idle for this amount of seconds it will be shut down, unless that would take the worker count below the standby worker count setting.", null, null); + + public static readonly GUIContent cacheServer = L10n.TextContent("Accelerator Cache Server (project specific)", null, null, null); + public static readonly GUIContent checkConnection = L10n.TextContent("Check Connection", null, null, null); + public static readonly GUIContent assetPipeline = L10n.TextContent("Asset Pipeline", null, null, null); + public static readonly GUIContent artifactGarbageCollection = L10n.TextContent("Remove unused Artifacts on Restart", "By default, when you start the Editor, Unity removes unused artifact files in the Library folder, and removes their entries in the asset database. This is a form of \"garbage collection\". This setting allows you to turn off the asset database garbage collection, so that previous artifact revisions which are no longer used are still preserved after restarting the Editor. This is useful if you need to debug unexpected import results.", null, null); + public static readonly GUIContent cacheServerIPLabel = L10n.TextContent("IP address", null, null, null); + public static readonly GUIContent cacheServerNamespacePrefixLabel = L10n.TextContent("Namespace prefix", "The namespace used for looking up and storing values on the cache server", null, null); + public static readonly GUIContent cacheServerEnableImportResultCachingLabel = L10n.TextContent("Import Result Caching", "Enables import result caching on the cache server.", null, null); + public static readonly GUIContent cacheServerEnableDownloadLabel = L10n.TextContent("Download", "Enables downloads from the cache server.", null, null); + public static readonly GUIContent cacheServerEnableUploadLabel = L10n.TextContent("Upload", "Enables uploads to the cache server.", null, null); + public static readonly GUIContent cacheServerEnableTlsLabel = L10n.TextContent("TLS/SSL", "Enabled encryption on the cache server connection.", null, null); + public static readonly GUIContent cacheServerValidationLabel = L10n.TextContent("Content Validation", null, null, null); + public static readonly GUIContent cacheServerDownloadBatchSizeLabel = L10n.TextContent("Download Batch Size", null, null, null); public static readonly GUIContent cacheServerLearnMore = new GUIContent("Learn more...", "Go to Unity Accelerator documentation."); - public static readonly GUIContent assetSerialization = EditorGUIUtility.TrTextContent("Asset Serialization"); - public static readonly GUIContent defaultBehaviorMode = EditorGUIUtility.TrTextContent("Default Behaviour Mode"); + public static readonly GUIContent assetSerialization = L10n.TextContent("Asset Serialization", null, null, null); + public static readonly GUIContent defaultBehaviorMode = L10n.TextContent("Default Behaviour Mode", null, null, null); - public static readonly GUIContent buildPipelineHeader = EditorGUIUtility.TrTextContent("Build Pipeline"); + public static readonly GUIContent buildPipelineHeader = L10n.TextContent("Build Pipeline", null, null, null); - public static readonly GUIContent sceneHandlingHeader = EditorGUIUtility.TrTextContent("Scene Handling"); - public static readonly GUIContent forceAssetUnloadAndGCOnSceneLoad = EditorGUIUtility.TrTextContent("Force Asset Unload & GC on Scene Load", "Force a managed heap garbage collection and unload unused assets after loading scenes in single mode in the Editor or exiting Prefab Mode. In complex projects, this can slow down performance. Disable this if you do not require class finalizers to run at the end of scene loading. Note that regular dynamic GC and unused asset unloading still occur when memory usage is high, but without this option, class finalizers might not run immediately after each scene load."); + public static readonly GUIContent sceneHandlingHeader = L10n.TextContent("Scene Handling", null, null, null); + public static readonly GUIContent forceAssetUnloadAndGCOnSceneLoad = L10n.TextContent("Force Asset Unload & GC on Scene Load", "Force a managed heap garbage collection and unload unused assets after loading scenes in single mode in the Editor or exiting Prefab Mode. In complex projects, this can slow down performance. Disable this if you do not require class finalizers to run at the end of scene loading. Note that regular dynamic GC and unused asset unloading still occur when memory usage is high, but without this option, class finalizers might not run immediately after each scene load.", null, null); - public static readonly GUIContent graphics = EditorGUIUtility.TrTextContent("Graphics"); - public static readonly GUIContent showLightmapResolutionOverlay = EditorGUIUtility.TrTextContent("Show Lightmap Resolution Overlay"); - public static readonly GUIContent useLegacyProbeSampleCount = EditorGUIUtility.TrTextContent("Use legacy Light Probe sample counts", "Uses fixed Light Probe sample counts for baking with the Progressive Lightmapper. The sample counts are: 64 direct samples, 2048 indirect samples and 2048 environment samples."); + public static readonly GUIContent graphics = L10n.TextContent("Graphics", null, null, null); + public static readonly GUIContent showLightmapResolutionOverlay = L10n.TextContent("Show Lightmap Resolution Overlay", null, null, null); + public static readonly GUIContent useLegacyProbeSampleCount = L10n.TextContent("Use legacy Light Probe sample counts", "Uses fixed Light Probe sample counts for baking with the Progressive Lightmapper. The sample counts are: 64 direct samples, 2048 indirect samples and 2048 environment samples.", null, null); - public static readonly GUIContent spritePacker = EditorGUIUtility.TrTextContent("Sprite Atlas"); - public static readonly GUIContent spriteMaxCacheSize = EditorGUIUtility.TrTextContent("Max SpriteAtlas Cache Size (GB)", "The size of the Sprite Atlas Cache folder will be kept below this maximum value when possible. Change requires Editor restart."); + public static readonly GUIContent spritePacker = L10n.TextContent("Sprite Atlas", null, null, null); + public static readonly GUIContent spriteMaxCacheSize = L10n.TextContent("Max SpriteAtlas Cache Size (GB)", "The size of the Sprite Atlas Cache folder will be kept below this maximum value when possible. Change requires Editor restart.", null, null); - public static readonly GUIContent cSharpProjectGeneration = EditorGUIUtility.TrTextContent("C# Project Generation"); - public static readonly GUIContent additionalExtensionsToInclude = EditorGUIUtility.TrTextContent("Additional extensions to include"); - public static readonly GUIContent rootNamespace = EditorGUIUtility.TrTextContent("Root namespace"); + public static readonly GUIContent cSharpProjectGeneration = L10n.TextContent("C# Project Generation", null, null, null); + public static readonly GUIContent additionalExtensionsToInclude = L10n.TextContent("Additional extensions to include", null, null, null); + public static readonly GUIContent rootNamespace = L10n.TextContent("Root namespace", null, null, null); - public static readonly GUIContent scriptCompilation = EditorGUIUtility.TrTextContent("Script Compilation"); - public static readonly GUIContent enableMSBuildCompilationPipeline = EditorGUIUtility.TrTextContent("Enable MSBuild Compilation (Experimental)", "Enable MSBuild compilation for script assemblies. Modification requires a restart of the Editor."); + public static readonly GUIContent scriptCompilation = L10n.TextContent("Script Compilation", null, null, null); + public static readonly GUIContent enableMSBuildCompilationPipeline = L10n.TextContent("Enable MSBuild Compilation (Experimental)", "Enable MSBuild compilation for script assemblies. Modification requires a restart of the Editor.", null, null); - public static readonly GUIContent textureCompressors = EditorGUIUtility.TrTextContent("Texture Compressors"); - public static readonly GUIContent bc7Compressor = EditorGUIUtility.TrTextContent("BC7 Compressor", "Compressor to use for BC7 format texture compression"); - public static readonly GUIContent etcCompressor = EditorGUIUtility.TrTextContent("ETC Compressor", "Compressors to use for ETC/ETC2/EAC format texture compression"); - public static readonly GUIContent fast = EditorGUIUtility.TrTextContent("Fast"); - public static readonly GUIContent normal = EditorGUIUtility.TrTextContent("Normal"); - public static readonly GUIContent best = EditorGUIUtility.TrTextContent("Best"); + public static readonly GUIContent textureCompressors = L10n.TextContent("Texture Compressors", null, null, null); + public static readonly GUIContent bc7Compressor = L10n.TextContent("BC7 Compressor", "Compressor to use for BC7 format texture compression", null, null); + public static readonly GUIContent etcCompressor = L10n.TextContent("ETC Compressor", "Compressors to use for ETC/ETC2/EAC format texture compression", null, null); + public static readonly GUIContent fast = L10n.TextContent("Fast", null, null, null); + public static readonly GUIContent normal = L10n.TextContent("Normal", null, null, null); + public static readonly GUIContent best = L10n.TextContent("Best", null, null, null); - public static readonly GUIContent lineEndingForNewScripts = EditorGUIUtility.TrTextContent("Line Endings For New Scripts"); + public static readonly GUIContent lineEndingForNewScripts = L10n.TextContent("Line Endings For New Scripts", null, null, null); - public static readonly GUIContent streamingSettings = EditorGUIUtility.TrTextContent("Texture Streaming Settings"); - public static readonly GUIContent enablePlayModeTextureStreaming = EditorGUIUtility.TrTextContent("Enable Mipmap Streaming In Play Mode", "Texture Mipmap Streaming must be enabled in Quality Settings for mipmap streaming to function in Play Mode. This reduces GPU memory by streaming mips in and out as needed."); - public static readonly GUIContent enableEditModeTextureStreaming = EditorGUIUtility.TrTextContent("Enable Mipmap Streaming In Edit Mode", "Texture Mipmap Streaming must be enabled in Quality Settings for mipmap streaming to function in Edit Mode. This reduces GPU memory by streaming mips in and out as needed."); - public static readonly GUIContent enableEditorAsyncCPUTextureLoading = EditorGUIUtility.TrTextContent("Load texture data on demand", "While in Editor, load CPU side texture data for streaming textures from disk asynchronously on demand (will avoid some stalls and reduce CPU memory usage). Change requires Editor restart."); + public static readonly GUIContent streamingSettings = L10n.TextContent("Texture Streaming Settings", null, null, null); + public static readonly GUIContent enablePlayModeTextureStreaming = L10n.TextContent("Enable Mipmap Streaming In Play Mode", "Texture Mipmap Streaming must be enabled in Quality Settings for mipmap streaming to function in Play Mode. This reduces GPU memory by streaming mips in and out as needed.", null, null); + public static readonly GUIContent enableEditModeTextureStreaming = L10n.TextContent("Enable Mipmap Streaming In Edit Mode", "Texture Mipmap Streaming must be enabled in Quality Settings for mipmap streaming to function in Edit Mode. This reduces GPU memory by streaming mips in and out as needed.", null, null); + public static readonly GUIContent enableEditorAsyncCPUTextureLoading = L10n.TextContent("Load texture data on demand", "While in Editor, load CPU side texture data for streaming textures from disk asynchronously on demand (will avoid some stalls and reduce CPU memory usage). Change requires Editor restart.", null, null); - public static readonly GUIContent shaders = EditorGUIUtility.TrTextContent("Shaders"); - public static readonly GUIContent asyncShaderCompilation = EditorGUIUtility.TrTextContent("Asynchronous Shader Compilation", "Enables async shader compilation in Game and Scene view. Async compilation for custom editor tools can be achieved via script API and is not affected by this option."); + public static readonly GUIContent shaders = L10n.TextContent("Shaders", null, null, null); + public static readonly GUIContent asyncShaderCompilation = L10n.TextContent("Asynchronous Shader Compilation", "Enables async shader compilation in Game and Scene view. Async compilation for custom editor tools can be achieved via script API and is not affected by this option.", null, null); - public static readonly GUIContent prefabMode = EditorGUIUtility.TrTextContent("Prefab Mode"); - public static readonly GUIContent prefabModeAllowAutoSave = EditorGUIUtility.TrTextContent("Allow Auto Save", "When enabled, an Auto Save toggle is displayed in Prefab Mode which you can turn on or off. This is the default. When disabled, there is no Auto Save in Prefab Mode in this project and the toggle is not displayed."); - public static readonly GUIContent prefabModeEditingEnvironments = EditorGUIUtility.TrTextContent("Editing Environments"); - public static readonly GUIContent prefabModeRegularEnvironment = EditorGUIUtility.TrTextContent("Regular Environment"); - public static readonly GUIContent prefabModeUIEnvironment = EditorGUIUtility.TrTextContent("UI Environment"); + public static readonly GUIContent prefabMode = L10n.TextContent("Prefab Mode", null, null, null); + public static readonly GUIContent prefabModeAllowAutoSave = L10n.TextContent("Allow Auto Save", "When enabled, an Auto Save toggle is displayed in Prefab Mode which you can turn on or off. This is the default. When disabled, there is no Auto Save in Prefab Mode in this project and the toggle is not displayed.", null, null); + public static readonly GUIContent prefabModeEditingEnvironments = L10n.TextContent("Editing Environments", null, null, null); + public static readonly GUIContent prefabModeRegularEnvironment = L10n.TextContent("Regular Environment", null, null, null); + public static readonly GUIContent prefabModeUIEnvironment = L10n.TextContent("UI Environment", null, null, null); - public static readonly GUIContent enterPlayModeSettings = EditorGUIUtility.TrTextContent("Enter Play Mode Settings"); - public static readonly GUIContent enterPlayModeOptions = EditorGUIUtility.TrTextContent("When entering Play Mode", "Reload options when entering Play Mode."); + public static readonly GUIContent enterPlayModeSettings = L10n.TextContent("Enter Play Mode Settings", null, null, null); + public static readonly GUIContent enterPlayModeOptions = L10n.TextContent("When entering Play Mode", "Reload options when entering Play Mode.", null, null); public static readonly GUIContent[] enterPlayModeOptionNames = { - EditorGUIUtility.TrTextContent("Reload Domain and Scene"), // Default - EditorGUIUtility.TrTextContent("Reload Scene only"), - EditorGUIUtility.TrTextContent("Reload Domain only"), - EditorGUIUtility.TrTextContent("Do not reload Domain or Scene") + L10n.TextContent("Reload Domain and Scene", null, null, null), // Default + L10n.TextContent("Reload Scene only", null, null, null), + L10n.TextContent("Reload Domain only", null, null, null), + L10n.TextContent("Do not reload Domain or Scene", null, null, null) }; public static readonly int[] enterPlayModeOptionValues = { @@ -110,16 +110,16 @@ class Content (int)(EnterPlayModeOptions.DisableDomainReload | EnterPlayModeOptions.DisableSceneReload) }; - public static readonly GUIContent numberingScheme = EditorGUIUtility.TrTextContent("Numbering Scheme"); + public static readonly GUIContent numberingScheme = L10n.TextContent("Numbering Scheme", null, null, null); - public static readonly GUIContent inspectorSettings = EditorGUIUtility.TrTextContent("Inspector"); - public static readonly GUIContent inspectorUseIMGUIDefaultInspector = EditorGUIUtility.TrTextContent("Use IMGUI Default Inspector", "Revert to using IMGUI to generate Default Inspectors where no custom Inspector/Editor was defined."); + public static readonly GUIContent inspectorSettings = L10n.TextContent("Inspector", null, null, null); + public static readonly GUIContent inspectorUseIMGUIDefaultInspector = L10n.TextContent("Use IMGUI Default Inspector", "Revert to using IMGUI to generate Default Inspectors where no custom Inspector/Editor was defined.", null, null); public static readonly GUIContent[] numberingSchemeNames = { - EditorGUIUtility.TrTextContent("Prefab (1)", "Number in parentheses"), - EditorGUIUtility.TrTextContent("Prefab.1", "Number after dot"), - EditorGUIUtility.TrTextContent("Prefab_1", "Number after underscore") + L10n.TextContent("Prefab (1)", "Number in parentheses", null, null), + L10n.TextContent("Prefab.1", "Number after dot", null, null), + L10n.TextContent("Prefab_1", "Number after underscore", null, null) }; public static readonly int[] numberingSchemeValues = { @@ -127,17 +127,17 @@ class Content (int)EditorSettings.NamingScheme.Dot, (int)EditorSettings.NamingScheme.Underscore }; - public static readonly GUIContent numberingHierarchyScheme = EditorGUIUtility.TrTextContent("Game Object Naming"); - public static readonly GUIContent numberingHierarchyDigits = EditorGUIUtility.TrTextContent("Game Object Digits"); + public static readonly GUIContent numberingHierarchyScheme = L10n.TextContent("Game Object Naming", null, null, null); + public static readonly GUIContent numberingHierarchyDigits = L10n.TextContent("Game Object Digits", null, null, null); - public static readonly GUIContent hierarchy = EditorGUIUtility.TrTextContent("Hierarchy"); - public static readonly GUIContent useLegacyHierarchy = EditorGUIUtility.TrTextContent("Use Legacy Hierarchy", "Use the legacy Hierarchy window."); - public static readonly GUIContent numberingProjectSpace = EditorGUIUtility.TrTextContent("Space Before Number in Asset Names"); + public static readonly GUIContent hierarchy = L10n.TextContent("Hierarchy", null, null, null); + public static readonly GUIContent useLegacyHierarchy = L10n.TextContent("Use Legacy Hierarchy", "Use the legacy Hierarchy window.", null, null); + public static readonly GUIContent numberingProjectSpace = L10n.TextContent("Space Before Number in Asset Names", null, null, null); - public static readonly GUIContent referencedClipsExactNaming = EditorGUIUtility.TrTextContent("Exactly Match Referenced Clip Names", "Controls how referenced clips are matched with models that are animated in Legacy mode. If turned on, the model name and the referenced clip names must exactly match. If turned off, only the start of the model name needs to match the referenced clip name. Also controls the behavior of the \"Update referenced clips\" button for models that are animated in Humanoid mode. See the documentation for EditorSettings.referencedClipsExactNaming for more details."); + public static readonly GUIContent referencedClipsExactNaming = L10n.TextContent("Exactly Match Referenced Clip Names", "Controls how referenced clips are matched with models that are animated in Legacy mode. If turned on, the model name and the referenced clip names must exactly match. If turned off, only the start of the model name needs to match the referenced clip name. Also controls the behavior of the \"Update referenced clips\" button for models that are animated in Humanoid mode. See the documentation for EditorSettings.referencedClipsExactNaming for more details.", null, null); - public static readonly GUIContent buildProfileSettings = EditorGUIUtility.TrTextContent("Build Profiles"); - public static readonly GUIContent buildProfileClassicPlatforms = EditorGUIUtility.TrTextContent("Hide Classic Platforms"); + public static readonly GUIContent buildProfileSettings = L10n.TextContent("Build Profiles", null, null, null); + public static readonly GUIContent buildProfileClassicPlatforms = L10n.TextContent("Hide Classic Platforms", null, null, null); } internal struct PopupElement @@ -226,17 +226,17 @@ public PopupElement(string id, string content) private GUIContent[] cacheServerValidationPopupList = { - EditorGUIUtility.TrTextContent("Disabled", "Content hashes are not calculated for uploaded artifacts and are not validated for downloaded artifacts."), - EditorGUIUtility.TrTextContent("Upload Only", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes are not validated for downloaded artifacts." ), - EditorGUIUtility.TrTextContent("Enabled", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes, if provided by the Accelerator, are validated for downloaded artifacts."), - EditorGUIUtility.TrTextContent("Required", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes are required and validated for downloaded artifacts."), + L10n.TextContent("Disabled", "Content hashes are not calculated for uploaded artifacts and are not validated for downloaded artifacts.", null, null), + L10n.TextContent("Upload Only", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes are not validated for downloaded artifacts." , null, null), + L10n.TextContent("Enabled", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes, if provided by the Accelerator, are validated for downloaded artifacts.", null, null), + L10n.TextContent("Required", "Content hashes are calculated for uploaded artifacts and sent to the Accelerator. Content hashes are required and validated for downloaded artifacts.", null, null), }; private GUIContent[] bc7TextureCompressorOptions = { - EditorGUIUtility.TrTextContent("Default", "Use default BC7 compressor (currently bc7e)"), - EditorGUIUtility.TrTextContent("ISPC (legacy)", "Use Intel ISPCTextureCompressor (legacy pre-2021.2 behavior)"), - EditorGUIUtility.TrTextContent("bc7e", "Use Binomial bc7e compressor"), + L10n.TextContent("Default", "Use default BC7 compressor (currently bc7e)", null, null), + L10n.TextContent("ISPC (legacy)", "Use Intel ISPCTextureCompressor (legacy pre-2021.2 behavior)", null, null), + L10n.TextContent("bc7e", "Use Binomial bc7e compressor", null, null), }; private PopupElement[] etcTextureCompressorPopupList = @@ -305,6 +305,11 @@ public PopupElement(string id, string content) const string kIdleWorkerShutdownDelayKeyArgs = "-idleWorkerShutdownDelay"; const string kDesiredImportWorkerCountKeyArgs = "-desiredWorkerCount"; + // This min/max worker count is enforced here, in EditorUserSettings.cpp and in AssetDatabaseConfig.cpp. + // Please keep them in sync. + const int kMinWorkerCount = 1; + const int kMaxWorkerCount = 128; + private const string kCacheServerDownloadBatchSizeCmdArg = "-cacheServerDownloadBatchSize"; enum CacheServerConnectionState { Unknown, Success, Failure } @@ -678,19 +683,14 @@ private void DoAssetPipelineSettings() var overrideDesiredCount = GetCommandLineOverride(kDesiredImportWorkerCountKeyArgs); if (overrideDesiredCount != null) { - EditorGUILayout.HelpBox($"Desired import worker count forced to {overrideDesiredCount} via command line argument. To use the worker count specified here please restart Unity without the -desiredWorkerCount command line argument.", MessageType.Info, true); + EditorGUILayout.HelpBox($"Desired import worker count forced to {DescribeWorkerCountOverride(overrideDesiredCount)} via command line argument. To use the worker count specified here please restart Unity without the -desiredWorkerCount command line argument.", MessageType.Info, true); } - // This min/max worker count is enforced here and in EditorUserSettings.cpp - // Please keep them in sync. - const int minWorkerCount = 1; - const int maxWorkerCount = 128; - using (new EditorGUI.DisabledScope(overrideDesiredCount != null)) { var oldCount = EditorUserSettings.desiredImportWorkerCount; int newCount = EditorGUILayout.IntField(Content.desiredImportWorkerCount, oldCount); - newCount = Mathf.Clamp(newCount, minWorkerCount, maxWorkerCount); + newCount = Mathf.Clamp(newCount, kMinWorkerCount, kMaxWorkerCount); if (oldCount != newCount) { @@ -702,7 +702,7 @@ private void DoAssetPipelineSettings() var overrideStandbyCount = GetCommandLineOverride(kStandbyWorkerCountKeyArgs); if (overrideStandbyCount != null) { - EditorGUILayout.HelpBox($"Standby import worker count forced to {overrideStandbyCount} via command line argument. To use the standby worker count specified here please restart Unity without the -standbyWorkerCount command line argument.", MessageType.Info, true); + EditorGUILayout.HelpBox($"Standby import worker count forced to {DescribeWorkerCountOverride(overrideStandbyCount)} via command line argument. To use the standby worker count specified here please restart Unity without the -standbyWorkerCount command line argument.", MessageType.Info, true); } using (new EditorGUI.DisabledScope(overrideStandbyCount != null)) @@ -710,7 +710,7 @@ private void DoAssetPipelineSettings() var oldCount = EditorUserSettings.standbyImportWorkerCount; var newCount = EditorGUILayout.IntField(Content.standbyImportWorkerCount, oldCount); int desiredWorkerCount = EditorUserSettings.desiredImportWorkerCount; - newCount = Mathf.Clamp(newCount, 0, desiredWorkerCount); + newCount = Mathf.Clamp(newCount, kMinWorkerCount, desiredWorkerCount); if (oldCount != newCount) { @@ -948,6 +948,20 @@ private static string GetCommandLineOverride(string key) return address; } + // The command line value is clamped natively in AssetDatabaseConfig.cpp, so report the + // effective count rather than the raw argument. + private static string DescribeWorkerCountOverride(string rawValue) + { + if (!long.TryParse(rawValue, out var parsedValue)) + return rawValue; + + var clampedValue = (int)Math.Min(Math.Max(parsedValue, kMinWorkerCount), kMaxWorkerCount); + if (clampedValue == parsedValue) + return clampedValue.ToString(); + + return $"{clampedValue} (clamped from {rawValue}; the supported range is {kMinWorkerCount} to {kMaxWorkerCount})"; + } + private void DoLineEndingsSettings() { GUILayout.Space(10); diff --git a/Editor/Mono/Inspector/GameObjectInspector.cs b/Editor/Mono/Inspector/GameObjectInspector.cs index 6558d54fc8..79cff0eb02 100644 --- a/Editor/Mono/Inspector/GameObjectInspector.cs +++ b/Editor/Mono/Inspector/GameObjectInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -47,11 +46,11 @@ internal override void PostSerializedObjectCreation() static class Styles { public static readonly GUIContent typelessIcon = EditorGUIUtility.IconContent("Prefab Icon"); - public static readonly GUIContent overridesContent = EditorGUIUtility.TrTextContent("Overrides"); - public static readonly GUIContent staticContent = EditorGUIUtility.TrTextContent("Static", "Enable the checkbox to mark this GameObject as static for all systems.\n\nDisable the checkbox to mark this GameObject as not static for all systems.\n\nUse the drop-down menu to mark as this GameObject as static or not static for individual systems."); - public static readonly GUIContent layerContent = EditorGUIUtility.TrTextContent("Layer", "The layer that this GameObject is in.\n\nChoose Add Layer... to edit the list of available layers."); - public static readonly GUIContent tagContent = EditorGUIUtility.TrTextContent("Tag", "The tag that this GameObject has.\n\nChoose Untagged to remove the current tag.\n\nChoose Add Tag... to edit the list of available tags."); - public static readonly GUIContent staticPreviewContent = EditorGUIUtility.TrTextContent("Static Preview", "This asset is greater than 8MB so, by default, the Asset Preview displays a static preview.\nTo view the asset interactively, click the Asset Preview."); + public static readonly GUIContent overridesContent = L10n.TextContent("Overrides", null, null, null); + public static readonly GUIContent staticContent = L10n.TextContent("Static", "Enable the checkbox to mark this GameObject as static for all systems.\n\nDisable the checkbox to mark this GameObject as not static for all systems.\n\nUse the drop-down menu to mark as this GameObject as static or not static for individual systems.", null, null); + public static readonly GUIContent layerContent = L10n.TextContent("Layer", "The layer that this GameObject is in.\n\nChoose Add Layer... to edit the list of available layers.", null, null); + public static readonly GUIContent tagContent = L10n.TextContent("Tag", "The tag that this GameObject has.\n\nChoose Untagged to remove the current tag.\n\nChoose Add Tag... to edit the list of available tags.", null, null); + public static readonly GUIContent staticPreviewContent = L10n.TextContent("Static Preview", "This asset is greater than 8MB so, by default, the Asset Preview displays a static preview.\nTo view the asset interactively, click the Asset Preview.", null, null); public static readonly float tagFieldWidth = EditorGUI.CalcPrefixLabelWidth(Styles.tagContent, EditorStyles.boldLabel); public static readonly float layerFieldWidth = EditorGUI.CalcPrefixLabelWidth(Styles.layerContent, EditorStyles.boldLabel); @@ -62,18 +61,18 @@ static class Styles public static readonly GUIStyle overridesDropdown = new GUIStyle("MiniPullDown"); public static readonly GUIStyle prefabButtonsHorizontalLayout = new GUIStyle { fixedHeight = 17, margin = new RectOffset { top = 1, bottom = 1 } }; - public static readonly GUIContent goTypeLabelMultiple = EditorGUIUtility.TrTextContent("Multiple"); - private static readonly GUIContent regularPrefab = EditorGUIUtility.TrTextContent("Prefab"); - private static readonly GUIContent disconnectedPrefab = EditorGUIUtility.TrTextContent("Prefab", "You have broken the prefab connection. Changes to the prefab will not be applied to this object before you Apply or Revert."); - private static readonly GUIContent modelPrefab = EditorGUIUtility.TrTextContent("Prefab"); - private static readonly GUIContent disconnectedModelPrefab = EditorGUIUtility.TrTextContent("Prefab", "You have broken the prefab connection. Changes to the model will not be applied to this object before you Revert."); - private static readonly GUIContent variantPrefab = EditorGUIUtility.TrTextContent("Prefab"); - private static readonly GUIContent disconnectedVariantPrefab = EditorGUIUtility.TrTextContent("Prefab", "You have broken the prefab connection. Changes to the prefab will not be applied to this object before you Apply or Revert."); - private static readonly GUIContent missingPrefabAsset = EditorGUIUtility.TrTextContent("Prefab", "The source Prefab or Model has been deleted."); - public static readonly GUIContent openModel = EditorGUIUtility.TrTextContent("Open", "Open Model in external tool."); - public static readonly GUIContent openPrefab = EditorGUIUtility.TrTextContent("Open", "Open Prefab Asset '{0}'\nPress modifier key [Alt] to open in isolation."); - public static readonly GUIContent tooltipForObjectFieldForRootInPrefabContents = EditorGUIUtility.TrTextContent("", "Replacing the root Prefab instance in a Variant is not supported since it will break all overrides for existing instances of this Variant, including their positions and rotations."); - public static readonly GUIContent tooltipForObjectFieldForNestedPrefabs = EditorGUIUtility.TrTextContent("", "You can only replace outermost Prefab instances. Open Prefab Mode to replace a nested Prefab instance."); + public static readonly GUIContent goTypeLabelMultiple = L10n.TextContent("Multiple", null, null, null); + private static readonly GUIContent regularPrefab = L10n.TextContent("Prefab", null, null, null); + private static readonly GUIContent disconnectedPrefab = L10n.TextContent("Prefab", "You have broken the prefab connection. Changes to the prefab will not be applied to this object before you Apply or Revert.", null, null); + private static readonly GUIContent modelPrefab = L10n.TextContent("Prefab", null, null, null); + private static readonly GUIContent disconnectedModelPrefab = L10n.TextContent("Prefab", "You have broken the prefab connection. Changes to the model will not be applied to this object before you Revert.", null, null); + private static readonly GUIContent variantPrefab = L10n.TextContent("Prefab", null, null, null); + private static readonly GUIContent disconnectedVariantPrefab = L10n.TextContent("Prefab", "You have broken the prefab connection. Changes to the prefab will not be applied to this object before you Apply or Revert.", null, null); + private static readonly GUIContent missingPrefabAsset = L10n.TextContent("Prefab", "The source Prefab or Model has been deleted.", null, null); + public static readonly GUIContent openModel = L10n.TextContent("Open", "Open Model in external tool.", null, null); + public static readonly GUIContent openPrefab = L10n.TextContent("Open", "Open Prefab Asset '{0}'\nPress modifier key [Alt] to open in isolation.", null, null); + public static readonly GUIContent tooltipForObjectFieldForRootInPrefabContents = L10n.TextContent("", "Replacing the root Prefab instance in a Variant is not supported since it will break all overrides for existing instances of this Variant, including their positions and rotations.", null, null); + public static readonly GUIContent tooltipForObjectFieldForNestedPrefabs = L10n.TextContent("", "You can only replace outermost Prefab instances. Open Prefab Mode to replace a nested Prefab instance.", null, null); public static readonly string selectString = L10n.Tr("Select", null); public static readonly float kIconSize = 24; @@ -1507,4 +1506,3 @@ internal UnityObject GetMainAssetFromBrokenPrefabInstanceRoot(GameObject targetG } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/GraphicsSettingsInspector.cs b/Editor/Mono/Inspector/GraphicsSettingsInspector.cs index ae46d24494..b53f2c79e5 100644 --- a/Editor/Mono/Inspector/GraphicsSettingsInspector.cs +++ b/Editor/Mono/Inspector/GraphicsSettingsInspector.cs @@ -30,7 +30,7 @@ internal partial class GraphicsSettingsInspector : ProjectSettingsBaseEditor internal static class GraphicsSettingsData { internal static readonly GUIContent builtInWarningText = - EditorGUIUtility.TrTextContent("A Scriptable Render Pipeline is in use. Settings in the Built-In Render Pipeline are not currently in use."); + L10n.TextContent("A Scriptable Render Pipeline is in use. Settings in the Built-In Render Pipeline are not currently in use.", null, null, null); internal const string builtIn = "Built-In"; internal const string bodyTemplateBuiltInOnly = "UXML/ProjectSettings/GraphicsSettingsEditor-Builtin.uxml"; internal const string bodyTemplateSRP = "UXML/ProjectSettings/GraphicsSettingsEditor-SRP.uxml"; @@ -205,7 +205,7 @@ void BindShaderPreload(VisualElement root) shaderPreloadProperty.serializedObject.Update(); EditorGUI.BeginChangeCheck(); //for some reason, converting the display of this native array to UITK make MacOS crash when domain reload after user add a new script - EditorGUILayout.PropertyField(shaderPreloadProperty, EditorGUIUtility.TrTextContent("Preload Shaders")); + EditorGUILayout.PropertyField(shaderPreloadProperty, L10n.TextContent("Preload Shaders", null, null, null)); if (EditorGUI.EndChangeCheck()) { shaderPreloadProperty.serializedObject.ApplyModifiedProperties(); diff --git a/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorTierSettings.cs b/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorTierSettings.cs index f2d9f9abb9..3c271f9f44 100644 --- a/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorTierSettings.cs +++ b/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorTierSettings.cs @@ -80,73 +80,73 @@ internal partial class GraphicsSettingsInspectorTierSettings : GraphicsSettingsE internal class Styles { public static readonly GUIContent[] shaderQualityName = - { EditorGUIUtility.TrTextContent("Low"), EditorGUIUtility.TrTextContent("Medium"), EditorGUIUtility.TrTextContent("High") }; + { L10n.TextContent("Low", null, null, null), L10n.TextContent("Medium", null, null, null), L10n.TextContent("High", null, null, null) }; public static readonly int[] shaderQualityValue = { (int)ShaderQuality.Low, (int)ShaderQuality.Medium, (int)ShaderQuality.High }; public static readonly GUIContent[] renderingPathName = - { EditorGUIUtility.TrTextContent("Forward"), EditorGUIUtility.TrTextContent("Deferred"), EditorGUIUtility.TrTextContent("Legacy Vertex Lit") }; + { L10n.TextContent("Forward", null, null, null), L10n.TextContent("Deferred", null, null, null), L10n.TextContent("Legacy Vertex Lit", null, null, null) }; public static readonly int[] renderingPathValue = { (int)RenderingPath.Forward, (int)RenderingPath.DeferredShading, (int)RenderingPath.VertexLit }; public static readonly GUIContent[] hdrModeName = - { EditorGUIUtility.TrTextContent("FP16"), EditorGUIUtility.TrTextContent("R11G11B10") }; + { L10n.TextContent("FP16", null, null, null), L10n.TextContent("R11G11B10", null, null, null) }; public static readonly int[] hdrModeValue = { (int)CameraHDRMode.FP16, (int)CameraHDRMode.R11G11B10 }; public static readonly GUIContent[] realtimeGICPUUsageName = - { EditorGUIUtility.TrTextContent("Low"), EditorGUIUtility.TrTextContent("Medium"), EditorGUIUtility.TrTextContent("High"), EditorGUIUtility.TrTextContent("Unlimited") }; + { L10n.TextContent("Low", null, null, null), L10n.TextContent("Medium", null, null, null), L10n.TextContent("High", null, null, null), L10n.TextContent("Unlimited", null, null, null) }; public static readonly int[] realtimeGICPUUsageValue = { (int)RealtimeGICPUUsage.Low, (int)RealtimeGICPUUsage.Medium, (int)RealtimeGICPUUsage.High, (int)RealtimeGICPUUsage.Unlimited }; - public static readonly GUIContent showEditorWindow = EditorGUIUtility.TrTextContent("Open Editor..."); - public static readonly GUIContent closeEditorWindow = EditorGUIUtility.TrTextContent("Close Editor"); - public static readonly GUIContent tierSettings = EditorGUIUtility.TrTextContent("Tier Settings"); + public static readonly GUIContent showEditorWindow = L10n.TextContent("Open Editor...", null, null, null); + public static readonly GUIContent closeEditorWindow = L10n.TextContent("Close Editor", null, null, null); + public static readonly GUIContent tierSettings = L10n.TextContent("Tier Settings", null, null, null); public static readonly GUIContent[] tierName = { - EditorGUIUtility.TrTextContent("Low (Tier 1)"), EditorGUIUtility.TrTextContent("Medium (Tier 2)"), EditorGUIUtility.TrTextContent("High (Tier 3)") + L10n.TextContent("Low (Tier 1)", null, null, null), L10n.TextContent("Medium (Tier 2)", null, null, null), L10n.TextContent("High (Tier 3)", null, null, null) }; public static readonly GUIContent empty = EditorGUIUtility.TextContent(""); - public static readonly GUIContent autoSettingsLabel = EditorGUIUtility.TrTextContent("Use Defaults"); + public static readonly GUIContent autoSettingsLabel = L10n.TextContent("Use Defaults", null, null, null); - public static readonly GUIContent standardShaderSettings = EditorGUIUtility.TrTextContent("Standard Shader"); - public static readonly GUIContent renderingSettings = EditorGUIUtility.TrTextContent("Rendering"); + public static readonly GUIContent standardShaderSettings = L10n.TextContent("Standard Shader", null, null, null); + public static readonly GUIContent renderingSettings = L10n.TextContent("Rendering", null, null, null); - public static readonly GUIContent standardShaderQuality = EditorGUIUtility.TrTextContent("Standard Shader Quality"); + public static readonly GUIContent standardShaderQuality = L10n.TextContent("Standard Shader Quality", null, null, null); public static readonly GUIContent reflectionProbeBoxProjection = - EditorGUIUtility.TrTextContent("Reflection Probes Box Projection", "Enable projection for reflection UV mappings on Reflection Probes."); + L10n.TextContent("Reflection Probes Box Projection", "Enable projection for reflection UV mappings on Reflection Probes.", null, null); - public static readonly GUIContent reflectionProbeBlending = EditorGUIUtility.TrTextContent("Reflection Probes Blending", - "Gradually fade out one probe's cubemap while fading in the other's as the reflective object passes from one zone to the other."); + public static readonly GUIContent reflectionProbeBlending = L10n.TextContent("Reflection Probes Blending", + "Gradually fade out one probe's cubemap while fading in the other's as the reflective object passes from one zone to the other.", null, null); public static readonly GUIContent detailNormalMap = - EditorGUIUtility.TrTextContent("Detail Normal Map", "Enable Detail (secondary) Normal Map sampling for up-close viewing, if assigned."); + L10n.TextContent("Detail Normal Map", "Enable Detail (secondary) Normal Map sampling for up-close viewing, if assigned.", null, null); - public static readonly GUIContent cascadedShadowMaps = EditorGUIUtility.TrTextContent("Cascaded Shadows"); + public static readonly GUIContent cascadedShadowMaps = L10n.TextContent("Cascaded Shadows", null, null, null); public static readonly GUIContent prefer32BitShadowMaps = - EditorGUIUtility.TrTextContent("Prefer 32-bit shadow maps", "Enable 32-bit float shadow map when you are targeting PS4 or platforms using DX11 or DX12."); + L10n.TextContent("Prefer 32-bit shadow maps", "Enable 32-bit float shadow map when you are targeting PS4 or platforms using DX11 or DX12.", null, null); - public static readonly GUIContent semitransparentShadows = EditorGUIUtility.TrTextContent("Enable Semitransparent Shadows"); + public static readonly GUIContent semitransparentShadows = L10n.TextContent("Enable Semitransparent Shadows", null, null, null); public static readonly GUIContent enableLPPV = - EditorGUIUtility.TrTextContent("Enable Light Probe Proxy Volume", "Enable rendering a 3D grid of interpolated Light Probes inside a Bounding Volume."); + L10n.TextContent("Enable Light Probe Proxy Volume", "Enable rendering a 3D grid of interpolated Light Probes inside a Bounding Volume.", null, null); - public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Rendering Path", - "Choose how Unity should render graphics. Different rendering paths affect the performance of your game, and how lighting and shading are calculated."); + public static readonly GUIContent renderingPath = L10n.TextContent("Rendering Path", + "Choose how Unity should render graphics. Different rendering paths affect the performance of your game, and how lighting and shading are calculated.", null, null); - public static readonly GUIContent useHDR = EditorGUIUtility.TrTextContent("Use HDR", "Enable High Dynamic Range rendering for this tier."); - public static readonly GUIContent hdrMode = EditorGUIUtility.TrTextContent("HDR Mode", "Color render texture format for the HDR buffer to use when HDR is enabled."); + public static readonly GUIContent useHDR = L10n.TextContent("Use HDR", "Enable High Dynamic Range rendering for this tier.", null, null); + public static readonly GUIContent hdrMode = L10n.TextContent("HDR Mode", "Color render texture format for the HDR buffer to use when HDR is enabled.", null, null); - public static readonly GUIContent realtimeGICPUUsage = EditorGUIUtility.TrTextContent("Realtime Global Illumination CPU Usage", - "How many CPU worker threads to create for Realtime Global Illumination lighting calculations in the Player. Increasing this makes the system react faster to changes in lighting at a cost of using more CPU time. The higher the CPU Usage value, the more worker threads are created for solving Realtime GI."); + public static readonly GUIContent realtimeGICPUUsage = L10n.TextContent("Realtime Global Illumination CPU Usage", + "How many CPU worker threads to create for Realtime Global Illumination lighting calculations in the Player. Increasing this makes the system react faster to changes in lighting at a cost of using more CPU time. The higher the CPU Usage value, the more worker threads are created for solving Realtime GI.", null, null); } public override bool BuiltinOnly => true; diff --git a/Editor/Mono/Inspector/GraphicsSettingsInspectors/RenderPipelineGraphicsSettingsPropertyDrawer.cs b/Editor/Mono/Inspector/GraphicsSettingsInspectors/RenderPipelineGraphicsSettingsPropertyDrawer.cs index c4b3ea80c1..62f8426daa 100644 --- a/Editor/Mono/Inspector/GraphicsSettingsInspectors/RenderPipelineGraphicsSettingsPropertyDrawer.cs +++ b/Editor/Mono/Inspector/GraphicsSettingsInspectors/RenderPipelineGraphicsSettingsPropertyDrawer.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SRPSettings not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -207,6 +206,9 @@ public override int GetHashCode() [NoAutoStaticsCleanup] // transient scope flag, reset to false by EndScope each use static bool s_Scoped = false; [AutoStaticsCleanupOnCodeReload] + // Holds SerializedObjects for the current render-pipeline settings, so it must be dropped on + // reload; every caller null-checks it and calls RecomputeDictionary to rebuild it. + [IgnoreForUAL0015("Rebuilt by RecomputeDictionary whenever a caller finds it null")] static Dictionary s_SharedPreviousStates = null; [InitializeOnLoadMethod] @@ -375,4 +377,3 @@ void Recurse(SerializedProperty newIt, SerializedProperty oldIt, SerializedPrope } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/LODGUI.cs b/Editor/Mono/Inspector/LODGUI.cs index b9c5b25e23..945f8852c0 100644 --- a/Editor/Mono/Inspector/LODGUI.cs +++ b/Editor/Mono/Inspector/LODGUI.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Mesh not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -72,15 +71,15 @@ public class GUIStyles public readonly int[] lodContributeGIValues = { -1, 0, 1, 2, 3, 4, 5, 6, 7 }; public readonly GUIContent[] lodContributeGIStrings = { - EditorGUIUtility.TrTextContent("None"), - EditorGUIUtility.TrTextContent("LOD 0"), - EditorGUIUtility.TrTextContent("LOD 1"), - EditorGUIUtility.TrTextContent("LOD 2"), - EditorGUIUtility.TrTextContent("LOD 3"), - EditorGUIUtility.TrTextContent("LOD 4"), - EditorGUIUtility.TrTextContent("LOD 5"), - EditorGUIUtility.TrTextContent("LOD 6"), - EditorGUIUtility.TrTextContent("LOD 7"), + L10n.TextContent("None", null, null, null), + L10n.TextContent("LOD 0", null, null, null), + L10n.TextContent("LOD 1", null, null, null), + L10n.TextContent("LOD 2", null, null, null), + L10n.TextContent("LOD 3", null, null, null), + L10n.TextContent("LOD 4", null, null, null), + L10n.TextContent("LOD 5", null, null, null), + L10n.TextContent("LOD 6", null, null, null), + L10n.TextContent("LOD 7", null, null, null), }; public readonly GUIStyle m_LODSliderBG = "LODSliderBG"; @@ -99,45 +98,45 @@ public class GUIStyles public readonly GUIStyle m_LODRenderersText = "LODRenderersText"; public readonly GUIStyle m_LODLevelNotifyText = "LODLevelNotifyText"; - public readonly GUIContent m_IconRendererPlus = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add New Renderers"); - public readonly GUIContent m_IconRendererMinus = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove Renderer"); + public readonly GUIContent m_IconRendererPlus = L10n.IconContent("Toolbar Plus", "Add New Renderers", null); + public readonly GUIContent m_IconRendererMinus = L10n.IconContent("Toolbar Minus", "Remove Renderer", null); public readonly GUIContent m_CameraIcon = EditorGUIUtility.IconContent(); - public readonly GUIContent m_LodContributeGITitle = EditorGUIUtility.TrTextContent("Global Illumination LOD", "The level of detail that contributes to global illumination calculations."); - public readonly GUIContent m_UploadToImporter = EditorGUIUtility.TrTextContent("Upload to Importer", "Upload the modified screen percentages to the model importer."); - public readonly GUIContent m_UploadToImporterDisabled = EditorGUIUtility.TrTextContent("Upload to Importer", "Number of LOD's in the scene instance differ from the number of LOD's in the imported model."); - public readonly GUIContent m_RecalculateBounds = EditorGUIUtility.TrTextContent("Recalculate Bounds", "Recalculate bounds to encapsulate all child renderers."); - public readonly GUIContent m_RecalculateBoundsDisabled = EditorGUIUtility.TrTextContent("Recalculate Bounds", "Bounds are already up-to-date."); - public readonly GUIContent m_LightmapScale = EditorGUIUtility.TrTextContent("Recalculate Lightmap Scale", "Set the lightmap scale to match the LOD percentages."); - public readonly GUIContent m_RendersTitle = EditorGUIUtility.TrTextContent("Renderers"); + public readonly GUIContent m_LodContributeGITitle = L10n.TextContent("Global Illumination LOD", "The level of detail that contributes to global illumination calculations.", null, null); + public readonly GUIContent m_UploadToImporter = L10n.TextContent("Upload to Importer", "Upload the modified screen percentages to the model importer.", null, null); + public readonly GUIContent m_UploadToImporterDisabled = L10n.TextContent("Upload to Importer", "Number of LOD's in the scene instance differ from the number of LOD's in the imported model.", null, null); + public readonly GUIContent m_RecalculateBounds = L10n.TextContent("Recalculate Bounds", "Recalculate bounds to encapsulate all child renderers.", null, null); + public readonly GUIContent m_RecalculateBoundsDisabled = L10n.TextContent("Recalculate Bounds", "Bounds are already up-to-date.", null, null); + public readonly GUIContent m_LightmapScale = L10n.TextContent("Recalculate Lightmap Scale", "Set the lightmap scale to match the LOD percentages.", null, null); + public readonly GUIContent m_RendersTitle = L10n.TextContent("Renderers", null, null, null); - public readonly GUIContent m_AnimatedCrossFadeInvalidText = EditorGUIUtility.TrTextContent("Animated cross-fading is currently disabled. Please enable \"Animate Between Next LOD\" on either the current or the previous LOD."); - public readonly GUIContent m_AnimatedCrossFadeInconsistentText = EditorGUIUtility.TrTextContent("Animated cross-fading is currently disabled. \"Animate Between Next LOD\" is enabled but the next LOD is not in Animated Cross Fade mode."); - public readonly GUIContent m_AnimateBetweenPreviousLOD = EditorGUIUtility.TrTextContent("Animate Between Previous LOD", "Cross-fade animation plays when transits between this LOD and the previous (lower) LOD."); + public readonly GUIContent m_AnimatedCrossFadeInvalidText = L10n.TextContent("Animated cross-fading is currently disabled. Please enable \"Animate Between Next LOD\" on either the current or the previous LOD.", null, null, null); + public readonly GUIContent m_AnimatedCrossFadeInconsistentText = L10n.TextContent("Animated cross-fading is currently disabled. \"Animate Between Next LOD\" is enabled but the next LOD is not in Animated Cross Fade mode.", null, null, null); + public readonly GUIContent m_AnimateBetweenPreviousLOD = L10n.TextContent("Animate Between Previous LOD", "Cross-fade animation plays when transits between this LOD and the previous (lower) LOD.", null, null); - public readonly GUIContent m_LODObjectSizeLabel = EditorGUIUtility.TrTextContent("Object Size", "The Object size in local space. This is used to calculate the relative screen height for the object."); - public readonly GUIContent m_ResetObjectSizeLabel = EditorGUIUtility.TrTextContent("Reset Object Size", "Resets the Object Size in Local Space to 1 and preserves LOD distances."); - public readonly GUIContent m_LODDistancesInRelativeSizeLabel = EditorGUIUtility.TrTextContent("LOD Distances in Screen Relative Size"); - public readonly GUIContent m_LODSetToCameraLabel = EditorGUIUtility.TrTextContent("Set to Camera"); + public readonly GUIContent m_LODObjectSizeLabel = L10n.TextContent("Object Size", "The Object size in local space. This is used to calculate the relative screen height for the object.", null, null); + public readonly GUIContent m_ResetObjectSizeLabel = L10n.TextContent("Reset Object Size", "Resets the Object Size in Local Space to 1 and preserves LOD distances.", null, null); + public readonly GUIContent m_LODDistancesInRelativeSizeLabel = L10n.TextContent("LOD Distances in Screen Relative Size", null, null, null); + public readonly GUIContent m_LODSetToCameraLabel = L10n.TextContent("Set to Camera", null, null, null); - public readonly GUIContent m_LODTransitionPercentageLabel = EditorGUIUtility.TrTextContent("Transition (% Screen Size)", "This value marks where LOD level transitions into a lower LOD level."); + public readonly GUIContent m_LODTransitionPercentageLabel = L10n.TextContent("Transition (% Screen Size)", "This value marks where LOD level transitions into a lower LOD level.", null, null); [NoAutoStaticsCleanup] // Whitelisted GUIContent label; safe to persist across reload. - public static GUIContent m_TriangleCountLabel = EditorGUIUtility.TrTextContent("Triangles"); + public static GUIContent m_TriangleCountLabel = L10n.TextContent("Triangles", null, null, null); [NoAutoStaticsCleanup] // Whitelisted GUIContent label; safe to persist across reload. - public static GUIContent m_VertexCountLabel = EditorGUIUtility.TrTextContent("Vertices"); + public static GUIContent m_VertexCountLabel = L10n.TextContent("Vertices", null, null, null); [NoAutoStaticsCleanup] // Whitelisted GUIContent label (its .text is overwritten per-frame); safe to persist. - public static GUIContent m_DistanceInMetersLabel = EditorGUIUtility.TrTextContent("-", "The displayed distance depends on the current Scene View camera settings and might be different in Game View."); + public static GUIContent m_DistanceInMetersLabel = L10n.TextContent("-", "The displayed distance depends on the current Scene View camera settings and might be different in Game View.", null, null); [NoAutoStaticsCleanup] // Whitelisted GUIStyle wrapping an editor style; recreated with s_Styles on first access. public static GUIStyle m_InspectorTitlebarFlat; [NoAutoStaticsCleanup] // Whitelisted GUIContent icon loaded by fixed name; asset survives reload. - public static GUIContent m_BlueBorderTextureSelected = EditorGUIUtility.TrIconContent("AnimationRowOddSelected"); + public static GUIContent m_BlueBorderTextureSelected = L10n.IconContent("AnimationRowOddSelected", null, null); [NoAutoStaticsCleanup] // Whitelisted GUIContent icon loaded by fixed name; asset survives reload. - public static GUIContent m_BlueBorderTextureNormal = EditorGUIUtility.TrIconContent("OL title act"); + public static GUIContent m_BlueBorderTextureNormal = L10n.IconContent("OL title act", null, null); [NoAutoStaticsCleanup] // Whitelisted GUIContent label; safe to persist across reload. - public static GUIContent m_MeshLodInfo = EditorGUIUtility.TrTextContent("Mesh LOD is active and has been applied to "); + public static GUIContent m_MeshLodInfo = L10n.TextContent("Mesh LOD is active and has been applied to ", null, null, null); public GUIStyles() { @@ -612,4 +611,3 @@ public static float GetRelativeHeight(this LODGroup lodGroup, Camera camera) return DistanceToRelativeHeight(camera, distance, lodGroup.GetWorldSpaceSize()) * QualitySettings.lodBias; } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/LODGroupEditor.cs b/Editor/Mono/Inspector/LODGroupEditor.cs index ed9f468f6b..71f9bc6a27 100644 --- a/Editor/Mono/Inspector/LODGroupEditor.cs +++ b/Editor/Mono/Inspector/LODGroupEditor.cs @@ -35,6 +35,8 @@ internal class LODGroupEditor : Editor private SerializedProperty m_LODs; private SerializedProperty m_LODSize; private SerializedProperty m_GlobalIlluminationLOD; + private int[] m_GlobalIlluminationLODValues; + private GUIContent[] m_GlobalIlluminationLODStrings; private AnimBool m_ShowAnimateCrossFading = new AnimBool(); private AnimBool m_ShowFadeTransitionWidth = new AnimBool(); @@ -692,45 +694,57 @@ public override void OnInspectorGUI() if (m_SelectedLOD >= m_NumberOfLODs) m_SelectedLOD = m_NumberOfLODs - 1; - // Shows a combo box in the UI specifying which LOD level is used for baking (GFXFEAT-865) - // This is disabled for now as the feature is only supported by the Unified Baker - var usingComputeLightBaker = UnityEditor.Rendering.EditorGraphicsSettings.defaultLightBaker == UnityEditor.Rendering.LightBaker.UnityComputeLightBaker; - if (usingComputeLightBaker) + if (m_GlobalIlluminationLODValues == null || m_GlobalIlluminationLODValues.Length != m_NumberOfLODs + 1) { - int[] lodContributeGIValues = new Span(LODGUI.Styles.lodContributeGIValues, 0, m_NumberOfLODs + 1).ToArray(); - GUIContent[] lodContributeGIStrings = new Span(LODGUI.Styles.lodContributeGIStrings, 0, m_NumberOfLODs + 1).ToArray(); + m_GlobalIlluminationLODValues = new Span(LODGUI.Styles.lodContributeGIValues, 0, m_NumberOfLODs + 1).ToArray(); + m_GlobalIlluminationLODStrings = new Span(LODGUI.Styles.lodContributeGIStrings, 0, m_NumberOfLODs + 1).ToArray(); + } - int lodGroupContributeGI = m_GlobalIlluminationLOD.intValue; - if (lodGroupContributeGI < -1 || lodGroupContributeGI >= m_NumberOfLODs) - lodGroupContributeGI = -2; // This is outside the range and will result in a blank selection for LOD, a warning will be shown prompting the user to select an entry + int lodGroupContributeGI = m_GlobalIlluminationLOD.intValue; + if (lodGroupContributeGI < -1 || lodGroupContributeGI >= m_NumberOfLODs) + lodGroupContributeGI = -2; // This is outside the range and will result in a blank selection for LOD, a warning will be shown prompting the user to select an entry - var rect = EditorGUILayout.GetControlRect(); - EditorGUI.BeginProperty(rect, LODGUI.Styles.m_LodContributeGITitle, m_GlobalIlluminationLOD); - EditorGUI.BeginChangeCheck(); - // Draw the possible LOD group indices the user can select a global illumination contributor from - lodGroupContributeGI = EditorGUI.IntPopup(rect, LODGUI.Styles.m_LodContributeGITitle, lodGroupContributeGI, lodContributeGIStrings, lodContributeGIValues); - if (EditorGUI.EndChangeCheck()) - m_GlobalIlluminationLOD.intValue = lodGroupContributeGI; - EditorGUI.EndProperty(); + var rect = EditorGUILayout.GetControlRect(); + EditorGUI.BeginProperty(rect, LODGUI.Styles.m_LodContributeGITitle, m_GlobalIlluminationLOD); + EditorGUI.BeginChangeCheck(); + // Draw the possible LOD group indices the user can select a global illumination contributor from + lodGroupContributeGI = EditorGUI.IntPopup(rect, LODGUI.Styles.m_LodContributeGITitle, lodGroupContributeGI, m_GlobalIlluminationLODStrings, m_GlobalIlluminationLODValues); + if (EditorGUI.EndChangeCheck()) + m_GlobalIlluminationLOD.intValue = lodGroupContributeGI; + EditorGUI.EndProperty(); - if (m_GlobalIlluminationLOD.intValue != -1) + var usingComputeLightBaker = UnityEditor.Rendering.EditorGraphicsSettings.defaultLightBaker == UnityEditor.Rendering.LightBaker.UnityComputeLightBaker; + + // The Progressive Lightmapper does not read the selection and always bakes LOD 0. + if (!usingComputeLightBaker && m_GlobalIlluminationLOD.intValue != 0) + EditorGUILayout.HelpBox("The Progressive Lightmapper does not support the Global Illumination LOD selection and always bakes LOD 0.", MessageType.Warning); + + if (m_GlobalIlluminationLOD.intValue != -1) + { + // Check if the selected lod level has any active renderers, and any renderers contributing to baked GI + var renderersProperty = serializedObject.FindProperty(string.Format(kRenderRootPath, m_GlobalIlluminationLOD.intValue)); + bool levelHasActiveRenderer = false; + bool levelHasBakeContributor = false; + if (renderersProperty != null) { - // Check if the selected lod level has any contributing renderers - var renderersProperty = serializedObject.FindProperty(string.Format(kRenderRootPath, m_GlobalIlluminationLOD.intValue)); - bool levelHasContributor = false; - if (renderersProperty != null) + for (int i = 0; i < renderersProperty.arraySize && !levelHasBakeContributor; ++i) { - for (int i = 0; i < renderersProperty.arraySize && !levelHasContributor; ++i) + var rendererRef = renderersProperty.GetArrayElementAtIndex(i).FindPropertyRelative("renderer"); + var renderer = rendererRef.objectReferenceValue as Renderer; + if (renderer != null && renderer.gameObject != null && renderer.enabled && renderer.gameObject.activeInHierarchy) { - var rendererRef = renderersProperty.GetArrayElementAtIndex(i).FindPropertyRelative("renderer"); - var renderer = rendererRef.objectReferenceValue as Renderer; - if (renderer != null && renderer.gameObject != null && renderer.enabled && renderer.gameObject.activeInHierarchy) - levelHasContributor |= GameObjectUtility.AreStaticEditorFlagsSet(renderer.gameObject, StaticEditorFlags.ContributeGI); + levelHasActiveRenderer = true; + levelHasBakeContributor |= GameObjectUtility.AnyStaticEditorFlagsSet(renderer.gameObject, StaticEditorFlags.ContributeGI); } } - if (!levelHasContributor) - EditorGUILayout.HelpBox("The selected global illumination LOD has no renderers contributing to global illumination. If the LODGroup should not contribute to global illumination select 'None'.", MessageType.Warning); } + + // Surface Cache contribution depends on Volume overrides and rendering layer masks, not on the + // ContributeGI static flag, so the ContributeGI-based warning only applies to light baking. + if (!levelHasActiveRenderer) + EditorGUILayout.HelpBox("The selected global illumination LOD has no active renderers. If the LODGroup should not contribute to global illumination select 'None'.", MessageType.Warning); + else if (usingComputeLightBaker && !levelHasBakeContributor) + EditorGUILayout.HelpBox("The selected global illumination LOD has no renderers marked as Contribute GI. Baked global illumination will not include this LODGroup. This does not affect Surface Cache global illumination.", MessageType.Warning); } if (targets.Length > 1) @@ -1307,11 +1321,11 @@ private void DrawLODLevelSlider(Rect sliderPosition, List lods) var pm = new GenericMenu(); if (lods.Count >= 8) { - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Insert Before")); + pm.AddDisabledItem(L10n.TextContent("Insert Before", null, null, null)); } else { - pm.AddItem(EditorGUIUtility.TrTextContent("Insert Before"), false, + pm.AddItem(L10n.TextContent("Insert Before", null, null, null), false, new LODAction(lods, cameraPercent, evt.mousePosition, m_LODs, OnInsertLOD). InsertLOD); } @@ -1322,9 +1336,9 @@ private void DrawLODLevelSlider(Rect sliderPosition, List lods) disabledRegion = false; if (disabledRegion) - pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Delete")); + pm.AddDisabledItem(L10n.TextContent("Delete", null, null, null)); else - pm.AddItem(EditorGUIUtility.TrTextContent("Delete"), false, + pm.AddItem(L10n.TextContent("Delete", null, null, null), false, new LODAction(lods, cameraPercent, evt.mousePosition, m_LODs, OnDeleteLOD). DeleteLOD); pm.ShowAsContext(); diff --git a/Editor/Mono/Inspector/LayoutDropdownWindow.cs b/Editor/Mono/Inspector/LayoutDropdownWindow.cs index f0d6a2fbb4..0c6742569e 100644 --- a/Editor/Mono/Inspector/LayoutDropdownWindow.cs +++ b/Editor/Mono/Inspector/LayoutDropdownWindow.cs @@ -124,8 +124,8 @@ public override void OnGUI(Rect rect) editorWindow.Close(); } - GUI.Label(new Rect(rect.x + 5, rect.y + 3, rect.width - 10, 16), EditorGUIUtility.TrTextContent("Anchor Presets"), EditorStyles.boldLabel); - GUI.Label(new Rect(rect.x + 5, rect.y + 3 + 16, rect.width - 10, 16), EditorGUIUtility.TrTextContent("Shift: Also set pivot Alt: Also set position"), EditorStyles.label); + GUI.Label(new Rect(rect.x + 5, rect.y + 3, rect.width - 10, 16), L10n.TextContent("Anchor Presets", null, null, null), EditorStyles.boldLabel); + GUI.Label(new Rect(rect.x + 5, rect.y + 3 + 16, rect.width - 10, 16), L10n.TextContent("Shift: Also set pivot Alt: Also set position", null, null, null), EditorStyles.label); Color oldColor = GUI.color; GUI.color = s_Styles.tableLineColor * oldColor; diff --git a/Editor/Mono/Inspector/LightEditor.cs b/Editor/Mono/Inspector/LightEditor.cs index ba0e117ab9..2cf0341652 100644 --- a/Editor/Mono/Inspector/LightEditor.cs +++ b/Editor/Mono/Inspector/LightEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using Object = UnityEngine.Object; using UnityEditor.AnimatedValues; @@ -79,64 +78,64 @@ public Settings(SerializedObject so) private static class Styles { - public static readonly GUIContent Type = EditorGUIUtility.TrTextContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, and Area lights."); - public static readonly GUIContent Shape = EditorGUIUtility.TrTextContent("Shape", "Specifies the shape of the Area light. Possible types are Rectangle and Disc."); - public static readonly GUIContent Range = EditorGUIUtility.TrTextContent("Range", "Controls how far the light is emitted from the center of the object."); - public static readonly GUIContent SpotAngle = EditorGUIUtility.TrTextContent("Spot Angle", "Controls the angle in degrees at the base of a Spot light's cone."); - public static readonly GUIContent InnerOuterSpotAngle = EditorGUIUtility.TrTextContent("Inner / Outer Spot Angle", "Controls the inner and outer angles in degrees, at the base of a Spot light's cone."); - public static readonly GUIContent Color = EditorGUIUtility.TrTextContent("Color", "Controls the color being emitted by the light."); - public static readonly GUIContent UseColorTemperature = EditorGUIUtility.TrTextContent("Use color temperature mode", "Choose between RGB and temperature mode for light's color."); - public static readonly GUIContent ColorFilter = EditorGUIUtility.TrTextContent("Filter", "A colored gel can be put in front of the light source to tint the light."); - public static readonly GUIContent ColorTemperature = EditorGUIUtility.TrTextContent("Temperature", "Also known as CCT (Correlated color temperature). The color temperature of the electromagnetic radiation emitted from an ideal black body is defined as its surface temperature in Kelvin. White is 6500K"); - public static readonly GUIContent Intensity = EditorGUIUtility.TrTextContent("Intensity", "Controls the brightness of the light. Light color is multiplied by this value."); - public static readonly GUIContent LightmappingMode = EditorGUIUtility.TrTextContent("Mode", "Specifies the light mode used to determine if and how a light will be baked. Possible modes are Baked, Mixed, and Realtime."); - public static readonly GUIContent LightBounceIntensityRealtimeGISupport = EditorGUIUtility.TrTextContent("Indirect Multiplier", "Determines the intensity of indirect light being contributed to the scene. Has no effect when both Realtime and Baked Global Illumination are disabled. If this value is 0, Realtime lights to be removed from realtime global illumination and Baked and Mixed lights to no longer emit indirect lighting."); - public static readonly GUIContent LightBounceIntensity = EditorGUIUtility.TrTextContent("Indirect Multiplier", "Determines the intensity of indirect light being contributed to to the scene. Has no effect when Baked Global Illumination is disabled. If this value is 0, Baked and Mixed lights no longer emit indirect lighting."); - public static readonly GUIContent ShadowType = EditorGUIUtility.TrTextContent("Shadow Type", "Specifies whether Hard Shadows, Soft Shadows, or No Shadows will be cast by the light."); - public static readonly GUIContent CastShadows = EditorGUIUtility.TrTextContent("Cast Shadows", "Specifies whether Soft Shadows or No Shadows will be cast by the light."); - public static readonly GUIContent ShapeRadius = EditorGUIUtility.TrTextContent("Shape Radius", "Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light."); + public static readonly GUIContent Type = L10n.TextContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, and Area lights.", null, null); + public static readonly GUIContent Shape = L10n.TextContent("Shape", "Specifies the shape of the Area light. Possible types are Rectangle and Disc.", null, null); + public static readonly GUIContent Range = L10n.TextContent("Range", "Controls how far the light is emitted from the center of the object.", null, null); + public static readonly GUIContent SpotAngle = L10n.TextContent("Spot Angle", "Controls the angle in degrees at the base of a Spot light's cone.", null, null); + public static readonly GUIContent InnerOuterSpotAngle = L10n.TextContent("Inner / Outer Spot Angle", "Controls the inner and outer angles in degrees, at the base of a Spot light's cone.", null, null); + public static readonly GUIContent Color = L10n.TextContent("Color", "Controls the color being emitted by the light.", null, null); + public static readonly GUIContent UseColorTemperature = L10n.TextContent("Use color temperature mode", "Choose between RGB and temperature mode for light's color.", null, null); + public static readonly GUIContent ColorFilter = L10n.TextContent("Filter", "A colored gel can be put in front of the light source to tint the light.", null, null); + public static readonly GUIContent ColorTemperature = L10n.TextContent("Temperature", "Also known as CCT (Correlated color temperature). The color temperature of the electromagnetic radiation emitted from an ideal black body is defined as its surface temperature in Kelvin. White is 6500K", null, null); + public static readonly GUIContent Intensity = L10n.TextContent("Intensity", "Controls the brightness of the light. Light color is multiplied by this value.", null, null); + public static readonly GUIContent LightmappingMode = L10n.TextContent("Mode", "Specifies the light mode used to determine if and how a light will be baked. Possible modes are Baked, Mixed, and Realtime.", null, null); + public static readonly GUIContent LightBounceIntensityRealtimeGISupport = L10n.TextContent("Indirect Multiplier", "Determines the intensity of indirect light being contributed to the scene. Has no effect when both Realtime and Baked Global Illumination are disabled. If this value is 0, Realtime lights to be removed from realtime global illumination and Baked and Mixed lights to no longer emit indirect lighting.", null, null); + public static readonly GUIContent LightBounceIntensity = L10n.TextContent("Indirect Multiplier", "Determines the intensity of indirect light being contributed to to the scene. Has no effect when Baked Global Illumination is disabled. If this value is 0, Baked and Mixed lights no longer emit indirect lighting.", null, null); + public static readonly GUIContent ShadowType = L10n.TextContent("Shadow Type", "Specifies whether Hard Shadows, Soft Shadows, or No Shadows will be cast by the light.", null, null); + public static readonly GUIContent CastShadows = L10n.TextContent("Cast Shadows", "Specifies whether Soft Shadows or No Shadows will be cast by the light.", null, null); + public static readonly GUIContent ShapeRadius = L10n.TextContent("Shape Radius", "Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light.", null, null); //realtime - public static readonly GUIContent ShadowRealtimeSettings = EditorGUIUtility.TrTextContent("Realtime Shadows", "Settings for realtime direct shadows."); - public static readonly GUIContent ShadowStrength = EditorGUIUtility.TrTextContent("Strength", "Controls how dark the shadows cast by the light will be."); - public static readonly GUIContent ShadowResolution = EditorGUIUtility.TrTextContent("Resolution", "Controls the rendered resolution of the shadow maps. A higher resolution will increase the fidelity of shadows at the cost of GPU performance and memory usage."); - public static readonly GUIContent ShadowBias = EditorGUIUtility.TrTextContent("Bias", "Controls the distance at which the shadows will be pushed away from the light. Useful for avoiding false self-shadowing artifacts."); - public static readonly GUIContent ShadowNormalBias = EditorGUIUtility.TrTextContent("Normal Bias", "Controls distance at which the shadow casting surfaces will be shrunk along the surface normal. Useful for avoiding false self-shadowing artifacts."); - public static readonly GUIContent ShadowNearPlane = EditorGUIUtility.TrTextContent("Near Plane", "Controls the value for the near clip plane when rendering shadows. Currently clamped to 0.1 units or 1% of the lights range property, whichever is lower."); + public static readonly GUIContent ShadowRealtimeSettings = L10n.TextContent("Realtime Shadows", "Settings for realtime direct shadows.", null, null); + public static readonly GUIContent ShadowStrength = L10n.TextContent("Strength", "Controls how dark the shadows cast by the light will be.", null, null); + public static readonly GUIContent ShadowResolution = L10n.TextContent("Resolution", "Controls the rendered resolution of the shadow maps. A higher resolution will increase the fidelity of shadows at the cost of GPU performance and memory usage.", null, null); + public static readonly GUIContent ShadowBias = L10n.TextContent("Bias", "Controls the distance at which the shadows will be pushed away from the light. Useful for avoiding false self-shadowing artifacts.", null, null); + public static readonly GUIContent ShadowNormalBias = L10n.TextContent("Normal Bias", "Controls distance at which the shadow casting surfaces will be shrunk along the surface normal. Useful for avoiding false self-shadowing artifacts.", null, null); + public static readonly GUIContent ShadowNearPlane = L10n.TextContent("Near Plane", "Controls the value for the near clip plane when rendering shadows. Currently clamped to 0.1 units or 1% of the lights range property, whichever is lower.", null, null); //baked - public static readonly GUIContent BakedShadowAngle = EditorGUIUtility.TrTextContent("Baked Shadow Angle", "Controls the amount of artificial softening applied to the edges of shadows cast by directional lights."); - - public static readonly GUIContent Cookie = EditorGUIUtility.TrTextContent("Cookie", "Specifies the Texture mask to cast shadows, create silhouettes, or patterned illumination for the light."); - public static readonly GUIContent CookieSize = EditorGUIUtility.TrTextContent("Size", "Controls the size of the cookie mask currently assigned to the light."); - public static readonly GUIContent CookieTexture = EditorGUIUtility.TrTextContent("Cookie", "Texture to use for the light cookie."); - - public static readonly GUIContent DrawHalo = EditorGUIUtility.TrTextContent("Draw Halo", "When enabled, draws a spherical halo of light with a radius equal to the lights range value."); - public static readonly GUIContent Flare = EditorGUIUtility.TrTextContent("Flare", "Specifies the flare object to be used by the light to render lens flares in the scene."); - public static readonly GUIContent RenderMode = EditorGUIUtility.TrTextContent("Render Mode", "Specifies the importance of the light which impacts lighting fidelity and performance. Options are Auto, Important, and Not Important. This only affects Forward Rendering."); - public static readonly GUIContent CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "Specifies which layers will be affected or excluded from the light's effect on objects in the scene."); - public static readonly GUIContent RenderingLayerMask = EditorGUIUtility.TrTextContent("Rendering Layer Mask", "Mask that can be used with SRP when drawing shadows to filter renderers outside of the normal layering system."); - - public static readonly GUIContent AreaWidth = EditorGUIUtility.TrTextContent("Width", "Controls the width in units of the area light."); - public static readonly GUIContent AreaHeight = EditorGUIUtility.TrTextContent("Height", "Controls the height in units of the area light."); - public static readonly GUIContent AreaRadius = EditorGUIUtility.TrTextContent("Radius", "Controls the radius in units of the disc area light."); - - public static readonly GUIContent BakingWarning = EditorGUIUtility.TrTextContent("Light mode is currently overridden to Realtime mode. Enable Baked Global Illumination to use Mixed or Baked light modes."); - public static readonly GUIContent IndirectBounceShadowWarning = EditorGUIUtility.TrTextContent("Realtime indirect bounce shadowing is only supported for Directional lights."); - public static readonly GUIContent CookieSpotRepeatWarning = EditorGUIUtility.TrTextContent("Cookie textures for spot lights should be set to clamp, not repeat, to avoid artifacts."); - public static readonly GUIContent CookieNotEnabledWarning = EditorGUIUtility.TrTextContent("Cookie support for baked lights is not enabled. Please enable it in Project Settings > Editor > Enable baked cookies support"); - public static readonly GUIContent CookieNotEnabledInfo = EditorGUIUtility.TrTextContent("Cookie support for mixed lights is not enabled for indirect lighting. You can enable it in Project Settings > Editor > Enable baked cookies support"); - public static readonly GUIContent CookieSpotDirectionalTextureWarning = EditorGUIUtility.TrTextContent("Spot and directional light cookie textures must be 2D."); - public static readonly GUIContent CookiePointCubemapTextureWarning = EditorGUIUtility.TrTextContent("Cookie support for baked lights is not enabled. Please enable it in Project Settings > Editor > Enable baked cookies support"); - public static readonly GUIContent MixedUnsupportedWarning = EditorGUIUtility.TrTextContent("Light mode is currently overridden to Realtime mode. The current render pipeline doesn't support Mixed mode and/or any of the lighting modes."); - public static readonly GUIContent BakedUnsupportedWarning = EditorGUIUtility.TrTextContent("Light mode is currently overridden to Realtime mode. The current render pipeline doesn't support Baked mode."); - public static readonly GUIContent ShadowMaskConvertedToBakedWarning = EditorGUIUtility.TrTextContent("Light mode is currently overridden to Baked mode because too many lights overlap in the scene. Shadowmask mode only supports a maximum of 4 overlapping lights."); - - public static readonly GUIContent[] LightmapBakeTypeTitles = { EditorGUIUtility.TrTextContent("Realtime"), EditorGUIUtility.TrTextContent("Mixed"), EditorGUIUtility.TrTextContent("Baked") }; + public static readonly GUIContent BakedShadowAngle = L10n.TextContent("Baked Shadow Angle", "Controls the amount of artificial softening applied to the edges of shadows cast by directional lights.", null, null); + + public static readonly GUIContent Cookie = L10n.TextContent("Cookie", "Specifies the Texture mask to cast shadows, create silhouettes, or patterned illumination for the light.", null, null); + public static readonly GUIContent CookieSize = L10n.TextContent("Size", "Controls the size of the cookie mask currently assigned to the light.", null, null); + public static readonly GUIContent CookieTexture = L10n.TextContent("Cookie", "Texture to use for the light cookie.", null, null); + + public static readonly GUIContent DrawHalo = L10n.TextContent("Draw Halo", "When enabled, draws a spherical halo of light with a radius equal to the lights range value.", null, null); + public static readonly GUIContent Flare = L10n.TextContent("Flare", "Specifies the flare object to be used by the light to render lens flares in the scene.", null, null); + public static readonly GUIContent RenderMode = L10n.TextContent("Render Mode", "Specifies the importance of the light which impacts lighting fidelity and performance. Options are Auto, Important, and Not Important. This only affects Forward Rendering.", null, null); + public static readonly GUIContent CullingMask = L10n.TextContent("Culling Mask", "Specifies which layers will be affected or excluded from the light's effect on objects in the scene.", null, null); + public static readonly GUIContent RenderingLayerMask = L10n.TextContent("Rendering Layer Mask", "Mask that can be used with SRP when drawing shadows to filter renderers outside of the normal layering system.", null, null); + + public static readonly GUIContent AreaWidth = L10n.TextContent("Width", "Controls the width in units of the area light.", null, null); + public static readonly GUIContent AreaHeight = L10n.TextContent("Height", "Controls the height in units of the area light.", null, null); + public static readonly GUIContent AreaRadius = L10n.TextContent("Radius", "Controls the radius in units of the disc area light.", null, null); + + public static readonly GUIContent BakingWarning = L10n.TextContent("Light mode is currently overridden to Realtime mode. Enable Baked Global Illumination to use Mixed or Baked light modes.", null, null, null); + public static readonly GUIContent IndirectBounceShadowWarning = L10n.TextContent("Realtime indirect bounce shadowing is only supported for Directional lights.", null, null, null); + public static readonly GUIContent CookieSpotRepeatWarning = L10n.TextContent("Cookie textures for spot lights should be set to clamp, not repeat, to avoid artifacts.", null, null, null); + public static readonly GUIContent CookieNotEnabledWarning = L10n.TextContent("Cookie support for baked lights is not enabled. Please enable it in Project Settings > Editor > Enable baked cookies support", null, null, null); + public static readonly GUIContent CookieNotEnabledInfo = L10n.TextContent("Cookie support for mixed lights is not enabled for indirect lighting. You can enable it in Project Settings > Editor > Enable baked cookies support", null, null, null); + public static readonly GUIContent CookieSpotDirectionalTextureWarning = L10n.TextContent("Spot and directional light cookie textures must be 2D.", null, null, null); + public static readonly GUIContent CookiePointCubemapTextureWarning = L10n.TextContent("Cookie support for baked lights is not enabled. Please enable it in Project Settings > Editor > Enable baked cookies support", null, null, null); + public static readonly GUIContent MixedUnsupportedWarning = L10n.TextContent("Light mode is currently overridden to Realtime mode. The current render pipeline doesn't support Mixed mode and/or any of the lighting modes.", null, null, null); + public static readonly GUIContent BakedUnsupportedWarning = L10n.TextContent("Light mode is currently overridden to Realtime mode. The current render pipeline doesn't support Baked mode.", null, null, null); + public static readonly GUIContent ShadowMaskConvertedToBakedWarning = L10n.TextContent("Light mode is currently overridden to Baked mode because too many lights overlap in the scene. Shadowmask mode only supports a maximum of 4 overlapping lights.", null, null, null); + + public static readonly GUIContent[] LightmapBakeTypeTitles = { L10n.TextContent("Realtime", null, null, null), L10n.TextContent("Mixed", null, null, null), L10n.TextContent("Baked", null, null, null) }; public static readonly int[] LightmapBakeTypeValues = { (int)LightmapBakeType.Realtime, (int)LightmapBakeType.Mixed, (int)LightmapBakeType.Baked }; - public static readonly GUIContent[] LightTypeTitles = { EditorGUIUtility.TrTextContent("Spot"), EditorGUIUtility.TrTextContent("Directional"), EditorGUIUtility.TrTextContent("Point"), EditorGUIUtility.TrTextContent("Area (baked only)") }; + public static readonly GUIContent[] LightTypeTitles = { L10n.TextContent("Spot", null, null, null), L10n.TextContent("Directional", null, null, null), L10n.TextContent("Point", null, null, null), L10n.TextContent("Area (baked only)", null, null, null) }; public static readonly int[] LightTypeValues = { (int)LightType.Spot, (int)LightType.Directional, (int)LightType.Point, (int)LightType.Rectangle }; - public static readonly GUIContent[] AreaLightShapeTitles = { EditorGUIUtility.TrTextContent("Rectangle"), EditorGUIUtility.TrTextContent("Disc") }; + public static readonly GUIContent[] AreaLightShapeTitles = { L10n.TextContent("Rectangle", null, null, null), L10n.TextContent("Disc", null, null, null) }; public static readonly int[] AreaLightShapeValues = { (int)AreaLightShape.Rectangle, (int)AreaLightShape.Disc }; } @@ -296,7 +295,7 @@ public void DrawLightType() // would show up as a blank entry. string currentTitle = ((LightType)lightType.intValue).ToString(); #pragma warning disable UAC2001 // Avoid Linq - GUIContent[] titles = Styles.LightTypeTitles.Append(EditorGUIUtility.TrTextContent(currentTitle)).ToArray(); + GUIContent[] titles = Styles.LightTypeTitles.Append(L10n.TextContent(currentTitle, null, null, null)).ToArray(); #pragma warning restore UAC2001 #pragma warning disable UAC2001 // Avoid Linq int[] values = Styles.LightTypeValues.Append(lightType.intValue).ToArray(); @@ -672,8 +671,8 @@ public void DrawRuntimeShadow() private static class StylesEx { - public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove command buffer"); - public static readonly GUIContent DisabledLightWarning = EditorGUIUtility.TrTextContent("Lighting has been disabled in at least one Scene view. Any changes applied to lights in the Scene will not be updated in these views until Lighting has been enabled again."); + public static readonly GUIContent iconRemove = L10n.IconContent("Toolbar Minus", "Remove command buffer", null); + public static readonly GUIContent DisabledLightWarning = L10n.TextContent("Lighting has been disabled in at least one Scene view. Any changes applied to lights in the Scene will not be updated in these views until Lighting has been enabled again.", null, null, null); public static readonly GUIStyle invisibleButton = "InvisibleButton"; } @@ -1012,4 +1011,3 @@ private Color GetLightHandleColor(Color wireframeColor) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/LightProbeGroupInspector.cs b/Editor/Mono/Inspector/LightProbeGroupInspector.cs index b04414230d..39a333709e 100644 --- a/Editor/Mono/Inspector/LightProbeGroupInspector.cs +++ b/Editor/Mono/Inspector/LightProbeGroupInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -537,17 +536,17 @@ partial class LightProbeGroupOverlay : TransientSceneViewOverlay internal static partial class Styles { - public static readonly GUIContent showWireframe = EditorGUIUtility.TrTextContent("Show Wireframe", "Show the tetrahedron wireframe visualizing the blending between probes."); - public static readonly GUIContent selectedProbePosition = EditorGUIUtility.TrTextContent("Selected Probe Position", "The local position of this probe relative to the parent group."); - public static readonly GUIContent addProbe = EditorGUIUtility.TrTextContent("Add Probe", "Add a Light Probe to the Light Probe Group."); - public static readonly GUIContent deleteSelected = EditorGUIUtility.TrTextContent("Delete Selected", "Delete the selected Light Probes from the Light Probe Group."); - public static readonly GUIContent selectAll = EditorGUIUtility.TrTextContent("Select All", "Select all Light Probes in the Light Probe Group."); - public static readonly GUIContent duplicateSelected = EditorGUIUtility.TrTextContent("Duplicate Selected", "Duplicate the selected Light Probes."); - public static readonly GUIContent performDeringing = EditorGUIUtility.TrTextContent("Remove Ringing", "When enabled, removes visible overshooting often observed as ringing on objects affected by intense lighting at the expense of reduced contrast."); - public static readonly GUIContent enterEditMode = EditorGUIUtility.TrTextContent("Edit Light Probe Positions", "Change positions for Light Probes."); - public static readonly GUIContent exitEditMode = EditorGUIUtility.TrTextContent("Exit Light Probe Editing", "Exit Light Probe Positions Editing."); - public static readonly GUIContent toolIcon = EditorGUIUtility.TrIconContent("EditCollider", "Edit Light Probe Group.\n\nUse the overlay to add Light Probes and modify probe positions."); - public static readonly GUIContent editModeInfoBox = EditorGUIUtility.TrTextContentWithIcon("Use the Edit Light Probe Group Tool in the Scene Tools Overlay to edit Light Probe positions.", MessageType.Info); + public static readonly GUIContent showWireframe = L10n.TextContent("Show Wireframe", "Show the tetrahedron wireframe visualizing the blending between probes.", null, null); + public static readonly GUIContent selectedProbePosition = L10n.TextContent("Selected Probe Position", "The local position of this probe relative to the parent group.", null, null); + public static readonly GUIContent addProbe = L10n.TextContent("Add Probe", "Add a Light Probe to the Light Probe Group.", null, null); + public static readonly GUIContent deleteSelected = L10n.TextContent("Delete Selected", "Delete the selected Light Probes from the Light Probe Group.", null, null); + public static readonly GUIContent selectAll = L10n.TextContent("Select All", "Select all Light Probes in the Light Probe Group.", null, null); + public static readonly GUIContent duplicateSelected = L10n.TextContent("Duplicate Selected", "Duplicate the selected Light Probes.", null, null); + public static readonly GUIContent performDeringing = L10n.TextContent("Remove Ringing", "When enabled, removes visible overshooting often observed as ringing on objects affected by intense lighting at the expense of reduced contrast.", null, null); + public static readonly GUIContent enterEditMode = L10n.TextContent("Edit Light Probe Positions", "Change positions for Light Probes.", null, null); + public static readonly GUIContent exitEditMode = L10n.TextContent("Exit Light Probe Editing", "Exit Light Probe Positions Editing.", null, null); + public static readonly GUIContent toolIcon = L10n.IconContent("EditCollider", "Edit Light Probe Group.\n\nUse the overlay to add Light Probes and modify probe positions.", null); + public static readonly GUIContent editModeInfoBox = L10n.TextContentWithIcon("Use the Edit Light Probe Group Tool in the Scene Tools Overlay to edit Light Probe positions.", MessageType.Info, null); // This is a property due to [UUM-78837](https://jira.unity3d.com/browse/UUM-78837) // Create GUIStyle lazily on request rather than on static class initialization where the EditorStyles.helpBox may not be initialized yet. public static GUIStyle editModeInfoBoxStyle @@ -783,4 +782,3 @@ public override void OnInspectorGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs b/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs index 46c6dcfdc6..7bbeccf5b3 100644 --- a/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs +++ b/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using System; using System.Collections.Generic; using UnityEditor.AnimatedValues; @@ -49,39 +48,44 @@ static Styles() } public static readonly GUIStyle richTextMiniLabel = new GUIStyle(EditorStyles.miniLabel); - public static readonly GUIContent volumeResolutionText = EditorGUIUtility.TrTextContent("Proxy Volume Resolution", "Specifies the resolution of the 3D grid of interpolated light probes. Higher resolution/density means better lighting, but the CPU cost will increase."); - public static readonly GUIContent resolutionXText = EditorGUIUtility.TrTextContent("X", "The 3D grid resolution on the X axis."); - public static readonly GUIContent resolutionYText = EditorGUIUtility.TrTextContent("Y", "The 3D grid resolution on the Y axis."); - public static readonly GUIContent resolutionZText = EditorGUIUtility.TrTextContent("Z", "The 3D grid resolution on the Z axis."); - public static readonly GUIContent sizeText = EditorGUIUtility.TrTextContent("Size", "The size of the Bounding Box relative to the Game Object."); - public static readonly GUIContent bbSettingsText = EditorGUIUtility.TrTextContent("Bounding Box Settings"); - public static readonly GUIContent originText = EditorGUIUtility.TrTextContent("Origin", "The origin of the Bounding Box relative to the Game Object."); - public static readonly GUIContent bbModeText = EditorGUIUtility.TrTextContent("Bounding Box Mode", "The mode in which the bounding box is computed. A 3D grid of interpolated light probes will be generated inside this bounding box.\n\nAutomatic Local - the local-space bounding box of the Renderer is used.\n\nAutomatic Global - a bounding box is computed which encloses the current Renderer and all the Renderers down the hierarchy that have the Light Probes property set to Use Proxy Volume. The bounding box will be world-space aligned.\n\nCustom - a custom bounding box is used. The bounding box is specified in the local-space of the game object."); - public static readonly GUIContent resModeText = EditorGUIUtility.TrTextContent("Resolution Mode", "The mode in which the resolution of the 3D grid of interpolated light probes is specified:\n\nAutomatic - the resolution on each axis is computed using a user-specified number of interpolated light probes per unit area (Density).\n\nCustom - the user can specify a different resolution on each axis."); - public static readonly GUIContent probePositionText = EditorGUIUtility.TrTextContent("Probe Position Mode", "The mode in which the interpolated probe positions are generated.\n\nCellCorner - divide the volume in cells and generate interpolated probe positions in the corner/edge of the cells.\n\nCellCenter - divide the volume in cells and generate interpolated probe positions in the center of the cells."); - public static readonly GUIContent refreshModeText = EditorGUIUtility.TrTextContent("Refresh Mode", "An enum describing the way a Light Probe Proxy Volume refreshes in the Player."); - public static readonly GUIContent qualityText = EditorGUIUtility.TrTextContent("Quality", "Affects the total number of evaluated Spherical Harmonics(SH) bands for Renderers that use a Light Probe Proxy Volume:\n\nLow Quality - uses only 2 bands (L0 and L1) sampled from a LPPV texture. This option might improve the performance by not breaking batching.\n\nNormal Quality - uses all the bands to evaluate the SH. L0 and L1 are sampled from a LPPV texture and L2 is constant per Renderer."); - public static readonly GUIContent dataFormatText = EditorGUIUtility.TrTextContent("Data Format", "Affects the format of the LPPV texture."); + public static readonly GUIContent volumeResolutionText = L10n.TextContent("Proxy Volume Resolution", "Specifies the resolution of the 3D grid of interpolated light probes. Higher resolution/density means better lighting, but the CPU cost will increase.", null, null); + public static readonly GUIContent resolutionXText = L10n.TextContent("X", "The 3D grid resolution on the X axis.", null, null); + public static readonly GUIContent resolutionYText = L10n.TextContent("Y", "The 3D grid resolution on the Y axis.", null, null); + public static readonly GUIContent resolutionZText = L10n.TextContent("Z", "The 3D grid resolution on the Z axis.", null, null); + public static readonly GUIContent sizeText = L10n.TextContent("Size", "The size of the Bounding Box relative to the Game Object.", null, null); + public static readonly GUIContent bbSettingsText = L10n.TextContent("Bounding Box Settings", null, null, null); + public static readonly GUIContent originText = L10n.TextContent("Origin", "The origin of the Bounding Box relative to the Game Object.", null, null); + public static readonly GUIContent bbModeText = L10n.TextContent("Bounding Box Mode", "The mode in which the bounding box is computed. A 3D grid of interpolated light probes will be generated inside this bounding box.\n\nAutomatic Local - the local-space bounding box of the Renderer is used.\n\nAutomatic Global - a bounding box is computed which encloses the current Renderer and all the Renderers down the hierarchy that have the Light Probes property set to Use Proxy Volume. The bounding box will be world-space aligned.\n\nCustom - a custom bounding box is used. The bounding box is specified in the local-space of the game object.", null, null); + public static readonly GUIContent resModeText = L10n.TextContent("Resolution Mode", "The mode in which the resolution of the 3D grid of interpolated light probes is specified:\n\nAutomatic - the resolution on each axis is computed using a user-specified number of interpolated light probes per unit area (Density).\n\nCustom - the user can specify a different resolution on each axis.", null, null); + public static readonly GUIContent probePositionText = L10n.TextContent("Probe Position Mode", "The mode in which the interpolated probe positions are generated.\n\nCellCorner - divide the volume in cells and generate interpolated probe positions in the corner/edge of the cells.\n\nCellCenter - divide the volume in cells and generate interpolated probe positions in the center of the cells.", null, null); + public static readonly GUIContent refreshModeText = L10n.TextContent("Refresh Mode", "An enum describing the way a Light Probe Proxy Volume refreshes in the Player.", null, null); + public static readonly GUIContent qualityText = L10n.TextContent("Quality", "Affects the total number of evaluated Spherical Harmonics(SH) bands for Renderers that use a Light Probe Proxy Volume:\n\nLow Quality - uses only 2 bands (L0 and L1) sampled from a LPPV texture. This option might improve the performance by not breaking batching.\n\nNormal Quality - uses all the bands to evaluate the SH. L0 and L1 are sampled from a LPPV texture and L2 is constant per Renderer.", null, null); + public static readonly GUIContent dataFormatText = L10n.TextContent("Data Format", "Affects the format of the LPPV texture.", null, null); public static readonly GUIContent[] bbMode = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.BoundingBoxMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] resMode = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.ResolutionMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] probePositionMode = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.ProbePositionMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] refreshMode = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.RefreshMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] qualityMode = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.QualityMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); public static readonly GUIContent[] dataFormat = Array.ConvertAll(Enum.GetNames(typeof(LightProbeProxyVolume.DataFormat)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); - public static readonly GUIContent resProbesPerUnit = EditorGUIUtility.TrTextContent("Density", "Density in probes per world unit."); - public static readonly GUIContent componentUnusedNote = EditorGUIUtility.TrTextContent("In order to use the component on this game object, the Light Probes property should be set to 'Use Proxy Volume' in Renderer."); - public static readonly GUIContent noRendererNode = EditorGUIUtility.TrTextContent("The component is unused by this game object because there is no Renderer component attached."); - public static readonly GUIContent noLightProbes = EditorGUIUtility.TrTextContent("The scene doesn't contain any light probes. Add light probes using Light Probe Group components (menu: Component->Rendering->Light Probe Group)."); - public static readonly GUIContent componentUnsuportedOnTreesNote = EditorGUIUtility.TrTextContent("Tree rendering doesn't support Light Probe Proxy Volume components."); + public static readonly GUIContent resProbesPerUnit = L10n.TextContent("Density", "Density in probes per world unit.", null, null); + public static readonly GUIContent componentUnusedNote = L10n.TextContent("In order to use the component on this game object, the Light Probes property should be set to 'Use Proxy Volume' in Renderer.", null, null, null); + public static readonly GUIContent noRendererNode = L10n.TextContent("The component is unused by this game object because there is no Renderer component attached.", null, null, null); + public static readonly GUIContent noLightProbes = L10n.TextContent("The scene doesn't contain any light probes. Add light probes using Light Probe Group components (menu: Component->Rendering->Light Probe Group).", null, null, null); + public static readonly GUIContent componentUnsuportedOnTreesNote = L10n.TextContent("Tree rendering doesn't support Light Probe Proxy Volume components.", null, null, null); public static readonly int[] volTextureSizesValues = { 1, 2, 4, 8, 16, 32 }; public static readonly GUIContent[] volTextureSizes = Array.ConvertAll(volTextureSizesValues, n => new GUIContent(n.ToString())); + // The captured GUIContent wraps the built-in "EditCollider" icon and a literal tooltip, + // neither of which a code reload affects, so this copy keeps behaving identically even after + // the shared instance it was taken from is replaced. +#pragma warning disable UAL0018 // captured content is reload-independent (built-in icon + literal tooltip) public static readonly GUIContent[] toolContents = { PrimitiveBoundsHandle.editModeButton, - EditorGUIUtility.TrIconContent("MoveTool", "Move the selected objects.") + L10n.IconContent("MoveTool", "Move the selected objects.", null) }; +#pragma warning restore UAL0018 public static readonly EditMode.SceneViewEditMode[] sceneViewEditModes = new[] { EditMode.SceneViewEditMode.LightProbeProxyVolumeBox, @@ -434,8 +438,7 @@ static Bounds GetBoundsOfTargets(IEnumerable targets) void OnEnable() { SetHidden(s_HideAll); - m_IconContent = EditorGUIUtility.TrIconContent(m_IconName, m_Description); + m_IconContent = L10n.IconContent(m_IconName, m_Description, null); } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/LightingSettingsEditor.cs b/Editor/Mono/Inspector/LightingSettingsEditor.cs index f7c16d857b..ab26480140 100644 --- a/Editor/Mono/Inspector/LightingSettingsEditor.cs +++ b/Editor/Mono/Inspector/LightingSettingsEditor.cs @@ -148,18 +148,18 @@ static partial class Styles public static readonly GUIContent[] k_BakeBackendStrings = { - EditorGUIUtility.TrTextContent("Progressive CPU (Deprecated)"), - EditorGUIUtility.TrTextContent("Progressive GPU") + L10n.TextContent("Progressive CPU (Deprecated)", null, null, null), + L10n.TextContent("Progressive GPU", null, null, null) }; static readonly GUIContent[] k_BakeBackendStringsWithUnityComputeGPU = - k_BakeBackendStrings.ConcatValue(EditorGUIUtility.TrTextContent("Unity Compute (GPU)")); + k_BakeBackendStrings.ConcatValue(L10n.TextContent("Unity Compute (GPU)", null, null, null)); public static GUIContent[] bakeBackendStrings => (UnityEditor.Rendering.EditorGraphicsSettings.defaultLightBaker == UnityEditor.Rendering.LightBaker.UnityComputeLightBaker) ? k_BakeBackendStringsWithUnityComputeGPU : k_BakeBackendStrings; public static readonly int[] lightmapDirectionalModeValues = { (int)LightmapsMode.NonDirectional, (int)LightmapsMode.CombinedDirectional }; public static readonly GUIContent[] lightmapDirectionalModeStrings = { - EditorGUIUtility.TrTextContent("Non-Directional"), - EditorGUIUtility.TrTextContent("Directional"), + L10n.TextContent("Non-Directional", null, null, null), + L10n.TextContent("Directional", null, null, null), }; public static readonly int[] lightmapMaxSizeValues = { 32, 64, 128, 256, 512, 1024, 2048, 4096 }; @@ -169,9 +169,9 @@ static partial class Styles public static readonly int[] mixedModeValues = { 0, 1, 2 }; public static readonly GUIContent[] mixedModeStrings = { - EditorGUIUtility.TrTextContent("Baked Indirect"), - EditorGUIUtility.TrTextContent("Subtractive"), - EditorGUIUtility.TrTextContent("Shadowmask") + L10n.TextContent("Baked Indirect", null, null, null), + L10n.TextContent("Subtractive", null, null, null), + L10n.TextContent("Shadowmask", null, null, null) }; // must match PVRDenoiserType @@ -185,9 +185,9 @@ static partial class Styles #pragma warning restore 618 public static readonly GUIContent[] denoiserTypeStrings = { - EditorGUIUtility.TrTextContent("Optix"), - EditorGUIUtility.TrTextContent("OpenImageDenoise"), - EditorGUIUtility.TrTextContent("None") + L10n.TextContent("Optix", null, null, null), + L10n.TextContent("OpenImageDenoise", null, null, null), + L10n.TextContent("None", null, null, null) }; public static readonly int[] lightmapCompressionValues = @@ -199,67 +199,69 @@ static partial class Styles }; public static readonly GUIContent[] lightmapCompressionStrings = { - EditorGUIUtility.TrTextContent("None"), - EditorGUIUtility.TrTextContent("Low Quality"), - EditorGUIUtility.TrTextContent("Normal Quality"), - EditorGUIUtility.TrTextContent("High Quality") + L10n.TextContent("None", null, null, null), + L10n.TextContent("Low Quality", null, null, null), + L10n.TextContent("Normal Quality", null, null, null), + L10n.TextContent("High Quality", null, null, null) }; public static readonly int[] concurrentJobsTypeValues = { (int)Lightmapping.ConcurrentJobsType.Min, (int)Lightmapping.ConcurrentJobsType.Low, (int)Lightmapping.ConcurrentJobsType.High }; public static readonly GUIContent[] concurrentJobsTypeStrings = { - EditorGUIUtility.TrTextContent("Min"), - EditorGUIUtility.TrTextContent("Low"), - EditorGUIUtility.TrTextContent("High") + L10n.TextContent("Min", null, null, null), + L10n.TextContent("Low", null, null, null), + L10n.TextContent("High", null, null, null) }; public static readonly int[] lightmapPackingModeValues = { (int)LightingSettings.LightmapPackingMode.Auto, (int)LightingSettings.LightmapPackingMode.Custom }; public static readonly GUIContent[] lightmapPackingModeStrings = { - EditorGUIUtility.TrTextContent("Auto"), - EditorGUIUtility.TrTextContent("Custom") + L10n.TextContent("Auto", null, null, null), + L10n.TextContent("Custom", null, null, null) }; public static readonly int[] lightmapPackingMethodValues = { (int)LightingSettings.LightmapPackingMethod.Unity, (int)LightingSettings.LightmapPackingMethod.XAtlas }; public static readonly GUIContent[] lightmapPackingMethodStrings = { - EditorGUIUtility.TrTextContent("Unity"), - EditorGUIUtility.TrTextContent("XAtlas") + L10n.TextContent("Unity", null, null, null), + L10n.TextContent("XAtlas", null, null, null) }; public static readonly int[] directLightSamplingModeValues = { 0, 1, 2 }; public static readonly GUIContent[] directLightSamplingModeStrings = { - EditorGUIUtility.TrTextContent("RIS"), - EditorGUIUtility.TrTextContent("Uniform"), - EditorGUIUtility.TrTextContent("Round Robin"), + L10n.TextContent("RIS", null, null, null), + L10n.TextContent("Uniform", null, null, null), + L10n.TextContent("Round Robin", null, null, null), }; public static readonly int[] indirectLightSamplingModeValues = { 0, 1 }; public static readonly GUIContent[] indirectLightSamplingModeStrings = { - EditorGUIUtility.TrTextContent("RIS"), - EditorGUIUtility.TrTextContent("Uniform"), + L10n.TextContent("RIS", null, null, null), + L10n.TextContent("Uniform", null, null, null), }; public static readonly int[] lightAccelerationStructureValues = { 0, 1 }; public static readonly GUIContent[] lightAccelerationStructureStrings = { - EditorGUIUtility.TrTextContent("Light Grid"), - EditorGUIUtility.TrTextContent("None"), + L10n.TextContent("Light Grid", null, null, null), + L10n.TextContent("None", null, null, null), }; public static readonly int[] emissiveSamplingModeValues = { 0, 1, 2 }; public static readonly GUIContent[] emissiveSamplingModeStrings = { - EditorGUIUtility.TrTextContent("Light Sampling"), - EditorGUIUtility.TrTextContent("BRDF Sampling"), - EditorGUIUtility.TrTextContent("MIS"), + L10n.TextContent("Light Sampling", null, null, null), + L10n.TextContent("BRDF Sampling", null, null, null), + L10n.TextContent("MIS", null, null, null), }; - public static readonly GUIContent lightmapperNotSupportedWarning = EditorGUIUtility.TrTextContent("This lightmapper is not supported by the current Render Pipeline. The Editor will use "); - public static readonly GUIContent progressiveCpuDeprecationWarning = EditorGUIUtility.TrTextContent("Progressive CPU will be removed in a future release. Please use the Unity Compute Light Baker instead."); - public static readonly GUIContent openGraphicsSettings = EditorGUIUtility.TrTextContent("Open", "Open the Graphics Settings and select the Default Light Baker."); + public static readonly GUIContent lightmapperNotSupportedWarning = L10n.TextContent("This lightmapper is not supported by the current Render Pipeline. The Editor will use ", null, null, null); + public static readonly GUIContent progressiveCpuDeprecationWarning = L10n.TextContent("Progressive CPU will be removed in a future release. Please use the Unity Compute Light Baker instead.", null, null, null); + public static readonly GUIContent openGraphicsSettings = L10n.TextContent("Open", "Open the Graphics Settings and select the Default Light Baker.", null, null); + public static readonly GUIContent enlightenDeprecationWarning = L10n.TextContent("Enlighten realtime Global Illumination is deprecated and will be removed in a future release.", null, null, null); + [NoAutoStaticsCleanup] // lazy GUIStyle derived from EditorStyles; holds no user-code refs, safe to persist across reload static GUIStyle s_DeprecationHelpBoxLabel; // wordWrappedLabel with a small vertical offset so the first line of text visually aligns with the icon. @@ -267,88 +269,88 @@ static partial class Styles { contentOffset = new Vector2(0, -3) }; - public static readonly GUIContent mixedModeNotSupportedWarning = EditorGUIUtility.TrTextContent("The Mixed mode is not supported by the current Render Pipeline. Fallback mode is "); - public static readonly GUIContent directionalNotSupportedWarning = EditorGUIUtility.TrTextContent("Directional Mode is not supported. Fallback will be Non-Directional."); - public static readonly GUIContent denoiserNotSupportedWarning = EditorGUIUtility.TrTextContent("The current hardware or system configuration does not support the selected denoiser. Select a different denoiser."); - - public static readonly GUIContent enableBaked = EditorGUIUtility.TrTextContent("Baked Global Illumination", "Controls whether Mixed and Baked lights will use baked Global Illumination. If enabled, Mixed lights are baked using the specified Lighting Mode and Baked lights will be completely baked and not adjustable at runtime."); - public static readonly GUIContent bounceScale = EditorGUIUtility.TrTextContent("Bounce Scale", "Multiplier for indirect lighting. Use with care."); - public static readonly GUIContent updateThreshold = EditorGUIUtility.TrTextContent("Update Threshold", "Threshold for updating realtime GI. A lower value causes more frequent updates (default 1.0)."); - public static readonly GUIContent albedoBoost = EditorGUIUtility.TrTextContent("Albedo Boost", "Controls the amount of light bounced between surfaces by intensifying the albedo of materials in the scene. Increasing this draws the albedo value towards white for indirect light computation. The default value is physically accurate."); - public static readonly GUIContent indirectOutputScale = EditorGUIUtility.TrTextContent("Indirect Intensity", "Controls the brightness of indirect light stored in realtime and baked lightmaps. A value above 1.0 will increase the intensity of indirect light while a value less than 1.0 will reduce indirect light intensity."); - public static readonly GUIContent lightmapDirectionalMode = EditorGUIUtility.TrTextContent("Directional Mode", "Controls whether baked and realtime lightmaps will store directional lighting information from the lighting environment. Options are Directional and Non-Directional."); - public static readonly GUIContent lightmapParameters = EditorGUIUtility.TrTextContent("Lightmap Parameters", "Allows the adjustment of advanced parameters that affect the process of generating a lightmap for an object using global illumination."); - public static readonly GUIContent newLightmapParameters = EditorGUIUtility.TrTextContent("New", "Create a new Lightmap Parameters Asset with default settings."); - public static readonly GUIContent cloneLightmapParameters = EditorGUIUtility.TrTextContent("Clone", "Create a new Lightmap Parameters Asset based on the current settings."); - public static readonly GUIContent realtimeLightsLabel = EditorGUIUtility.TrTextContent("Realtime Lighting", "Precompute Realtime indirect lighting for realtime lights and static objects. In this mode realtime lights, ambient lighting, materials of static objects (including emission) will generate indirect lighting at runtime. Only static objects are blocking and bouncing light, dynamic objects receive indirect lighting via light probes."); - public static readonly GUIContent realtimeEnvironmentLighting = EditorGUIUtility.TrTextContent("Realtime Environment Lighting", "Specifies the Global Illumination mode that should be used for handling ambient light in the Scene. This property is not editable unless both Realtime Global Illumination and Baked Global Illumination are enabled for the scene."); - public static readonly GUIContent mixedLightsLabel = EditorGUIUtility.TrTextContent("Mixed Lighting", "Bake Global Illumination for mixed lights and static objects. May bake both direct and/or indirect lighting based on settings. Only static objects are blocking and bouncing light, dynamic objects receive baked lighting via light probes."); - public static readonly GUIContent bakedLightingLabel = EditorGUIUtility.TrTextContent("Baked Lighting Settings", "Settings that apply to both Global Illumination modes (Precomputed Realtime and Baked)."); - public static readonly GUIContent internalLabel = EditorGUIUtility.TrTextContent("Internal Settings", "Internal only settings. "); - public static readonly GUIContent forceWhiteAlbedo = EditorGUIUtility.TrTextContent("Force White Albedo", "Force white albedo during lighting calculations."); - public static readonly GUIContent forceUpdates = EditorGUIUtility.TrTextContent("Force Updates", "Force continuous updates of runtime indirect lighting calculations."); - public static readonly GUIContent filterMode = EditorGUIUtility.TrTextContent("Filter Mode"); - public static readonly GUIContent exportTrainingData = EditorGUIUtility.TrTextContent("Export Training Data", "Exports unfiltered textures, normals, positions."); - public static readonly GUIContent trainingDataDestination = EditorGUIUtility.TrTextContent("Destination", "Destination for the training data, for example 'mysetup/30samples'. Will still be located at the first level in the project folder. "); - public static readonly GUIContent concurrentJobs = EditorGUIUtility.TrTextContent("Concurrent Jobs", "The amount of simultaneously scheduled jobs."); - public static readonly GUIContent indirectResolution = EditorGUIUtility.TrTextContent("Indirect Resolution", "Sets the resolution in texels that are used per unit for objects being lit by indirect lighting. The higher this value is, the more time the Editor needs to bake lighting."); - public static readonly GUIContent lightmapResolution = EditorGUIUtility.TrTextContent("Lightmap Resolution", "Sets the number of texels per unit assigned to objects receiving GI from lightmaps. Also affects the resolution of albedo and emission textures used in lighting calculations for both lightmaps and Light Probes. Higher values increase bake times."); - public static readonly GUIContent padding = EditorGUIUtility.TrTextContent("Lightmap Padding", "Sets the separation in texels between shapes in the baked lightmap."); - public static readonly GUIContent lightmapMaxSize = EditorGUIUtility.TrTextContent("Max Lightmap Size", "Sets the max size of the full lightmap Texture in pixels. Values are squared, so a setting of 1024 can produce a 1024x1024 pixel sized lightmap."); - public static readonly GUIContent lightmapSizeFixed = EditorGUIUtility.TrTextContent("Fixed Lightmap Size", "Forces all lightmap textures to use the same size. These can be no larger than Max Lightmap Size."); - public static readonly GUIContent enableWorkerProcessBaking = EditorGUIUtility.TrTextContent("Enable worker process baking", "Leaving this unchecked will force bakes that would otherwise be run in a worker process to be run in-process and blocking."); - public static readonly GUIContent useMipmapLimits = EditorGUIUtility.TrTextContent("Use Mipmap Limits", "Whether lightmap textures use the Global Mipmap limit defined in Quality Settings. Disable this to ensure lightmaps are available at the full mipmap resolution."); - public static readonly GUIContent lightmapCompression = EditorGUIUtility.TrTextContent("Lightmap Compression", "Compresses baked lightmaps created using this Lighting Settings Asset. Lower quality compression reduces memory and storage requirements, at the cost of more visual artifacts. Higher quality compression requires more memory and storage, but provides better visual results."); - public static readonly GUIContent ambientOcclusion = EditorGUIUtility.TrTextContent("Ambient Occlusion", "Specifies whether to include ambient occlusion or not in the baked lightmap result. Enabling this results in simulating the soft shadows that occur in cracks and crevices of objects when light is reflected onto them."); - public static readonly GUIContent ambientOcclusionContribution = EditorGUIUtility.TrTextContent("Indirect Contribution", "Adjusts the contrast of ambient occlusion applied to indirect lighting. The larger the value, the more contrast is applied to the ambient occlusion for indirect lighting."); - public static readonly GUIContent ambientOcclusionContributionDirect = EditorGUIUtility.TrTextContent("Direct Contribution", "Adjusts the contrast of ambient occlusion applied to the direct lighting. The larger the value is, the more contrast is applied to the ambient occlusion for direct lighting. This effect is not physically accurate."); - public static readonly GUIContent AOMaxDistance = EditorGUIUtility.TrTextContent("Max Distance", "Controls how far rays are cast in order to determine if an object is occluded or not. A larger value produces longer rays and contributes more shadows to the lightmap, while a smaller value produces shorter rays that contribute shadows only when objects are very close to one another. A value of 0 casts an infinitely long ray that has no maximum distance."); - public static readonly GUIContent mixedLightMode = EditorGUIUtility.TrTextContent("Lighting Mode", "Specifies the lighting mode of all Mixed lights in the Scene."); - public static readonly GUIContent useRealtimeGI = EditorGUIUtility.TrTextContent("Realtime Global Illumination", "Precomputed Realtime Global Illumination using Enlighten. Provides diffuse Realtime Global Illumination for static geometry via low resolution lightmaps and via Light Probes for dynamic geometry."); - public static readonly GUIContent bakedGIDisabledInfo = EditorGUIUtility.TrTextContent("All Baked and Mixed lights in the Scene are currently being overridden to Realtime light modes. Enable Baked Global Illumination to allow the use of Baked and Mixed light modes."); - public static readonly GUIContent bakeBackend = EditorGUIUtility.TrTextContent("Lightmapper", "Specifies which baking system will be used to generate baked lightmaps."); - public static readonly GUIContent generalBakingSettings = EditorGUIUtility.TrTextContent("General Settings", "Specifies general settings for baked lighting."); - public static readonly GUIContent directSampleCount = EditorGUIUtility.TrTextContent("Direct Samples", "Controls the number of samples the lightmapper will use for direct lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete."); - public static readonly GUIContent indirectSampleCount = EditorGUIUtility.TrTextContent("Indirect Samples", "Controls the number of samples the lightmapper will use for indirect lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete."); - public static readonly GUIContent bounces = EditorGUIUtility.TrTextContent("Max Bounces", "The maximum number of bounces the Lightmapper computes for indirect lighting."); - public static readonly GUIContent denoisingWarningDirect = EditorGUIUtility.TrTextContent("Direct Denoiser", "Your hardware does not support denoising. For minimum requirements, please read the documentation."); - public static readonly GUIContent denoisingWarningIndirect = EditorGUIUtility.TrTextContent("Indirect Denoiser", "Your hardware does not support denoising. For minimum requirements, please read the documentation."); - public static readonly GUIContent denoisingWarningAO = EditorGUIUtility.TrTextContent("Ambient Occlusion Denoiser", "Your hardware Your hardware does not support denoising. For minimum requirements, please read the documentation."); - public static readonly GUIContent denoiserTypeDirect = EditorGUIUtility.TrTextContent("Direct Denoiser", "Specifies the type of denoiser used to reduce noise for direct lights."); - public static readonly GUIContent denoiserTypeIndirect = EditorGUIUtility.TrTextContent("Indirect Denoiser", "Specifies the type of denoiser used to reduce noise for indirect lights."); - public static readonly GUIContent denoiserTypeAO = EditorGUIUtility.TrTextContent("Ambient Occlusion Denoiser", "Specifies the type of denoiser used to reduce noise for ambient occlusion."); - public static readonly GUIContent filteringMode = EditorGUIUtility.TrTextContent("Filtering", "Specifies the method to reduce noise in baked lightmaps."); - public static readonly GUIContent filterTypeDirect = EditorGUIUtility.TrTextContent("Direct Filter", "Specifies the filter kernel applied to the direct light stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail."); - public static readonly GUIContent filterTypeIndirect = EditorGUIUtility.TrTextContent("Indirect Filter", "Specifies the filter kernel applied to the indirect light stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail."); - public static readonly GUIContent filterTypeAO = EditorGUIUtility.TrTextContent("Ambient Occlusion Filter", "Specifies the filter kernel applied to the ambient occlusion stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail."); - public static readonly GUIContent filteringGaussRadiusDirect = EditorGUIUtility.TrTextContent("Radius", "Controls the radius of the filter for direct light stored in the lightmap. A higher value gives a stronger blur and less noise."); - public static readonly GUIContent filteringGaussRadiusIndirect = EditorGUIUtility.TrTextContent("Radius", "Controls the radius of the filter for indirect light stored in the lightmap. A higher value gives a stronger blur and less noise."); - public static readonly GUIContent filteringGaussRadiusAO = EditorGUIUtility.TrTextContent("Radius", "Controls the radius of the filter for ambient occlusion stored in the lightmap. A higher value gives a stronger blur and less noise."); - public static readonly GUIContent filteringAtrousPositionSigmaDirect = EditorGUIUtility.TrTextContent("Sigma", "Controls the threshold of the filter for direct light stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap."); - public static readonly GUIContent filteringAtrousPositionSigmaIndirect = EditorGUIUtility.TrTextContent("Sigma", "Controls the threshold of the filter for indirect light stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap."); - public static readonly GUIContent filteringAtrousPositionSigmaAO = EditorGUIUtility.TrTextContent("Sigma", "Controls the threshold of the filter for ambient occlusion stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap."); - public static readonly GUIContent culling = EditorGUIUtility.TrTextContent("Progressive Updates", "Specifies whether the lightmapper should prioritize baking what is visible in the scene view. When disabled, lightmaps are only composited once fully converged which can improve baking performance."); - public static readonly GUIContent environmentImportanceSampling = EditorGUIUtility.TrTextContent("Importance Sampling", "Specifies whether to use importance sampling for sampling environment lighting. In most environments importance sampling facilitates faster convergence while generating lightmaps. In certain low frequency environments, importance sampling can produce noisy results."); - public static readonly GUIContent environmentSampleCount = EditorGUIUtility.TrTextContent("Environment Samples", "Controls the number of samples the lightmapper will use for environment lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete."); - public static readonly GUIContent probeSampleCountMultiplier = EditorGUIUtility.TrTextContent("Light Probe Sample Multiplier", "Controls how many samples are used for Light Probes as a multiplier of the general sample counts above. Higher values improve the quality of Light Probes, but also take longer to bake. Enable the Light Probe sample count multiplier by disabling Project Settings > Editor > Use legacy Light Probe sample counts"); - public static readonly GUIContent texelsPerUnit = EditorGUIUtility.TrTextContent(" texels per unit"); - public static readonly GUIContent texels = EditorGUIUtility.TrTextContent(" texels"); - public static readonly GUIContent sigma = EditorGUIUtility.TrTextContent(" sigma"); - public static readonly GUIContent lightmapPackingMode = EditorGUIUtility.TrTextContent("Lightmap Packing", "The approach used to pack UVs into lightmap atlases. Auto uses generalized settings that produce reasonable results in most cases."); - public static readonly GUIContent lightmapPackingMethod = EditorGUIUtility.TrTextContent("Packing Method", "The algorithm used to pack lightmap charts into Scene atlases. XAtlas method provides additional controls to ensure efficient packing. Unity method enables compatibility with older Unity versions."); - public static readonly GUIContent xAtlasPackingAttempts = EditorGUIUtility.TrTextContent("Packing Iterations", "The number of packing attempts before determining the most efficient layout. Higher values may produce more efficient layouts but take longer to calculate."); - public static readonly GUIContent xAtlasBlockAlign = EditorGUIUtility.TrTextContent("Block Aligned Packing", "Aligns UV charts in the lightmap to 4x4 texel boundaries. Mitigates artifacts caused by block texture compression but may reduce the efficiency of packing."); - public static readonly GUIContent xAtlasRepackUnderutilizedLightmaps = EditorGUIUtility.TrTextContent("Repack Underused Lightmaps", "Repack low occupancy lightmaps into smaller sizes. Reduces memory usage but may increase baking time and the number of textures."); - - public static readonly GUIContent lightSamplingSettings = EditorGUIUtility.TrTextContent("Light Sampling Settings", "Settings related to sampling of lights during baking."); - public static readonly GUIContent directLightSamplingMode = EditorGUIUtility.TrTextContent("Direct Light Sampling Mode", "The algorithm used to sample direct contribution from lights."); - public static readonly GUIContent directRisCandidateCount = EditorGUIUtility.TrTextContent("Direct RIS Candidate Count", "The amount of candidates to consider for each sample when using RIS for direct light sampling."); - public static readonly GUIContent indirectLightSamplingMode = EditorGUIUtility.TrTextContent("Indirect Light Sampling Mode", "The algorithm used to sample indirect contribution from lights."); - public static readonly GUIContent indirectRisCandidateCount = EditorGUIUtility.TrTextContent("Indirect RIS Candidate Count", "The amount of candidates to consider for each sample when using RIS for indirect light sampling."); - public static readonly GUIContent lightAccelerationStructure = EditorGUIUtility.TrTextContent("Light Acceleration Structure", "The type of acceleration structure to use for light picking."); - public static readonly GUIContent lightGridMaxCells = EditorGUIUtility.TrTextContent("Light Grid Max Cells", "The maximum amount of grid cells to use for the light grid. Higher numbers result in denser grids."); - public static readonly GUIContent directEmissiveSamplingMode = EditorGUIUtility.TrTextContent("Direct Emissive Sampling Mode", "The algorithm used to sample direct contribution from emissive meshes."); - public static readonly GUIContent indirectEmissiveSamplingMode = EditorGUIUtility.TrTextContent("Indirect Emissive Sampling Mode", "The algorithm used to sample indirect contribution from emissive meshes."); + public static readonly GUIContent mixedModeNotSupportedWarning = L10n.TextContent("The Mixed mode is not supported by the current Render Pipeline. Fallback mode is ", null, null, null); + public static readonly GUIContent directionalNotSupportedWarning = L10n.TextContent("Directional Mode is not supported. Fallback will be Non-Directional.", null, null, null); + public static readonly GUIContent denoiserNotSupportedWarning = L10n.TextContent("The current hardware or system configuration does not support the selected denoiser. Select a different denoiser.", null, null, null); + + public static readonly GUIContent enableBaked = L10n.TextContent("Baked Global Illumination", "Controls whether Mixed and Baked lights will use baked Global Illumination. If enabled, Mixed lights are baked using the specified Lighting Mode and Baked lights will be completely baked and not adjustable at runtime.", null, null); + public static readonly GUIContent bounceScale = L10n.TextContent("Bounce Scale", "Multiplier for indirect lighting. Use with care.", null, null); + public static readonly GUIContent updateThreshold = L10n.TextContent("Update Threshold", "Threshold for updating realtime GI. A lower value causes more frequent updates (default 1.0).", null, null); + public static readonly GUIContent albedoBoost = L10n.TextContent("Albedo Boost", "Controls the amount of light bounced between surfaces by intensifying the albedo of materials in the scene. Increasing this draws the albedo value towards white for indirect light computation. The default value is physically accurate.", null, null); + public static readonly GUIContent indirectOutputScale = L10n.TextContent("Indirect Intensity", "Controls the brightness of indirect light stored in realtime and baked lightmaps. A value above 1.0 will increase the intensity of indirect light while a value less than 1.0 will reduce indirect light intensity.", null, null); + public static readonly GUIContent lightmapDirectionalMode = L10n.TextContent("Directional Mode", "Controls whether baked and realtime lightmaps will store directional lighting information from the lighting environment. Options are Directional and Non-Directional.", null, null); + public static readonly GUIContent lightmapParameters = L10n.TextContent("Lightmap Parameters", "Allows the adjustment of advanced parameters that affect the process of generating a lightmap for an object using global illumination.", null, null); + public static readonly GUIContent newLightmapParameters = L10n.TextContent("New", "Create a new Lightmap Parameters Asset with default settings.", null, null); + public static readonly GUIContent cloneLightmapParameters = L10n.TextContent("Clone", "Create a new Lightmap Parameters Asset based on the current settings.", null, null); + public static readonly GUIContent realtimeLightsLabel = L10n.TextContent("Realtime Lighting", "Precompute Realtime indirect lighting for realtime lights and static objects. In this mode realtime lights, ambient lighting, materials of static objects (including emission) will generate indirect lighting at runtime. Only static objects are blocking and bouncing light, dynamic objects receive indirect lighting via light probes.", null, null); + public static readonly GUIContent realtimeEnvironmentLighting = L10n.TextContent("Realtime Environment Lighting", "Specifies the Global Illumination mode that should be used for handling ambient light in the Scene. This property is not editable unless both Realtime Global Illumination and Baked Global Illumination are enabled for the scene.", null, null); + public static readonly GUIContent mixedLightsLabel = L10n.TextContent("Mixed Lighting", "Bake Global Illumination for mixed lights and static objects. May bake both direct and/or indirect lighting based on settings. Only static objects are blocking and bouncing light, dynamic objects receive baked lighting via light probes.", null, null); + public static readonly GUIContent bakedLightingLabel = L10n.TextContent("Baked Lighting Settings", "Settings that apply to both Global Illumination modes (Precomputed Realtime and Baked).", null, null); + public static readonly GUIContent internalLabel = L10n.TextContent("Internal Settings", "Internal only settings. ", null, null); + public static readonly GUIContent forceWhiteAlbedo = L10n.TextContent("Force White Albedo", "Force white albedo during lighting calculations.", null, null); + public static readonly GUIContent forceUpdates = L10n.TextContent("Force Updates", "Force continuous updates of runtime indirect lighting calculations.", null, null); + public static readonly GUIContent filterMode = L10n.TextContent("Filter Mode", null, null, null); + public static readonly GUIContent exportTrainingData = L10n.TextContent("Export Training Data", "Exports unfiltered textures, normals, positions.", null, null); + public static readonly GUIContent trainingDataDestination = L10n.TextContent("Destination", "Destination for the training data, for example 'mysetup/30samples'. Will still be located at the first level in the project folder. ", null, null); + public static readonly GUIContent concurrentJobs = L10n.TextContent("Concurrent Jobs", "The amount of simultaneously scheduled jobs.", null, null); + public static readonly GUIContent indirectResolution = L10n.TextContent("Indirect Resolution", "Sets the resolution in texels that are used per unit for objects being lit by indirect lighting. The higher this value is, the more time the Editor needs to bake lighting.", null, null); + public static readonly GUIContent lightmapResolution = L10n.TextContent("Lightmap Resolution", "Sets the number of texels per unit assigned to objects receiving GI from lightmaps. Also affects the resolution of albedo and emission textures used in lighting calculations for both lightmaps and Light Probes. Higher values increase bake times.", null, null); + public static readonly GUIContent padding = L10n.TextContent("Lightmap Padding", "Sets the separation in texels between shapes in the baked lightmap.", null, null); + public static readonly GUIContent lightmapMaxSize = L10n.TextContent("Max Lightmap Size", "Sets the max size of the full lightmap Texture in pixels. Values are squared, so a setting of 1024 can produce a 1024x1024 pixel sized lightmap.", null, null); + public static readonly GUIContent lightmapSizeFixed = L10n.TextContent("Fixed Lightmap Size", "Forces all lightmap textures to use the same size. These can be no larger than Max Lightmap Size.", null, null); + public static readonly GUIContent enableWorkerProcessBaking = L10n.TextContent("Enable worker process baking", "Leaving this unchecked will force bakes that would otherwise be run in a worker process to be run in-process and blocking.", null, null); + public static readonly GUIContent useMipmapLimits = L10n.TextContent("Use Mipmap Limits", "Whether lightmap textures use the Global Mipmap limit defined in Quality Settings. Disable this to ensure lightmaps are available at the full mipmap resolution.", null, null); + public static readonly GUIContent lightmapCompression = L10n.TextContent("Lightmap Compression", "Compresses baked lightmaps created using this Lighting Settings Asset. Lower quality compression reduces memory and storage requirements, at the cost of more visual artifacts. Higher quality compression requires more memory and storage, but provides better visual results.", null, null); + public static readonly GUIContent ambientOcclusion = L10n.TextContent("Ambient Occlusion", "Specifies whether to include ambient occlusion or not in the baked lightmap result. Enabling this results in simulating the soft shadows that occur in cracks and crevices of objects when light is reflected onto them.", null, null); + public static readonly GUIContent ambientOcclusionContribution = L10n.TextContent("Indirect Contribution", "Adjusts the contrast of ambient occlusion applied to indirect lighting. The larger the value, the more contrast is applied to the ambient occlusion for indirect lighting.", null, null); + public static readonly GUIContent ambientOcclusionContributionDirect = L10n.TextContent("Direct Contribution", "Adjusts the contrast of ambient occlusion applied to the direct lighting. The larger the value is, the more contrast is applied to the ambient occlusion for direct lighting. This effect is not physically accurate.", null, null); + public static readonly GUIContent AOMaxDistance = L10n.TextContent("Max Distance", "Controls how far rays are cast in order to determine if an object is occluded or not. A larger value produces longer rays and contributes more shadows to the lightmap, while a smaller value produces shorter rays that contribute shadows only when objects are very close to one another. A value of 0 casts an infinitely long ray that has no maximum distance.", null, null); + public static readonly GUIContent mixedLightMode = L10n.TextContent("Lighting Mode", "Specifies the lighting mode of all Mixed lights in the Scene.", null, null); + public static readonly GUIContent useRealtimeGI = L10n.TextContent("Realtime Global Illumination", "Precomputed Realtime Global Illumination using Enlighten. Provides diffuse Realtime Global Illumination for static geometry via low resolution lightmaps and via Light Probes for dynamic geometry.", null, null); + public static readonly GUIContent bakedGIDisabledInfo = L10n.TextContent("All Baked and Mixed lights in the Scene are currently being overridden to Realtime light modes. Enable Baked Global Illumination to allow the use of Baked and Mixed light modes.", null, null, null); + public static readonly GUIContent bakeBackend = L10n.TextContent("Lightmapper", "Specifies which baking system will be used to generate baked lightmaps.", null, null); + public static readonly GUIContent generalBakingSettings = L10n.TextContent("General Settings", "Specifies general settings for baked lighting.", null, null); + public static readonly GUIContent directSampleCount = L10n.TextContent("Direct Samples", "Controls the number of samples the lightmapper will use for direct lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete.", null, null); + public static readonly GUIContent indirectSampleCount = L10n.TextContent("Indirect Samples", "Controls the number of samples the lightmapper will use for indirect lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete.", null, null); + public static readonly GUIContent bounces = L10n.TextContent("Max Bounces", "The maximum number of bounces the Lightmapper computes for indirect lighting.", null, null); + public static readonly GUIContent denoisingWarningDirect = L10n.TextContent("Direct Denoiser", "Your hardware does not support denoising. For minimum requirements, please read the documentation.", null, null); + public static readonly GUIContent denoisingWarningIndirect = L10n.TextContent("Indirect Denoiser", "Your hardware does not support denoising. For minimum requirements, please read the documentation.", null, null); + public static readonly GUIContent denoisingWarningAO = L10n.TextContent("Ambient Occlusion Denoiser", "Your hardware Your hardware does not support denoising. For minimum requirements, please read the documentation.", null, null); + public static readonly GUIContent denoiserTypeDirect = L10n.TextContent("Direct Denoiser", "Specifies the type of denoiser used to reduce noise for direct lights.", null, null); + public static readonly GUIContent denoiserTypeIndirect = L10n.TextContent("Indirect Denoiser", "Specifies the type of denoiser used to reduce noise for indirect lights.", null, null); + public static readonly GUIContent denoiserTypeAO = L10n.TextContent("Ambient Occlusion Denoiser", "Specifies the type of denoiser used to reduce noise for ambient occlusion.", null, null); + public static readonly GUIContent filteringMode = L10n.TextContent("Filtering", "Specifies the method to reduce noise in baked lightmaps.", null, null); + public static readonly GUIContent filterTypeDirect = L10n.TextContent("Direct Filter", "Specifies the filter kernel applied to the direct light stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail.", null, null); + public static readonly GUIContent filterTypeIndirect = L10n.TextContent("Indirect Filter", "Specifies the filter kernel applied to the indirect light stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail.", null, null); + public static readonly GUIContent filterTypeAO = L10n.TextContent("Ambient Occlusion Filter", "Specifies the filter kernel applied to the ambient occlusion stored in the lightmap. Gaussian blurs the lightmap with some loss of detail. A-Trous reduces noise based on a threshold while maintaining edge detail.", null, null); + public static readonly GUIContent filteringGaussRadiusDirect = L10n.TextContent("Radius", "Controls the radius of the filter for direct light stored in the lightmap. A higher value gives a stronger blur and less noise.", null, null); + public static readonly GUIContent filteringGaussRadiusIndirect = L10n.TextContent("Radius", "Controls the radius of the filter for indirect light stored in the lightmap. A higher value gives a stronger blur and less noise.", null, null); + public static readonly GUIContent filteringGaussRadiusAO = L10n.TextContent("Radius", "Controls the radius of the filter for ambient occlusion stored in the lightmap. A higher value gives a stronger blur and less noise.", null, null); + public static readonly GUIContent filteringAtrousPositionSigmaDirect = L10n.TextContent("Sigma", "Controls the threshold of the filter for direct light stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap.", null, null); + public static readonly GUIContent filteringAtrousPositionSigmaIndirect = L10n.TextContent("Sigma", "Controls the threshold of the filter for indirect light stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap.", null, null); + public static readonly GUIContent filteringAtrousPositionSigmaAO = L10n.TextContent("Sigma", "Controls the threshold of the filter for ambient occlusion stored in the lightmap. A higher value increases the threshold, which reduces noise in the direct layer of the lightmap. Too high of a value can cause a loss of detail in the lightmap.", null, null); + public static readonly GUIContent culling = L10n.TextContent("Progressive Updates", "Specifies whether the lightmapper should prioritize baking what is visible in the scene view. When disabled, lightmaps are only composited once fully converged which can improve baking performance.", null, null); + public static readonly GUIContent environmentImportanceSampling = L10n.TextContent("Importance Sampling", "Specifies whether to use importance sampling for sampling environment lighting. In most environments importance sampling facilitates faster convergence while generating lightmaps. In certain low frequency environments, importance sampling can produce noisy results.", null, null); + public static readonly GUIContent environmentSampleCount = L10n.TextContent("Environment Samples", "Controls the number of samples the lightmapper will use for environment lighting calculations. Increasing this value may improve the quality of lightmaps but increases the time required for baking to complete.", null, null); + public static readonly GUIContent probeSampleCountMultiplier = L10n.TextContent("Light Probe Sample Multiplier", "Controls how many samples are used for Light Probes as a multiplier of the general sample counts above. Higher values improve the quality of Light Probes, but also take longer to bake. Enable the Light Probe sample count multiplier by disabling Project Settings > Editor > Use legacy Light Probe sample counts", null, null); + public static readonly GUIContent texelsPerUnit = L10n.TextContent(" texels per unit", null, null, null); + public static readonly GUIContent texels = L10n.TextContent(" texels", null, null, null); + public static readonly GUIContent sigma = L10n.TextContent(" sigma", null, null, null); + public static readonly GUIContent lightmapPackingMode = L10n.TextContent("Lightmap Packing", "The approach used to pack UVs into lightmap atlases. Auto uses generalized settings that produce reasonable results in most cases.", null, null); + public static readonly GUIContent lightmapPackingMethod = L10n.TextContent("Packing Method", "The algorithm used to pack lightmap charts into Scene atlases. XAtlas method provides additional controls to ensure efficient packing. Unity method enables compatibility with older Unity versions.", null, null); + public static readonly GUIContent xAtlasPackingAttempts = L10n.TextContent("Packing Iterations", "The number of packing attempts before determining the most efficient layout. Higher values may produce more efficient layouts but take longer to calculate.", null, null); + public static readonly GUIContent xAtlasBlockAlign = L10n.TextContent("Block Aligned Packing", "Aligns UV charts in the lightmap to 4x4 texel boundaries. Mitigates artifacts caused by block texture compression but may reduce the efficiency of packing.", null, null); + public static readonly GUIContent xAtlasRepackUnderutilizedLightmaps = L10n.TextContent("Repack Underused Lightmaps", "Repack low occupancy lightmaps into smaller sizes. Reduces memory usage but may increase baking time and the number of textures.", null, null); + + public static readonly GUIContent lightSamplingSettings = L10n.TextContent("Light Sampling Settings", "Settings related to sampling of lights during baking.", null, null); + public static readonly GUIContent directLightSamplingMode = L10n.TextContent("Direct Light Sampling Mode", "The algorithm used to sample direct contribution from lights.", null, null); + public static readonly GUIContent directRisCandidateCount = L10n.TextContent("Direct RIS Candidate Count", "The amount of candidates to consider for each sample when using RIS for direct light sampling.", null, null); + public static readonly GUIContent indirectLightSamplingMode = L10n.TextContent("Indirect Light Sampling Mode", "The algorithm used to sample indirect contribution from lights.", null, null); + public static readonly GUIContent indirectRisCandidateCount = L10n.TextContent("Indirect RIS Candidate Count", "The amount of candidates to consider for each sample when using RIS for indirect light sampling.", null, null); + public static readonly GUIContent lightAccelerationStructure = L10n.TextContent("Light Acceleration Structure", "The type of acceleration structure to use for light picking.", null, null); + public static readonly GUIContent lightGridMaxCells = L10n.TextContent("Light Grid Max Cells", "The maximum amount of grid cells to use for the light grid. Higher numbers result in denser grids.", null, null); + public static readonly GUIContent directEmissiveSamplingMode = L10n.TextContent("Direct Emissive Sampling Mode", "The algorithm used to sample direct contribution from emissive meshes.", null, null); + public static readonly GUIContent indirectEmissiveSamplingMode = L10n.TextContent("Indirect Emissive Sampling Mode", "The algorithm used to sample indirect contribution from emissive meshes.", null, null); public static readonly GUIStyle labelStyle = EditorStyles.wordWrappedMiniLabel; } @@ -485,6 +487,9 @@ void RealtimeLightingGUI(bool compact) bool enableRealtimeGI = (m_EnableRealtimeGI.boolValue && !m_EnableRealtimeGI.hasMultipleDifferentValues); bool enableBakedGI = (m_EnabledBakedGI.boolValue && !m_EnabledBakedGI.hasMultipleDifferentValues); + if (enableRealtimeGI) + EditorGUILayout.HelpBox(Styles.enlightenDeprecationWarning.text, MessageType.Warning); + if (enableBakedGI && enableRealtimeGI) { // if the user has selected the only state that is supported, then gray it out diff --git a/Editor/Mono/Inspector/LineRendererCurveEditor.cs b/Editor/Mono/Inspector/LineRendererCurveEditor.cs index 5d94be8500..4d8caa9bba 100644 --- a/Editor/Mono/Inspector/LineRendererCurveEditor.cs +++ b/Editor/Mono/Inspector/LineRendererCurveEditor.cs @@ -10,7 +10,7 @@ internal class LineRendererCurveEditor { private class Styles { - public static readonly GUIContent widthMultiplier = EditorGUIUtility.TrTextContent("Width", "The multiplier applied to the curve, describing the width (in world space) along the line."); + public static readonly GUIContent widthMultiplier = L10n.TextContent("Width", "The multiplier applied to the curve, describing the width (in world space) along the line.", null, null); } private bool m_Refresh = false; diff --git a/Editor/Mono/Inspector/LineRendererEditor.cs b/Editor/Mono/Inspector/LineRendererEditor.cs index 7e98e8e4c8..ea6da03378 100644 --- a/Editor/Mono/Inspector/LineRendererEditor.cs +++ b/Editor/Mono/Inspector/LineRendererEditor.cs @@ -17,28 +17,28 @@ internal class LineRendererInspector : RendererEditorBase { class Styles { - public static readonly GUIContent alignment = EditorGUIUtility.TrTextContent("Alignment", "Lines can rotate to face their transform component or the camera. When using Local mode, lines face the XY plane of the Transform."); - public static readonly GUIContent colorGradient = EditorGUIUtility.TrTextContent("Color", "The gradient describing the color along the line."); + public static readonly GUIContent alignment = L10n.TextContent("Alignment", "Lines can rotate to face their transform component or the camera. When using Local mode, lines face the XY plane of the Transform.", null, null); + public static readonly GUIContent colorGradient = L10n.TextContent("Color", "The gradient describing the color along the line.", null, null); public static readonly string disabledEditMessage = L10n.Tr("Editing is only available when editing a single LineRenderer in a scene.", null); - public static readonly GUIContent inputMode = EditorGUIUtility.TrTextContent("Input", "Use mouse position or physics raycast to determine where to create points."); - public static readonly GUIContent layerMask = EditorGUIUtility.TrTextContent("Layer Mask", "The layer mask to use when performing raycasts."); - public static readonly GUIContent normalOffset = EditorGUIUtility.TrTextContent("Offset", "The offset applied to created points either from the scene camera or raycast normal, when using physics."); - public static readonly GUIContent numCapVertices = EditorGUIUtility.TrTextContent("End Cap Vertices", "How many vertices to add at each end."); - public static readonly GUIContent numCornerVertices = EditorGUIUtility.TrTextContent("Corner Vertices", "How many vertices to add for each corner."); - public static readonly GUIContent pointSeparation = EditorGUIUtility.TrTextContent("Min Vertex Distance", "When dragging the mouse, a new point will be created after the distance has been exceeded."); - public static readonly GUIContent positions = EditorGUIUtility.TrTextContent("Positions"); - public static readonly GUIContent propertyMenuContent = EditorGUIUtility.TrTextContent("Delete Selected Array Elements"); - public static readonly GUIContent showWireframe = EditorGUIUtility.TrTextContent("Show Wireframe", "Show the wireframe visualizing the line."); - public static readonly GUIContent simplify = EditorGUIUtility.TrTextContent("Simplify", "Generates a simplified version of the original line by removing points that fall within the specified tolerance."); - public static readonly GUIContent simplifyPreview = EditorGUIUtility.TrTextContent("Simplify Preview", "Show a preview of the simplified version of the line."); - public static readonly GUIContent subdivide = EditorGUIUtility.TrTextContent("Subdivide Selected" , "Inserts a new point in between selected adjacent points."); - public static readonly GUIContent textureMode = EditorGUIUtility.TrTextContent("Texture Mode", "Should the U coordinate be stretched or tiled?"); - public static readonly GUIContent textureScale = EditorGUIUtility.TrTextContent("Texture Scale", "Scale the texture along the UV coordinates using this multiplier."); - public static readonly GUIContent tolerance = EditorGUIUtility.TrTextContent("Tolerance", "Used to evaluate which points should be removed from the line. A higher value results in a simpler line (fewer points). A value of 0 results in the exact same line with little to no reduction."); - public static readonly GUIContent shadowBias = EditorGUIUtility.TrTextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the line width at each segment."); - public static readonly GUIContent generateLightingData = EditorGUIUtility.TrTextContent("Generate Lighting Data", "Toggle generation of normal and tangent data, for use in lit shaders."); - public static readonly GUIContent sceneTools = EditorGUIUtility.TrTextContent("Scene Tools"); - public static readonly GUIContent applyActiveColorSpace = EditorGUIUtility.TrTextContent("Apply Active Color Space", "When using Linear Rendering, colors will be converted appropriately before being passed to the GPU."); + public static readonly GUIContent inputMode = L10n.TextContent("Input", "Use mouse position or physics raycast to determine where to create points.", null, null); + public static readonly GUIContent layerMask = L10n.TextContent("Layer Mask", "The layer mask to use when performing raycasts.", null, null); + public static readonly GUIContent normalOffset = L10n.TextContent("Offset", "The offset applied to created points either from the scene camera or raycast normal, when using physics.", null, null); + public static readonly GUIContent numCapVertices = L10n.TextContent("End Cap Vertices", "How many vertices to add at each end.", null, null); + public static readonly GUIContent numCornerVertices = L10n.TextContent("Corner Vertices", "How many vertices to add for each corner.", null, null); + public static readonly GUIContent pointSeparation = L10n.TextContent("Min Vertex Distance", "When dragging the mouse, a new point will be created after the distance has been exceeded.", null, null); + public static readonly GUIContent positions = L10n.TextContent("Positions", null, null, null); + public static readonly GUIContent propertyMenuContent = L10n.TextContent("Delete Selected Array Elements", null, null, null); + public static readonly GUIContent showWireframe = L10n.TextContent("Show Wireframe", "Show the wireframe visualizing the line.", null, null); + public static readonly GUIContent simplify = L10n.TextContent("Simplify", "Generates a simplified version of the original line by removing points that fall within the specified tolerance.", null, null); + public static readonly GUIContent simplifyPreview = L10n.TextContent("Simplify Preview", "Show a preview of the simplified version of the line.", null, null); + public static readonly GUIContent subdivide = L10n.TextContent("Subdivide Selected" , "Inserts a new point in between selected adjacent points.", null, null); + public static readonly GUIContent textureMode = L10n.TextContent("Texture Mode", "Should the U coordinate be stretched or tiled?", null, null); + public static readonly GUIContent textureScale = L10n.TextContent("Texture Scale", "Scale the texture along the UV coordinates using this multiplier.", null, null); + public static readonly GUIContent tolerance = L10n.TextContent("Tolerance", "Used to evaluate which points should be removed from the line. A higher value results in a simpler line (fewer points). A value of 0 results in the exact same line with little to no reduction.", null, null); + public static readonly GUIContent shadowBias = L10n.TextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the line width at each segment.", null, null); + public static readonly GUIContent generateLightingData = L10n.TextContent("Generate Lighting Data", "Toggle generation of normal and tangent data, for use in lit shaders.", null, null); + public static readonly GUIContent sceneTools = L10n.TextContent("Scene Tools", null, null, null); + public static readonly GUIContent applyActiveColorSpace = L10n.TextContent("Apply Active Color Space", "When using Linear Rendering, colors will be converted appropriately before being passed to the GPU.", null, null); } abstract class LineRendererTool : EditorTool @@ -99,7 +99,7 @@ class LineRendererEditPointsTool : LineRendererTool { public override GUIContent toolbarIcon { - get { return EditorGUIUtility.TrIconContent("EditCollider", "Edit LineRenderer Points in the Scene View."); } + get { return L10n.IconContent("EditCollider", "Edit LineRenderer Points in the Scene View.", null); } } public override void OnToolGUI(EditorWindow window) @@ -189,7 +189,7 @@ class LineRendererAddPointsTool : LineRendererTool { public override GUIContent toolbarIcon { - get { return EditorGUIUtility.TrIconContent("Toolbar Plus", "Create LineRenderer Points in the Scene View."); } + get { return L10n.IconContent("Toolbar Plus", "Create LineRenderer Points in the Scene View.", null); } } public override void OnToolGUI(EditorWindow window) diff --git a/Editor/Mono/Inspector/LookAtConstraintEditor.cs b/Editor/Mono/Inspector/LookAtConstraintEditor.cs index 557977bda0..484d7a6391 100644 --- a/Editor/Mono/Inspector/LookAtConstraintEditor.cs +++ b/Editor/Mono/Inspector/LookAtConstraintEditor.cs @@ -33,11 +33,11 @@ internal class LookAtConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_RotationAtRest = EditorGUIUtility.TrTextContent("Rotation At Rest", "The orientation of the constrained object when the weights of the sources add up to zero or when all the rotation axes are disabled."); - GUIContent m_RotationOffset = EditorGUIUtility.TrTextContent("Rotation Offset", "The offset from the constrained orientation."); - GUIContent m_WorldUpObject = EditorGUIUtility.TrTextContent("World Up Object", "The reference object when the World Up Type is either Object Up or Object Rotation Up."); - GUIContent m_Roll = EditorGUIUtility.TrTextContent("Roll", "Specifies the roll angle in degrees."); - GUIContent m_UseUpObject = EditorGUIUtility.TrTextContent("Use Up Object", "Specifies how the world up vector should be computed. Either use the World Up Object or the Roll value"); + GUIContent m_RotationAtRest = L10n.TextContent("Rotation At Rest", "The orientation of the constrained object when the weights of the sources add up to zero or when all the rotation axes are disabled.", null, null); + GUIContent m_RotationOffset = L10n.TextContent("Rotation Offset", "The offset from the constrained orientation.", null, null); + GUIContent m_WorldUpObject = L10n.TextContent("World Up Object", "The reference object when the World Up Type is either Object Up or Object Rotation Up.", null, null); + GUIContent m_Roll = L10n.TextContent("Roll", "Specifies the roll angle in degrees.", null, null); + GUIContent m_UseUpObject = L10n.TextContent("Use Up Object", "Specifies how the world up vector should be computed. Either use the World Up Object or the Roll value", null, null); public override GUIContent AtRest { get { return m_RotationAtRest; } } public override GUIContent Offset { get { return m_RotationOffset; } } diff --git a/Editor/Mono/Inspector/MaterialEditor.cs b/Editor/Mono/Inspector/MaterialEditor.cs index 49b77574d3..a852bfa9a5 100644 --- a/Editor/Mono/Inspector/MaterialEditor.cs +++ b/Editor/Mono/Inspector/MaterialEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Materials not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -30,13 +29,13 @@ public partial class MaterialEditor : Editor { private static class Styles { - public static readonly GUIContent reflectionProbePickerIcon = EditorGUIUtility.TrIconContent("ReflectionProbeSelector"); - public static readonly GUIContent lightmapEmissiveLabelRealtimeGISupport = EditorGUIUtility.TrTextContent("Global Illumination", "Controls if the emission is Baked or Realtime.\n\nBaked only has effect in scenes where Baked Global Illumination is enabled.\n\nRealtime uses Realtime Global Illumination if enabled in the scene. Otherwise the emission won't light up other objects."); - public static readonly GUIContent lightmapEmissiveLabel = EditorGUIUtility.TrTextContent("Global Illumination", "Controls if the emission is Baked or Realtime.\n\nBaked only has effect in scenes where Baked Global Illumination is enabled.\n\nRealtime won't light up other objects since Realtime Global Illumination is not supported."); + public static readonly GUIContent reflectionProbePickerIcon = L10n.IconContent("ReflectionProbeSelector", null, null); + public static readonly GUIContent lightmapEmissiveLabelRealtimeGISupport = L10n.TextContent("Global Illumination", "Controls if the emission is Baked or Realtime.\n\nBaked only has effect in scenes where Baked Global Illumination is enabled.\n\nRealtime uses Realtime Global Illumination if enabled in the scene. Otherwise the emission won't light up other objects.", null, null); + public static readonly GUIContent lightmapEmissiveLabel = L10n.TextContent("Global Illumination", "Controls if the emission is Baked or Realtime.\n\nBaked only has effect in scenes where Baked Global Illumination is enabled.\n\nRealtime won't light up other objects since Realtime Global Illumination is not supported.", null, null); - public static readonly GUIContent[] lightmapEmissiveStrings = { EditorGUIUtility.TextContent("Realtime"), EditorGUIUtility.TrTextContent("Baked"), EditorGUIUtility.TrTextContent("None") }; + public static readonly GUIContent[] lightmapEmissiveStrings = { EditorGUIUtility.TextContent("Realtime"), L10n.TextContent("Baked", null, null, null), L10n.TextContent("None", null, null, null) }; public static readonly int[] lightmapEmissiveValues = { (int)MaterialGlobalIlluminationFlags.RealtimeIndirectEmission, (int)MaterialGlobalIlluminationFlags.BakedEmission, (int)MaterialGlobalIlluminationFlags.None }; - public static readonly string propBlockInfo = EditorGUIUtility.TrTextContent("MaterialPropertyBlock is used to modify these values").text; + public static readonly string propBlockInfo = L10n.TextContent("MaterialPropertyBlock is used to modify these values", null, null, null).text; public static readonly string builtInDeprecated = L10n.Tr("Built-in (Deprecated)/", null); public static readonly string notSupported = L10n.Tr("\"Not supported/\"", null); @@ -47,13 +46,13 @@ private static class Styles public const int kNewShaderQueueValue = -1; public const int kCustomQueueIndex = 4; - public static readonly GUIContent queueLabel = EditorGUIUtility.TrTextContent("Render Queue"); + public static readonly GUIContent queueLabel = L10n.TextContent("Render Queue", null, null, null); public static readonly GUIContent[] queueNames = { - EditorGUIUtility.TrTextContent("From Shader"), - EditorGUIUtility.TrTextContent("Geometry", "Queue 2000"), - EditorGUIUtility.TrTextContent("AlphaTest", "Queue 2450"), - EditorGUIUtility.TrTextContent("Transparent", "Queue 3000"), + L10n.TextContent("From Shader", null, null, null), + L10n.TextContent("Geometry", "Queue 2000", null, null), + L10n.TextContent("AlphaTest", "Queue 2450", null, null), + L10n.TextContent("Transparent", "Queue 3000", null, null), }; public static readonly int[] queueValues = { @@ -79,14 +78,14 @@ private static class Styles 0, // This value will be overriden during runtime }; - public static readonly GUIContent enableInstancingLabel = EditorGUIUtility.TrTextContent("Enable GPU Instancing"); - public static readonly GUIContent doubleSidedGILabel = EditorGUIUtility.TrTextContent("Double Sided Global Illumination", "When enabled, the lightmapper accounts for both sides of the geometry when calculating Global Illumination. Backfaces are not rendered or added to lightmaps, but get treated as valid when seen from other objects. When using the Progressive Lightmapper backfaces bounce light using the same emission and albedo as frontfaces."); - public static readonly GUIContent emissionLabel = EditorGUIUtility.TrTextContent("Emission"); + public static readonly GUIContent enableInstancingLabel = L10n.TextContent("Enable GPU Instancing", null, null, null); + public static readonly GUIContent doubleSidedGILabel = L10n.TextContent("Double Sided Global Illumination", "When enabled, the lightmapper accounts for both sides of the geometry when calculating Global Illumination. Backfaces are not rendered or added to lightmaps, but get treated as valid when seen from other objects. When using the Progressive Lightmapper backfaces bounce light using the same emission and albedo as frontfaces.", null, null); + public static readonly GUIContent emissionLabel = L10n.TextContent("Emission", null, null, null); public const string undoAssignMaterial = "Assign Material"; public const string undoAssignSkyboxMaterial = "Assign Skybox Material"; - public static readonly GUIContent parentContent = EditorGUIUtility.TrTextContent("Parent", "Specify the parent of this material."); + public static readonly GUIContent parentContent = L10n.TextContent("Parent", "Specify the parent of this material.", null, null); public static readonly GUIContent hierarchyIcon = EditorGUIUtility.IconContent("UnityEditor.SceneHierarchyWindow", "|Open Material Hierarchy Popup."); // right of | means tooltip public static readonly GUIContent convertIcon = EditorGUIUtility.IconContent("d_RotateTool", "|This material is in a conversion process."); // right of | means tooltip @@ -155,8 +154,8 @@ private static bool DoesPreviewAllowRotation(PreviewType type) private int m_SelectedMesh; private int m_TimeUpdate; private int m_LightMode = 1; - private static readonly GUIContent s_TilingText = EditorGUIUtility.TrTextContent("Tiling"); - private static readonly GUIContent s_OffsetText = EditorGUIUtility.TrTextContent("Offset"); + private static readonly GUIContent s_TilingText = L10n.TextContent("Tiling", null, null, null); + private static readonly GUIContent s_OffsetText = L10n.TextContent("Offset", null, null, null); bool m_PreviewUpdateNeeded = false; const string kDefaultMaterialPreviewMesh = "DefaultMaterialPreviewMesh"; @@ -920,18 +919,9 @@ public MaterialDropdownGUI(AdvancedDropdownDataSource dataSource) private static class Styles { - internal static readonly GUIStyle lineStyleFaint = new GUIStyle("DD ItemStyle"); - internal static readonly GUIStyle checkMark = "DD ItemCheckmark"; + internal static GUIStyle lineStyleFaint => EditorStyles.advancedDropdownItemFaint; + internal static GUIStyle checkMark => EditorStyles.advancedDropdownCheckmark; public static readonly GUIContent checkMarkContent = new GUIContent("✔"); - - static Styles() - { - float val = EditorGUIUtility.isProSkin ? 0.5f : 0.25f; - lineStyleFaint.active.textColor = new Color(val, val, val, 1f); - lineStyleFaint.focused.textColor = new Color(val, val, val, 1f); - lineStyleFaint.hover.textColor = new Color(val, val, val, 1f); - lineStyleFaint.normal.textColor = new Color(val, val, val, 1f); - } } internal override void DrawItem(AdvancedDropdownItem item, string name, Texture2D icon, bool enabled, bool drawArrow, bool selected, bool hasSearch) @@ -1721,8 +1711,8 @@ public void TextureCompatibilityWarning(MaterialProperty prop) if (InternalEditorUtility.BumpMapTextureNeedsFixing(prop)) { if (HelpBoxWithButton( - EditorGUIUtility.TrTextContent("This texture is not marked as a normal map"), - EditorGUIUtility.TrTextContent("Fix Now"))) + L10n.TextContent("This texture is not marked as a normal map", null, null, null), + L10n.TextContent("Fix Now", null, null, null))) { InternalEditorUtility.FixNormalmapTexture(prop); } @@ -2713,17 +2703,17 @@ private void Init() } } - s_MeshIcons[0] = EditorGUIUtility.TrIconContent("PreMatSphere"); - s_MeshIcons[1] = EditorGUIUtility.TrIconContent("PreMatCube"); - s_MeshIcons[2] = EditorGUIUtility.TrIconContent("PreMatCylinder"); - s_MeshIcons[3] = EditorGUIUtility.TrIconContent("PreMatTorus"); - s_MeshIcons[4] = EditorGUIUtility.TrIconContent("PreMatQuad"); + s_MeshIcons[0] = L10n.IconContent("PreMatSphere", null, null); + s_MeshIcons[1] = L10n.IconContent("PreMatCube", null, null); + s_MeshIcons[2] = L10n.IconContent("PreMatCylinder", null, null); + s_MeshIcons[3] = L10n.IconContent("PreMatTorus", null, null); + s_MeshIcons[4] = L10n.IconContent("PreMatQuad", null, null); - s_LightIcons[0] = EditorGUIUtility.TrIconContent("PreMatLight0"); - s_LightIcons[1] = EditorGUIUtility.TrIconContent("PreMatLight1"); + s_LightIcons[0] = L10n.IconContent("PreMatLight0", null, null); + s_LightIcons[1] = L10n.IconContent("PreMatLight1", null, null); - s_TimeIcons[0] = EditorGUIUtility.TrIconContent("PlayButton"); - s_TimeIcons[1] = EditorGUIUtility.TrIconContent("PauseButton"); + s_TimeIcons[0] = L10n.IconContent("PlayButton", null, null); + s_TimeIcons[1] = L10n.IconContent("PauseButton", null, null); Mesh quadMesh = Resources.GetBuiltinResource(typeof(Mesh), "Quad.fbx") as Mesh; s_Meshes[4] = quadMesh; @@ -3163,9 +3153,9 @@ private static void TryRevertDragChanges() } if (!hasRevert) - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // restores the pre-drag materials onto the renderer at the end of a single drag gesture, which cannot span a code reload; the renderer then owns the materials and ClearDragMaterialRendering() drops this copy immediately after s_previousDraggedUponRenderer.sharedMaterials = s_previousMaterialValue; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 } if (s_previousDraggedUponTerrain != null) @@ -3180,9 +3170,9 @@ private static void TryRevertDragChanges() } if (!hasRevert) - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // restores the pre-drag material onto the terrain at the end of a single drag gesture, which cannot span a code reload; the terrain then owns the material and ClearDragMaterialRendering() drops this copy immediately after s_previousDraggedUponTerrain.materialTemplate = s_previousTerrainMaterialTemplate; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 } MaterialEditorForCanvasRendererUtility.RevertCanvasRendererDragChanges(); @@ -3521,4 +3511,3 @@ internal static void AddAdditionalMaterialMenuItems(GenericMenu menu) } } } // namespace UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/MemorySettingsEditor.cs b/Editor/Mono/Inspector/MemorySettingsEditor.cs index 67a7326cdb..9e4e373c45 100644 --- a/Editor/Mono/Inspector/MemorySettingsEditor.cs +++ b/Editor/Mono/Inspector/MemorySettingsEditor.cs @@ -22,69 +22,69 @@ internal partial class MemorySettingsEditor : Editor { class ContentNonSearchable { - public static readonly GUIContent kGeneralSettingsWarning = EditorGUIUtility.TrTextContent("Changing Memory setup values can cause severe performance degradation."); - public static readonly GUIContent kEditorSettingsWarning = EditorGUIUtility.TrTextContent("Changing the memory setup for editor will update the ProjectSettings/boot.config file. This file is loaded at Editor startup, so will take effect at next startup."); + public static readonly GUIContent kGeneralSettingsWarning = L10n.TextContent("Changing Memory setup values can cause severe performance degradation.", null, null, null); + public static readonly GUIContent kEditorSettingsWarning = L10n.TextContent("Changing the memory setup for editor will update the ProjectSettings/boot.config file. This file is loaded at Editor startup, so will take effect at next startup.", null, null, null); } class Content { - public static readonly GUIContent kMainAllocatorsTitle = EditorGUIUtility.TrTextContent("Main Allocators"); - - public static readonly GUIContent kMainAllocatorTitle = EditorGUIUtility.TrTextContent("Main Allocator"); - public static readonly GUIContent kMainAllocatorBlockSize = EditorGUIUtility.TrTextContent("Main Thread Block Size", "Block size used by main thread allocator"); - public static readonly GUIContent kThreadAllocatorBlockSize = EditorGUIUtility.TrTextContent("Shared Thread Block Size", "Block size used by shared thread allocator"); - - public static readonly GUIContent kMainAllocatorMimallocEnabled = EditorGUIUtility.TrTextContent("Mimalloc enabled", "Use Mimalloc as main allocator"); - - public static readonly GUIContent kGfxAllocatorTitle = EditorGUIUtility.TrTextContent("Gfx Allocator"); - public static readonly GUIContent kMainGfxBlockSize = EditorGUIUtility.TrTextContent("Main Thread Block Size", "Block size used by main thread for gfx allocations"); - public static readonly GUIContent kThreadGfxBlockSize = EditorGUIUtility.TrTextContent("Shared Thread Block Size", "Block size used by shared threads for gfx allocations"); - - public static readonly GUIContent kExtraAllocatorTitle = EditorGUIUtility.TrTextContent("Other Allocators"); - public static readonly GUIContent kCacheBlockSize = EditorGUIUtility.TrTextContent("File Cache Block Size", "Block size used by file cache allocator. Setting this value to 0 will cause the file cache allocations to be passed to the main allocator"); - public static readonly GUIContent kTypetreeBlockSize = EditorGUIUtility.TrTextContent("Type Tree Block Size", "Block size used by the tree allocator. Setting this value to 0 will cause the type tree allocations to be passed to the main allocator"); - public static readonly GUIContent kRemapperInitialCapacity = EditorGUIUtility.TrTextContent("Remapper Initial Capacity", "Initial capacity of the Remapper allocation"); - - public static readonly GUIContent kTempAllocatorTitle_Player = EditorGUIUtility.TrTextContent("Fast Per Thread Temporary Allocators", "Block size can grow to twice the initial size"); - public static readonly GUIContent kTempAllocatorTitle_Editor = EditorGUIUtility.TrTextContent("Fast Per Thread Temporary Allocators", "Block size can grow to 8 times the initial size"); - public static readonly GUIContent kTempAllocatorSizeMain = EditorGUIUtility.TrTextContent("Main Thread Block Size", "Initial size for main thread temp allocator"); - public static readonly GUIContent kTempAllocatorSizeJobWorker = EditorGUIUtility.TrTextContent("Job Worker Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizeBackgroundWorker = EditorGUIUtility.TrTextContent("Background Job Worker Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizePreloadManager = EditorGUIUtility.TrTextContent("Preload Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizeAudioWorker = EditorGUIUtility.TrTextContent("Audio Worker Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizeCloudWorker = EditorGUIUtility.TrTextContent("Cloud Worker Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizeGfx = EditorGUIUtility.TrTextContent("Gfx Thread Block Size", "Block size for worker job temp allocators"); - public static readonly GUIContent kTempAllocatorSizeGIBakingWorker = EditorGUIUtility.TrTextContent("GI Baking Block Size", "Block size for GI baking workers temp allocators"); - public static readonly GUIContent kTempAllocatorSizeNavMeshWorker = EditorGUIUtility.TrTextContent("NavMesh Worker Block Size", "Block size for worker job temp allocators"); + public static readonly GUIContent kMainAllocatorsTitle = L10n.TextContent("Main Allocators", null, null, null); + + public static readonly GUIContent kMainAllocatorTitle = L10n.TextContent("Main Allocator", null, null, null); + public static readonly GUIContent kMainAllocatorBlockSize = L10n.TextContent("Main Thread Block Size", "Block size used by main thread allocator", null, null); + public static readonly GUIContent kThreadAllocatorBlockSize = L10n.TextContent("Shared Thread Block Size", "Block size used by shared thread allocator", null, null); + + public static readonly GUIContent kMainAllocatorMimallocEnabled = L10n.TextContent("Mimalloc enabled", "Use Mimalloc as main allocator", null, null); + + public static readonly GUIContent kGfxAllocatorTitle = L10n.TextContent("Gfx Allocator", null, null, null); + public static readonly GUIContent kMainGfxBlockSize = L10n.TextContent("Main Thread Block Size", "Block size used by main thread for gfx allocations", null, null); + public static readonly GUIContent kThreadGfxBlockSize = L10n.TextContent("Shared Thread Block Size", "Block size used by shared threads for gfx allocations", null, null); + + public static readonly GUIContent kExtraAllocatorTitle = L10n.TextContent("Other Allocators", null, null, null); + public static readonly GUIContent kCacheBlockSize = L10n.TextContent("File Cache Block Size", "Block size used by file cache allocator. Setting this value to 0 will cause the file cache allocations to be passed to the main allocator", null, null); + public static readonly GUIContent kTypetreeBlockSize = L10n.TextContent("Type Tree Block Size", "Block size used by the tree allocator. Setting this value to 0 will cause the type tree allocations to be passed to the main allocator", null, null); + public static readonly GUIContent kRemapperInitialCapacity = L10n.TextContent("Remapper Initial Capacity", "Initial capacity of the Remapper allocation", null, null); + + public static readonly GUIContent kTempAllocatorTitle_Player = L10n.TextContent("Fast Per Thread Temporary Allocators", "Block size can grow to twice the initial size", null, null); + public static readonly GUIContent kTempAllocatorTitle_Editor = L10n.TextContent("Fast Per Thread Temporary Allocators", "Block size can grow to 8 times the initial size", null, null); + public static readonly GUIContent kTempAllocatorSizeMain = L10n.TextContent("Main Thread Block Size", "Initial size for main thread temp allocator", null, null); + public static readonly GUIContent kTempAllocatorSizeJobWorker = L10n.TextContent("Job Worker Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeBackgroundWorker = L10n.TextContent("Background Job Worker Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizePreloadManager = L10n.TextContent("Preload Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeAudioWorker = L10n.TextContent("Audio Worker Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeCloudWorker = L10n.TextContent("Cloud Worker Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeGfx = L10n.TextContent("Gfx Thread Block Size", "Block size for worker job temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeGIBakingWorker = L10n.TextContent("GI Baking Block Size", "Block size for GI baking workers temp allocators", null, null); + public static readonly GUIContent kTempAllocatorSizeNavMeshWorker = L10n.TextContent("NavMesh Worker Block Size", "Block size for worker job temp allocators", null, null); // TODO: guard input parameters - public static readonly GUIContent kJobTempAllocatorTitle = EditorGUIUtility.TrTextContent("Fast Thread Shared Temporary Allocators"); - public static readonly GUIContent kJobTempAllocatorBlockSize = EditorGUIUtility.TrTextContent("Job Allocator Block Size", "Block size for worker job temp allocators. Can grow to 64 blocks"); - public static readonly GUIContent kBackgroundJobTempAllocatorBlockSize = EditorGUIUtility.TrTextContent("Background Job Allocator Block Size", "Block size for background worker job temp allocators. Can grow to 64 blocks"); - public static readonly GUIContent kJobTempAllocatorReducedBlockSize = EditorGUIUtility.TrTextContent("Job Allocator Block Sizes on low memory platform", "Block sizes for job and background if platform has less than 2GB memory"); - - public static readonly GUIContent kBucketAllocatorTitle = EditorGUIUtility.TrTextContent("Shared Bucket Allocator"); - public static readonly GUIContent kBucketAllocatorGranularity = EditorGUIUtility.TrTextContent("Bucket Allocator Granularity", "Bucket allocator bucket granularity"); - public static readonly GUIContent kBucketAllocatorBucketsCount = EditorGUIUtility.TrTextContent("Bucket Allocator BucketCount", "Number of bucket size increments of bucket granularity"); - public static readonly GUIContent kBucketAllocatorBlockSize = EditorGUIUtility.TrTextContent("Bucket Allocator Block Size", "Bucket allocator block size"); - public static readonly GUIContent kBucketAllocatorBlockCount = EditorGUIUtility.TrTextContent("Bucket Allocator Block Count", "Bucket allocator block count"); - - public static readonly GUIContent kProfilerAllocatorTitle = EditorGUIUtility.TrTextContent("Profiler Allocators"); - public static readonly GUIContent kProfilerBlockSize = EditorGUIUtility.TrTextContent("Profiler Block Size", "Block size used by main profiler allocations"); - public static readonly GUIContent kProfilerEditorBlockSize = EditorGUIUtility.TrTextContent("Editor Profiler Block Size", "Editor only: Block size used by editor specific profiler allocations"); - - public static readonly GUIContent kProfilerBucketAllocatorTitle = EditorGUIUtility.TrTextContent("Shared Profiler Bucket Allocator"); - public static readonly GUIContent kProfilerBucketAllocatorGranularity = EditorGUIUtility.TrTextContent("Bucket Allocator Granularity", "Bucket allocator bucket granularity"); - public static readonly GUIContent kProfilerBucketAllocatorBucketsCount = EditorGUIUtility.TrTextContent("Bucket Allocator BucketCount", "Number of bucket size increments of bucket granularity"); - public static readonly GUIContent kProfilerBucketAllocatorBlockSize = EditorGUIUtility.TrTextContent("Bucket Allocator Block Size", "Bucket allocator block size"); - public static readonly GUIContent kProfilerBucketAllocatorBlockCount = EditorGUIUtility.TrTextContent("Bucket Allocator Block Count", "Bucket allocator block count"); - - public static readonly GUIContent kEntitiesAllocatorTitle = EditorGUIUtility.TrTextContent("Entities Allocators", "Memory allocators used by the Unity.Entities package"); - public static readonly GUIContent kEntitiesArchetypeAllocatorBudget = EditorGUIUtility.TrTextContent("Archetype Allocator Budget", "Memory budget for Entity archetype metadata. Default is 16 MB."); - public static readonly GUIContent kEntitiesQueryAllocatorBudget = EditorGUIUtility.TrTextContent("Query Allocator Budget", "Memory budget for EntityQuery data. Default is 16 MB."); - - public static readonly GUIContent kEditorLabel = EditorGUIUtility.TrTextContent("Editor", "Editor settings"); - public static readonly GUIContent kPlayerLabel = EditorGUIUtility.TrTextContent("Players", "player settings"); + public static readonly GUIContent kJobTempAllocatorTitle = L10n.TextContent("Fast Thread Shared Temporary Allocators", null, null, null); + public static readonly GUIContent kJobTempAllocatorBlockSize = L10n.TextContent("Job Allocator Block Size", "Block size for worker job temp allocators. Can grow to 64 blocks", null, null); + public static readonly GUIContent kBackgroundJobTempAllocatorBlockSize = L10n.TextContent("Background Job Allocator Block Size", "Block size for background worker job temp allocators. Can grow to 64 blocks", null, null); + public static readonly GUIContent kJobTempAllocatorReducedBlockSize = L10n.TextContent("Job Allocator Block Sizes on low memory platform", "Block sizes for job and background if platform has less than 2GB memory", null, null); + + public static readonly GUIContent kBucketAllocatorTitle = L10n.TextContent("Shared Bucket Allocator", null, null, null); + public static readonly GUIContent kBucketAllocatorGranularity = L10n.TextContent("Bucket Allocator Granularity", "Bucket allocator bucket granularity", null, null); + public static readonly GUIContent kBucketAllocatorBucketsCount = L10n.TextContent("Bucket Allocator BucketCount", "Number of bucket size increments of bucket granularity", null, null); + public static readonly GUIContent kBucketAllocatorBlockSize = L10n.TextContent("Bucket Allocator Block Size", "Bucket allocator block size", null, null); + public static readonly GUIContent kBucketAllocatorBlockCount = L10n.TextContent("Bucket Allocator Block Count", "Bucket allocator block count", null, null); + + public static readonly GUIContent kProfilerAllocatorTitle = L10n.TextContent("Profiler Allocators", null, null, null); + public static readonly GUIContent kProfilerBlockSize = L10n.TextContent("Profiler Block Size", "Block size used by main profiler allocations", null, null); + public static readonly GUIContent kProfilerEditorBlockSize = L10n.TextContent("Editor Profiler Block Size", "Editor only: Block size used by editor specific profiler allocations", null, null); + + public static readonly GUIContent kProfilerBucketAllocatorTitle = L10n.TextContent("Shared Profiler Bucket Allocator", null, null, null); + public static readonly GUIContent kProfilerBucketAllocatorGranularity = L10n.TextContent("Bucket Allocator Granularity", "Bucket allocator bucket granularity", null, null); + public static readonly GUIContent kProfilerBucketAllocatorBucketsCount = L10n.TextContent("Bucket Allocator BucketCount", "Number of bucket size increments of bucket granularity", null, null); + public static readonly GUIContent kProfilerBucketAllocatorBlockSize = L10n.TextContent("Bucket Allocator Block Size", "Bucket allocator block size", null, null); + public static readonly GUIContent kProfilerBucketAllocatorBlockCount = L10n.TextContent("Bucket Allocator Block Count", "Bucket allocator block count", null, null); + + public static readonly GUIContent kEntitiesAllocatorTitle = L10n.TextContent("Entities Allocators", "Memory allocators used by the Unity.Entities package", null, null); + public static readonly GUIContent kEntitiesArchetypeAllocatorBudget = L10n.TextContent("Archetype Allocator Budget", "Memory budget for Entity archetype metadata. Default is 16 MB.", null, null); + public static readonly GUIContent kEntitiesQueryAllocatorBudget = L10n.TextContent("Query Allocator Budget", "Memory budget for EntityQuery data. Default is 16 MB.", null, null); + + public static readonly GUIContent kEditorLabel = L10n.TextContent("Editor", "Editor settings", null, null); + public static readonly GUIContent kPlayerLabel = L10n.TextContent("Players", "player settings", null, null); } class Styles diff --git a/Editor/Mono/Inspector/MeshPreview.cs b/Editor/Mono/Inspector/MeshPreview.cs index 1ec32c355f..48f25f1e18 100644 --- a/Editor/Mono/Inspector/MeshPreview.cs +++ b/Editor/Mono/Inspector/MeshPreview.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Mesh not yet converted using System; using System.Collections.Generic; using Unity.Collections; @@ -18,12 +17,12 @@ internal static class Styles { const string k_DisplayModeTooltip = "Change display mode"; - public static readonly GUIContent meshLodIcon = EditorGUIUtility.TrIconContent("MeshLOD", "Select a LOD to view."); - public static readonly GUIContent wireframeToggle = EditorGUIUtility.TrIconContent(EditorGUIUtility.LoadIconRequired("Toolbars/wireframe"), "Show wireframe"); + public static readonly GUIContent meshLodIcon = L10n.IconContent("MeshLOD", "Select a LOD to view.", null); + public static readonly GUIContent wireframeToggle = L10n.IconContent(EditorGUIUtility.LoadIconRequired("Toolbars/wireframe"), "Show wireframe", null); - public static readonly GUIContent displayModeDropdown = EditorGUIUtility.TrTextContent("", "Change display mode"); - public static readonly GUIContent shadedIcon = EditorGUIUtility.TrIconContent("Toolbars/Shaded", k_DisplayModeTooltip); - public static readonly GUIContent uvIcon = EditorGUIUtility.TrIconContent("PreTextureMipMapLow", k_DisplayModeTooltip); + public static readonly GUIContent displayModeDropdown = L10n.TextContent("", "Change display mode", null, null); + public static readonly GUIContent shadedIcon = L10n.IconContent("Toolbars/Shaded", k_DisplayModeTooltip, null); + public static readonly GUIContent uvIcon = L10n.IconContent("PreTextureMipMapLow", k_DisplayModeTooltip, null); public static readonly GUIContent uvChannelDropdown = EditorGUIUtility.TrTextContent("", k_DisplayModeTooltip); @@ -973,4 +972,3 @@ uint GetPrimitiveCount(int lod) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/MeshRendererEditor.cs b/Editor/Mono/Inspector/MeshRendererEditor.cs index bd6aeb78e8..b726cb9351 100644 --- a/Editor/Mono/Inspector/MeshRendererEditor.cs +++ b/Editor/Mono/Inspector/MeshRendererEditor.cs @@ -12,8 +12,8 @@ internal class MeshRendererEditor : RendererEditorBase { class Styles { - public static readonly GUIContent materialWarning = EditorGUIUtility.TrTextContent("This renderer has more materials than the Mesh has submeshes. Multiple materials will be applied to the same submesh, which costs performance. Consider using multiple shader passes."); - public static readonly GUIContent staticBatchingWarning = EditorGUIUtility.TrTextContent("This Renderer uses static batching and instanced Shaders. When the Player is active, instancing is disabled. If you want instanced Shaders at run time, disable static batching."); + public static readonly GUIContent materialWarning = L10n.TextContent("This renderer has more materials than the Mesh has submeshes. Multiple materials will be applied to the same submesh, which costs performance. Consider using multiple shader passes.", null, null, null); + public static readonly GUIContent staticBatchingWarning = L10n.TextContent("This Renderer uses static batching and instanced Shaders. When the Player is active, instancing is disabled. If you want instanced Shaders at run time, disable static batching.", null, null, null); } private SerializedObject m_GameObjectsSerializedObject; diff --git a/Editor/Mono/Inspector/MinMaxCurvePropertyDrawer.cs b/Editor/Mono/Inspector/MinMaxCurvePropertyDrawer.cs index bdb0532827..298c06b9c7 100644 --- a/Editor/Mono/Inspector/MinMaxCurvePropertyDrawer.cs +++ b/Editor/Mono/Inspector/MinMaxCurvePropertyDrawer.cs @@ -42,10 +42,10 @@ class Styles public readonly AnimationCurve defaultCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 1)) { postWrapMode = WrapMode.ClampForever, preWrapMode = WrapMode.ClampForever }; public readonly GUIContent[] modes = new[] { - EditorGUIUtility.TrTextContent("Constant"), - EditorGUIUtility.TrTextContent("Curve"), - EditorGUIUtility.TrTextContent("Random Between Two Curves"), - EditorGUIUtility.TrTextContent("Random Between Two Constants") + L10n.TextContent("Constant", null, null, null), + L10n.TextContent("Curve", null, null, null), + L10n.TextContent("Random Between Two Curves", null, null, null), + L10n.TextContent("Random Between Two Constants", null, null, null) }; } [NoAutoStaticsCleanup] // Readonly eager init re-runs per ALC on code load; GUIContent/Color/AnimationCurve members survive reload. diff --git a/Editor/Mono/Inspector/MinMaxGradientPropertyDrawer.cs b/Editor/Mono/Inspector/MinMaxGradientPropertyDrawer.cs index ddfee4018a..9847d59e2e 100644 --- a/Editor/Mono/Inspector/MinMaxGradientPropertyDrawer.cs +++ b/Editor/Mono/Inspector/MinMaxGradientPropertyDrawer.cs @@ -32,11 +32,11 @@ class Styles public readonly float stateButtonWidth = 18; public readonly GUIContent[] modes = new[] { - EditorGUIUtility.TrTextContent("Color"), - EditorGUIUtility.TrTextContent("Gradient"), - EditorGUIUtility.TrTextContent("Random Between Two Colors"), - EditorGUIUtility.TrTextContent("Random Between Two Gradients"), - EditorGUIUtility.TrTextContent("Random Color") + L10n.TextContent("Color", null, null, null), + L10n.TextContent("Gradient", null, null, null), + L10n.TextContent("Random Between Two Colors", null, null, null), + L10n.TextContent("Random Between Two Gradients", null, null, null), + L10n.TextContent("Random Color", null, null, null) }; } [NoAutoStaticsCleanup] // Readonly eager init re-runs per ALC on code load; GUIContent members survive reload. diff --git a/Editor/Mono/Inspector/ModelInspector.cs b/Editor/Mono/Inspector/ModelInspector.cs index d40cb2aa3e..dbeb3f1d0c 100644 --- a/Editor/Mono/Inspector/ModelInspector.cs +++ b/Editor/Mono/Inspector/ModelInspector.cs @@ -36,8 +36,8 @@ class ModelInspector : Editor // ShowCollisionInfo strings static readonly string s_CollisionLabel = "Collision"; - static readonly GUIContent s_PreBakeConvexCollisionMeshContent = EditorGUIUtility.TrTextContent("Bake Convex Collision Mesh", "Pre-bake convex collision mesh data during player build for use with convex MeshColliders. This improves runtime performance."); - static readonly GUIContent s_PreBakeTriangleCollisionMeshContent = EditorGUIUtility.TrTextContent("Bake Triangle Collision Mesh", "Pre-bake triangle collision mesh data during player build for use with non convex MeshColliders. This improves runtime performance."); + static readonly GUIContent s_PreBakeConvexCollisionMeshContent = L10n.TextContent("Bake Convex Collision Mesh", "Pre-bake convex collision mesh data during player build for use with convex MeshColliders. This improves runtime performance.", null, null); + static readonly GUIContent s_PreBakeTriangleCollisionMeshContent = L10n.TextContent("Bake Triangle Collision Mesh", "Pre-bake triangle collision mesh data during player build for use with non convex MeshColliders. This improves runtime performance.", null, null); static readonly string s_ImportedMeshCollisionHelpBox = "Collision baking for imported meshes is configured in the Model Import Settings."; void OnEnable() diff --git a/Editor/Mono/Inspector/ParentConstraintEditor.cs b/Editor/Mono/Inspector/ParentConstraintEditor.cs index 57e35144d7..ba63c19623 100644 --- a/Editor/Mono/Inspector/ParentConstraintEditor.cs +++ b/Editor/Mono/Inspector/ParentConstraintEditor.cs @@ -34,18 +34,18 @@ internal class ParentConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_RestTranslation = EditorGUIUtility.TrTextContent("Position At Rest"); - GUIContent m_TranslationOffset = EditorGUIUtility.TrTextContent("Position Offset"); + GUIContent m_RestTranslation = L10n.TextContent("Position At Rest", null, null, null); + GUIContent m_TranslationOffset = L10n.TextContent("Position Offset", null, null, null); - GUIContent m_RestRotation = EditorGUIUtility.TrTextContent("Rotation At Rest"); - GUIContent m_RotationOffset = EditorGUIUtility.TrTextContent("Rotation Offset"); + GUIContent m_RestRotation = L10n.TextContent("Rotation At Rest", null, null, null); + GUIContent m_RotationOffset = L10n.TextContent("Rotation Offset", null, null, null); - GUIContent m_TranslationAxes = EditorGUIUtility.TrTextContent("Freeze Position Axes"); - GUIContent m_RotationAxes = EditorGUIUtility.TrTextContent("Freeze Rotation Axes"); + GUIContent m_TranslationAxes = L10n.TextContent("Freeze Position Axes", null, null, null); + GUIContent m_RotationAxes = L10n.TextContent("Freeze Rotation Axes", null, null, null); - GUIContent m_DefaultSourceName = EditorGUIUtility.TrTextContent("None"); + GUIContent m_DefaultSourceName = L10n.TextContent("None", null, null, null); - GUIContent m_SourceOffsets = EditorGUIUtility.TrTextContent("Source Offsets"); + GUIContent m_SourceOffsets = L10n.TextContent("Source Offsets", null, null, null); public override GUIContent AtRest { get { throw new NotImplementedException(); } } public override GUIContent Offset { get { throw new NotImplementedException(); } } diff --git a/Editor/Mono/Inspector/ParticleSystemForceFieldInspector.cs b/Editor/Mono/Inspector/ParticleSystemForceFieldInspector.cs index 3a24f72374..0f71e06a3a 100644 --- a/Editor/Mono/Inspector/ParticleSystemForceFieldInspector.cs +++ b/Editor/Mono/Inspector/ParticleSystemForceFieldInspector.cs @@ -75,39 +75,39 @@ internal class ParticleSystemForceFieldInspector : Editor private class Styles { - public static readonly GUIContent shape = EditorGUIUtility.TrTextContent("Shape", "The bounding shape that forces are applied inside."); - public static readonly GUIContent startRange = EditorGUIUtility.TrTextContent("Start Range", "The inner extent of the bounding shape."); - public static readonly GUIContent endRange = EditorGUIUtility.TrTextContent("End Range", "The outer extent of the bounding shape."); - public static readonly GUIContent length = EditorGUIUtility.TrTextContent("Length", "The length of the cylinder."); - public static readonly GUIContent directionX = EditorGUIUtility.TrTextContent("X", "The force to apply along the X axis."); - public static readonly GUIContent directionY = EditorGUIUtility.TrTextContent("Y", "The force to apply along the Y axis."); - public static readonly GUIContent directionZ = EditorGUIUtility.TrTextContent("Z", "The force to apply along the Z axis."); - public static readonly GUIContent gravity = EditorGUIUtility.TrTextContent("Strength", "The strength of the gravity effect."); - public static readonly GUIContent gravityFocus = EditorGUIUtility.TrTextContent("Focus", "Choose a band within the volume that particles will be attracted towards."); - public static readonly GUIContent rotationSpeed = EditorGUIUtility.TrTextContent("Speed", "The speed at which particles are propelled around the vortex."); - public static readonly GUIContent rotationAttraction = EditorGUIUtility.TrTextContent("Attraction", "Controls how strongly particles are dragged into the vortex motion."); - public static readonly GUIContent rotationRandomness = EditorGUIUtility.TrTextContent("Randomness", "Propel particles around random axes of the shape."); - public static readonly GUIContent drag = EditorGUIUtility.TrTextContent("Strength", "The strength of the drag effect."); - public static readonly GUIContent multiplyDragByParticleSize = EditorGUIUtility.TrTextContent("Multiply by Size", "Adjust the drag based on the size of the particles."); - public static readonly GUIContent multiplyDragByParticleVelocity = EditorGUIUtility.TrTextContent("Multiply by Velocity", "Adjust the drag based on the velocity of the particles."); - public static readonly GUIContent vectorField = EditorGUIUtility.TrTextContent("Volume Texture", "The texture used for the vector field."); - public static readonly GUIContent vectorFieldSpeed = EditorGUIUtility.TrTextContent("Speed", "The speed multiplier applied to particles traveling through the vector field."); - public static readonly GUIContent vectorFieldAttraction = EditorGUIUtility.TrTextContent("Attraction", "Controls how strongly particles are dragged into the vector field motion."); + public static readonly GUIContent shape = L10n.TextContent("Shape", "The bounding shape that forces are applied inside.", null, null); + public static readonly GUIContent startRange = L10n.TextContent("Start Range", "The inner extent of the bounding shape.", null, null); + public static readonly GUIContent endRange = L10n.TextContent("End Range", "The outer extent of the bounding shape.", null, null); + public static readonly GUIContent length = L10n.TextContent("Length", "The length of the cylinder.", null, null); + public static readonly GUIContent directionX = L10n.TextContent("X", "The force to apply along the X axis.", null, null); + public static readonly GUIContent directionY = L10n.TextContent("Y", "The force to apply along the Y axis.", null, null); + public static readonly GUIContent directionZ = L10n.TextContent("Z", "The force to apply along the Z axis.", null, null); + public static readonly GUIContent gravity = L10n.TextContent("Strength", "The strength of the gravity effect.", null, null); + public static readonly GUIContent gravityFocus = L10n.TextContent("Focus", "Choose a band within the volume that particles will be attracted towards.", null, null); + public static readonly GUIContent rotationSpeed = L10n.TextContent("Speed", "The speed at which particles are propelled around the vortex.", null, null); + public static readonly GUIContent rotationAttraction = L10n.TextContent("Attraction", "Controls how strongly particles are dragged into the vortex motion.", null, null); + public static readonly GUIContent rotationRandomness = L10n.TextContent("Randomness", "Propel particles around random axes of the shape.", null, null); + public static readonly GUIContent drag = L10n.TextContent("Strength", "The strength of the drag effect.", null, null); + public static readonly GUIContent multiplyDragByParticleSize = L10n.TextContent("Multiply by Size", "Adjust the drag based on the size of the particles.", null, null); + public static readonly GUIContent multiplyDragByParticleVelocity = L10n.TextContent("Multiply by Velocity", "Adjust the drag based on the velocity of the particles.", null, null); + public static readonly GUIContent vectorField = L10n.TextContent("Volume Texture", "The texture used for the vector field.", null, null); + public static readonly GUIContent vectorFieldSpeed = L10n.TextContent("Speed", "The speed multiplier applied to particles traveling through the vector field.", null, null); + public static readonly GUIContent vectorFieldAttraction = L10n.TextContent("Attraction", "Controls how strongly particles are dragged into the vector field motion.", null, null); public static readonly GUIContent[] shapeOptions = { - EditorGUIUtility.TrTextContent("Sphere"), - EditorGUIUtility.TrTextContent("Hemisphere"), - EditorGUIUtility.TrTextContent("Cylinder"), - EditorGUIUtility.TrTextContent("Box") + L10n.TextContent("Sphere", null, null, null), + L10n.TextContent("Hemisphere", null, null, null), + L10n.TextContent("Cylinder", null, null, null), + L10n.TextContent("Box", null, null, null) }; - public static readonly GUIContent shapeHeading = EditorGUIUtility.TrTextContent("Shape"); - public static readonly GUIContent directionHeading = EditorGUIUtility.TrTextContent("Direction"); - public static readonly GUIContent gravityHeading = EditorGUIUtility.TrTextContent("Gravity"); - public static readonly GUIContent rotationHeading = EditorGUIUtility.TrTextContent("Rotation"); - public static readonly GUIContent dragHeading = EditorGUIUtility.TrTextContent("Drag"); - public static readonly GUIContent vectorFieldHeading = EditorGUIUtility.TrTextContent("Vector Field"); + public static readonly GUIContent shapeHeading = L10n.TextContent("Shape", null, null, null); + public static readonly GUIContent directionHeading = L10n.TextContent("Direction", null, null, null); + public static readonly GUIContent gravityHeading = L10n.TextContent("Gravity", null, null, null); + public static readonly GUIContent rotationHeading = L10n.TextContent("Rotation", null, null, null); + public static readonly GUIContent dragHeading = L10n.TextContent("Drag", null, null, null); + public static readonly GUIContent vectorFieldHeading = L10n.TextContent("Vector Field", null, null, null); } void OnEnable() diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs index 65e5fd46b3..b29d8f491f 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs @@ -56,55 +56,55 @@ static Styles() class SettingsContentNonSearchable { - public static readonly GUIContent[] memorylessModeNames = { EditorGUIUtility.TrTextContent("Unused"), EditorGUIUtility.TrTextContent("Forced"), EditorGUIUtility.TrTextContent("Automatic") }; + public static readonly GUIContent[] memorylessModeNames = { L10n.TextContent("Unused", null, null, null), L10n.TextContent("Forced", null, null, null), L10n.TextContent("Automatic", null, null, null) }; public static readonly GUIContent[] insecureHttpOptions = { - EditorGUIUtility.TrTextContent("Not allowed"), - EditorGUIUtility.TrTextContent("Allowed in development builds"), - EditorGUIUtility.TrTextContent("Always allowed"), + L10n.TextContent("Not allowed", null, null, null), + L10n.TextContent("Allowed in development builds", null, null, null), + L10n.TextContent("Always allowed", null, null, null), }; - public static readonly GUIContent[] meshDeformations = { EditorGUIUtility.TrTextContent("CPU"), EditorGUIUtility.TrTextContent("GPU"), EditorGUIUtility.TrTextContent("GPU (Batched)") }; - public static readonly GUIContent scriptingDefineSymbolsApply = EditorGUIUtility.TrTextContent("Apply"); - public static readonly GUIContent scriptingDefineSymbolsApplyRevert = EditorGUIUtility.TrTextContent("Revert"); - public static readonly GUIContent[] il2CppLTOModeOptions = new GUIContent[] { EditorGUIUtility.TrTextContent("Full"), EditorGUIUtility.TrTextContent("Thin") }; - public static readonly GUIContent[] il2CppLTOModeNoneOption = new GUIContent[] { EditorGUIUtility.TrTextContent("None") }; - public static readonly GUIContent scriptingDefault = EditorGUIUtility.TrTextContent("Default"); - public static readonly GUIContent strippingDisabled = EditorGUIUtility.TrTextContent("Disabled"); - public static readonly GUIContent strippingMinimal = EditorGUIUtility.TrTextContent("Minimal"); - public static readonly GUIContent strippingLow = EditorGUIUtility.TrTextContent("Low"); - public static readonly GUIContent strippingMedium = EditorGUIUtility.TrTextContent("Medium"); - public static readonly GUIContent strippingHigh = EditorGUIUtility.TrTextContent("High"); - public static readonly GUIContent activeInputHandlingBoth = EditorGUIUtility.TrTextContent("Both"); - public static readonly GUIContent normalMapEncodingXYZ = EditorGUIUtility.TrTextContent("XYZ"); - public static readonly GUIContent[] lightmapEncodingNames = { EditorGUIUtility.TrTextContent("Low Quality"), EditorGUIUtility.TrTextContent("Normal Quality"), EditorGUIUtility.TrTextContent("High Quality") }; - public static readonly GUIContent[] hdrCubemapEncodingNames = { EditorGUIUtility.TrTextContent("Low Quality"), EditorGUIUtility.TrTextContent("Normal Quality"), EditorGUIUtility.TrTextContent("High Quality") }; - public static readonly GUIContent[] shaderPrecisionModelOptions = { EditorGUIUtility.TrTextContent("Platform Default"), EditorGUIUtility.TrTextContent("Unified") }; - public static readonly GUIContent loadStoreDebugModeEditorOnlyCheckbox = EditorGUIUtility.TrTextContent("Editor Only", "Load/Store Action Debug Mode will only affect the Editor"); - public static readonly GUIContent applicationBuildNumber = EditorGUIUtility.TrTextContent("Build"); - public static readonly GUIContent windowed = EditorGUIUtility.TrTextContent("Windowed"); - public static readonly GUIContent overrideDefaultChunkSettings = EditorGUIUtility.TrTextContent("Override", "Override the default settings for this build target."); - public static readonly GUIContent recordingInfo = EditorGUIUtility.TrTextContent("Changes to this list will switch editor to the first available platform."); - public static readonly GUIContent playerOnlyGraphicsAPIInfo = EditorGUIUtility.TrTextContent("Changes to this list will take effect in builds. The editor API remains unchanged."); - public static readonly GUIContent appleSiliconOpenGLWarning = EditorGUIUtility.TrTextContent("OpenGL is not supported on Apple Silicon chips. Metal will be used on devices with Apple Silicon chips instead."); - public static readonly GUIContent sharedBetweenPlatformsInfo = EditorGUIUtility.TrTextContent("* Shared setting between multiple platforms."); - public static readonly GUIContent notApplicableInfo = EditorGUIUtility.TrTextContent("Not applicable for this platform."); - public static readonly GUIContent openGLFrameTimingStatsOnGPURecordersOnWarning = EditorGUIUtility.TrTextContent("On OpenGL, Frame Timing Stats may disable Profiler GPU Recorders and the GPU Profiler."); - public static readonly GUIContent openGLFrameTimingStatsOnGPURecordersOffInfo = EditorGUIUtility.TrTextContent("On OpenGL, Frame Timing Stats may disable the GPU Profiler."); - public static readonly GUIContent openGLFrameTimingStatsOffGPURecordersOnInfo = EditorGUIUtility.TrTextContent("On OpenGL, Profiler GPU Recorders may disable the GPU Profiler."); - public static readonly GUIContent displayResolutionDialogDeprecationWarning = EditorGUIUtility.TrTextContent("The Display Resolution Dialog has been deprecated and will be removed in a future version."); - public static readonly GUIContent flipModelSwapChainWarning = EditorGUIUtility.TrTextContent("Disabling DXGI flip model swapchain will result in Unity falling back to the slower and less efficient BitBlt model. See documentation for more information."); - public static readonly GUIContent unsetApplicationIdentifierWarning = EditorGUIUtility.TrTextContent("Don't forget to set the Application Identifier."); - public static readonly GUIContent applicationIdentifierWarning = EditorGUIUtility.TrTextContent("Invalid characters have been removed from the Application Identifier."); - public static readonly GUIContent applicationIdentifierError = EditorGUIUtility.TrTextContent("The Application Identifier must follow the convention 'com.YourCompanyName.YourProductName' and must contain only alphanumeric and hyphen characters."); - public static readonly GUIContent packageNameError = EditorGUIUtility.TrTextContent("The Package Name must follow the convention 'com.YourCompanyName.YourProductName' and must contain only alphanumeric and underscore characters. Each segment must start with an alphabetical character."); - public static readonly GUIContent insecureHttpWarning = EditorGUIUtility.TrTextContent("Plain text HTTP connections are not secure and can make your application vulnerable to attacks."); - public static readonly GUIContent iOSExternalAudioInputNotSupported = EditorGUIUtility.TrTextContent("Audio input from Bluetooth microphones is not supported when Mute Other Audio Sources is off."); - public static readonly GUIContent activeInputHandlingDeprecationError = EditorGUIUtility.TrTextContent("The Input Manager is a legacy feature and not recommended for new projects. For new projects you should use the Input System Package."); - public static readonly GUIContent activeInputHandlingError = EditorGUIUtility.TrTextContent("The Active Input Handling is invalid. To use Input System Package (New) or Both, install the Input System package. Otherwise set the Active Input Handling to Input Manager (Old)."); - public static readonly GUIContent virtualTexturingUnsupportedPlatformWarning = EditorGUIUtility.TrTextContent("The current target platform does not support Virtual Texturing. To build for this platform, uncheck Enable Virtual Texturing."); - public static readonly GUIContent hdrOutputRequireHDRRenderingWarning = EditorGUIUtility.TrTextContent("The active Render Pipeline does not have HDR enabled. Enable HDR in the Render Pipeline Asset to see the changes."); - public static readonly GUIContent graphicsAPIDeprecationMessage = EditorGUIUtility.TrTextContent("There are select Graphics API included that are deprecated and will be removed in a future version. For more information, refer to the Graphics API documentation."); - public static readonly GUIContent glesWithEntitiesGraphicsDeprecationMessage = EditorGUIUtility.TrTextContent("Support for OpenGL ES for Entities Graphics is deprecated, and will be removed in a future version of Entities Graphics."); + public static readonly GUIContent[] meshDeformations = { L10n.TextContent("CPU", null, null, null), L10n.TextContent("GPU", null, null, null), L10n.TextContent("GPU (Batched)", null, null, null) }; + public static readonly GUIContent scriptingDefineSymbolsApply = L10n.TextContent("Apply", null, null, null); + public static readonly GUIContent scriptingDefineSymbolsApplyRevert = L10n.TextContent("Revert", null, null, null); + public static readonly GUIContent[] il2CppLTOModeOptions = new GUIContent[] { L10n.TextContent("Full", null, null, null), L10n.TextContent("Thin", null, null, null) }; + public static readonly GUIContent[] il2CppLTOModeNoneOption = new GUIContent[] { L10n.TextContent("None", null, null, null) }; + public static readonly GUIContent scriptingDefault = L10n.TextContent("Default", null, null, null); + public static readonly GUIContent strippingDisabled = L10n.TextContent("Disabled", null, null, null); + public static readonly GUIContent strippingMinimal = L10n.TextContent("Minimal", null, null, null); + public static readonly GUIContent strippingLow = L10n.TextContent("Low", null, null, null); + public static readonly GUIContent strippingMedium = L10n.TextContent("Medium", null, null, null); + public static readonly GUIContent strippingHigh = L10n.TextContent("High", null, null, null); + public static readonly GUIContent activeInputHandlingBoth = L10n.TextContent("Both", null, null, null); + public static readonly GUIContent normalMapEncodingXYZ = L10n.TextContent("XYZ", null, null, null); + public static readonly GUIContent[] lightmapEncodingNames = { L10n.TextContent("Low Quality", null, null, null), L10n.TextContent("Normal Quality", null, null, null), L10n.TextContent("High Quality", null, null, null) }; + public static readonly GUIContent[] hdrCubemapEncodingNames = { L10n.TextContent("Low Quality", null, null, null), L10n.TextContent("Normal Quality", null, null, null), L10n.TextContent("High Quality", null, null, null) }; + public static readonly GUIContent[] shaderPrecisionModelOptions = { L10n.TextContent("Platform Default", null, null, null), L10n.TextContent("Unified", null, null, null) }; + public static readonly GUIContent loadStoreDebugModeEditorOnlyCheckbox = L10n.TextContent("Editor Only", "Load/Store Action Debug Mode will only affect the Editor", null, null); + public static readonly GUIContent applicationBuildNumber = L10n.TextContent("Build", null, null, null); + public static readonly GUIContent windowed = L10n.TextContent("Windowed", null, null, null); + public static readonly GUIContent overrideDefaultChunkSettings = L10n.TextContent("Override", "Override the default settings for this build target.", null, null); + public static readonly GUIContent recordingInfo = L10n.TextContent("Changes to this list will switch editor to the first available platform.", null, null, null); + public static readonly GUIContent playerOnlyGraphicsAPIInfo = L10n.TextContent("Changes to this list will take effect in builds. The editor API remains unchanged.", null, null, null); + public static readonly GUIContent appleSiliconOpenGLWarning = L10n.TextContent("OpenGL is not supported on Apple Silicon chips. Metal will be used on devices with Apple Silicon chips instead.", null, null, null); + public static readonly GUIContent sharedBetweenPlatformsInfo = L10n.TextContent("* Shared setting between multiple platforms.", null, null, null); + public static readonly GUIContent notApplicableInfo = L10n.TextContent("Not applicable for this platform.", null, null, null); + public static readonly GUIContent openGLFrameTimingStatsOnGPURecordersOnWarning = L10n.TextContent("On OpenGL, Frame Timing Stats may disable Profiler GPU Recorders and the GPU Profiler.", null, null, null); + public static readonly GUIContent openGLFrameTimingStatsOnGPURecordersOffInfo = L10n.TextContent("On OpenGL, Frame Timing Stats may disable the GPU Profiler.", null, null, null); + public static readonly GUIContent openGLFrameTimingStatsOffGPURecordersOnInfo = L10n.TextContent("On OpenGL, Profiler GPU Recorders may disable the GPU Profiler.", null, null, null); + public static readonly GUIContent displayResolutionDialogDeprecationWarning = L10n.TextContent("The Display Resolution Dialog has been deprecated and will be removed in a future version.", null, null, null); + public static readonly GUIContent flipModelSwapChainWarning = L10n.TextContent("Disabling DXGI flip model swapchain will result in Unity falling back to the slower and less efficient BitBlt model. See documentation for more information.", null, null, null); + public static readonly GUIContent unsetApplicationIdentifierWarning = L10n.TextContent("Don't forget to set the Application Identifier.", null, null, null); + public static readonly GUIContent applicationIdentifierWarning = L10n.TextContent("Invalid characters have been removed from the Application Identifier.", null, null, null); + public static readonly GUIContent applicationIdentifierError = L10n.TextContent("The Application Identifier must follow the convention 'com.YourCompanyName.YourProductName' and must contain only alphanumeric and hyphen characters.", null, null, null); + public static readonly GUIContent packageNameError = L10n.TextContent("The Package Name must follow the convention 'com.YourCompanyName.YourProductName' and must contain only alphanumeric and underscore characters. Each segment must start with an alphabetical character.", null, null, null); + public static readonly GUIContent insecureHttpWarning = L10n.TextContent("Plain text HTTP connections are not secure and can make your application vulnerable to attacks.", null, null, null); + public static readonly GUIContent iOSExternalAudioInputNotSupported = L10n.TextContent("Audio input from Bluetooth microphones is not supported when Mute Other Audio Sources is off.", null, null, null); + public static readonly GUIContent activeInputHandlingDeprecationError = L10n.TextContent("The Input Manager is a legacy feature and not recommended for new projects. For new projects you should use the Input System Package.", null, null, null); + public static readonly GUIContent activeInputHandlingError = L10n.TextContent("The Active Input Handling is invalid. To use Input System Package (New) or Both, install the Input System package. Otherwise set the Active Input Handling to Input Manager (Old).", null, null, null); + public static readonly GUIContent virtualTexturingUnsupportedPlatformWarning = L10n.TextContent("The current target platform does not support Virtual Texturing. To build for this platform, uncheck Enable Virtual Texturing.", null, null, null); + public static readonly GUIContent hdrOutputRequireHDRRenderingWarning = L10n.TextContent("The active Render Pipeline does not have HDR enabled. Enable HDR in the Render Pipeline Asset to see the changes.", null, null, null); + public static readonly GUIContent graphicsAPIDeprecationMessage = L10n.TextContent("There are select Graphics API included that are deprecated and will be removed in a future version. For more information, refer to the Graphics API documentation.", null, null, null); + public static readonly GUIContent glesWithEntitiesGraphicsDeprecationMessage = L10n.TextContent("Support for OpenGL ES for Entities Graphics is deprecated, and will be removed in a future version of Entities Graphics.", null, null, null); public static readonly string changeColorSpaceString = L10n.Tr("Changing the color space may take a significant amount of time.", null); public static readonly string globalPlayerSettingsInfo = L10n.Tr("Editing these global player settings will not affect the current state of the project, because the active build profile is using its own customized player settings. Edit the build profile to change them.", null); @@ -113,182 +113,183 @@ class SettingsContentNonSearchable class SettingsContent { - public static readonly GUIContent cursorHotspot = EditorGUIUtility.TrTextContent("Cursor Hotspot"); - public static readonly GUIContent defaultCursor = EditorGUIUtility.TrTextContent("Default Cursor"); - public static readonly GUIContent vertexChannelCompressionMask = EditorGUIUtility.TrTextContent("Vertex Compression*", "Select which vertex channels should be compressed. Compression can save memory and bandwidth, but precision will be lower."); - - public static readonly GUIContent resolutionPresentationTitle = EditorGUIUtility.TrTextContent("Resolution and Presentation"); - public static readonly GUIContent resolutionTitle = EditorGUIUtility.TrTextContent("Resolution"); - public static readonly GUIContent orientationTitle = EditorGUIUtility.TrTextContent("Orientation"); - public static readonly GUIContent allowedOrientationTitle = EditorGUIUtility.TrTextContent("Allowed Orientations for Auto Rotation"); - public static readonly GUIContent multitaskingSupportTitle = EditorGUIUtility.TrTextContent("Multitasking Support"); - public static readonly GUIContent statusBarTitle = EditorGUIUtility.TrTextContent("Status Bar"); - public static readonly GUIContent standalonePlayerOptionsTitle = EditorGUIUtility.TrTextContent("Standalone Player Options"); - public static readonly GUIContent debuggingCrashReportingTitle = EditorGUIUtility.TrTextContent("Debugging and crash reporting"); - public static readonly GUIContent crashReportingTitle = EditorGUIUtility.TrTextContent("Crash Reporting"); - public static readonly GUIContent otherSettingsTitle = EditorGUIUtility.TrTextContent("Other Settings"); - public static readonly GUIContent renderingTitle = EditorGUIUtility.TrTextContent("Rendering"); - public static readonly GUIContent vulkanSettingsTitle = EditorGUIUtility.TrTextContent("Vulkan Settings"); - public static readonly GUIContent d3d12SettingsTitle = EditorGUIUtility.TrTextContent("D3D12 Settings"); - - public static readonly GUIContent webGPUSettingsTitle = EditorGUIUtility.TrTextContent("WebGPU Settings"); - public static readonly GUIContent identificationTitle = EditorGUIUtility.TrTextContent("Identification"); - public static readonly GUIContent configurationTitle = EditorGUIUtility.TrTextContent("Configuration"); - public static readonly GUIContent optimizationTitle = EditorGUIUtility.TrTextContent("Optimization"); - public static readonly GUIContent loggingTitle = EditorGUIUtility.TrTextContent("Stack Trace*"); - public static readonly GUIContent legacyTitle = EditorGUIUtility.TrTextContent("Legacy"); - public static readonly GUIContent publishingSettingsTitle = EditorGUIUtility.TrTextContent("Publishing Settings"); - public static readonly GUIContent captureLogsTitle = EditorGUIUtility.TrTextContent("Capture Logs"); - - public static readonly GUIContent usePlayerLog = EditorGUIUtility.TrTextContent("Use Player Log"); - public static readonly GUIContent resizableWindow = EditorGUIUtility.TrTextContent("Resizable Window"); - public static readonly GUIContent forceSingleInstance = EditorGUIUtility.TrTextContent("Force Single Instance"); - - public static readonly GUIContent shaderSectionTitle = EditorGUIUtility.TrTextContent("Shader Settings"); - public static readonly GUIContent shaderVariantLoadingTitle = EditorGUIUtility.TrTextContent("Shader Variant Loading Settings"); - public static readonly GUIContent defaultShaderChunkSize = EditorGUIUtility.TrTextContent("Default chunk size (MB)*", "Use this setting to control how much memory is used when loading shader variants."); - public static readonly GUIContent defaultShaderChunkCount = EditorGUIUtility.TrTextContent("Default chunk count*", "Use this setting to control how much memory is used when loading shader variants."); - public static readonly GUIContent platformShaderChunkSize = EditorGUIUtility.TrTextContent("Chunk size (MB)", "Use this setting to control how much memory is used when loading shader variants."); - public static readonly GUIContent platformShaderChunkCount = EditorGUIUtility.TrTextContent("Chunk count", "Use this setting to control how much memory is used when loading shader variants."); - - public static readonly GUIContent bakeCollisionMeshes = EditorGUIUtility.TrTextContent("Prebake Collision Meshes*", "Bake collision data into the meshes on build time"); - public static readonly GUIContent dedicatedServerOptimizations = EditorGUIUtility.TrTextContent("Enable Dedicated Server optimizations", "Performs additional optimizations on Dedicated Server builds."); - public static readonly GUIContent keepLoadedShadersAlive = EditorGUIUtility.TrTextContent("Keep Loaded Shaders Alive*", "Prevents shaders from being unloaded"); - public static readonly GUIContent preloadedAssets = EditorGUIUtility.TrTextContent("Preloaded Assets*", "Assets to load at start up in the player and kept alive until the player terminates"); - public static readonly GUIContent stripEngineCode = EditorGUIUtility.TrTextContent("Strip Engine Code*", "Strip Unused Engine Code - Note that byte code stripping of managed assemblies is always enabled for the IL2CPP scripting backend."); - public static readonly GUIContent iPhoneScriptCallOptimization = EditorGUIUtility.TrTextContent("Script Call Optimization*"); - public static readonly GUIContent enableInternalProfiler = EditorGUIUtility.TrTextContent("Enable Internal Profiler* (Deprecated)", "Internal profiler counters should be accessed by scripts using UnityEngine.Profiling::Profiler API."); - public static readonly GUIContent stripUnusedMeshComponents = EditorGUIUtility.TrTextContent("Optimize Mesh Data*", "Remove unused mesh components"); - public static readonly GUIContent strictShaderVariantMatching = EditorGUIUtility.TrTextContent("Strict shader variant matching*", "When enabled, if a shader variant is missing, Unity uses the error shader and displays an error in the Console."); - public static readonly GUIContent mipStripping = EditorGUIUtility.TrTextContent("Texture Mipmap Stripping*", "Remove unused texture mipmap levels from package builds, reducing package size on disk. Limits the texture quality settings to the highest mipmap level that was included during the build."); - public static readonly GUIContent enableFrameTimingStats = EditorGUIUtility.TrTextContent("Frame Timing Stats", "Enable gathering of CPU/GPU frame timing statistics."); - public static readonly GUIContent enableOpenGLProfilerGPURecorders = EditorGUIUtility.TrTextContent("OpenGL: Profiler GPU Recorders", "Enable Profiler Recorders when rendering with OpenGL. Always enabled with other rendering APIs. Optional on OpenGL due to potential incompatibility with Frame Timing Stats and the GPU Profiler."); - public static readonly GUIContent defaultScreenWidth = EditorGUIUtility.TrTextContent("Default Screen Width"); - public static readonly GUIContent defaultScreenHeight = EditorGUIUtility.TrTextContent("Default Screen Height"); - public static readonly GUIContent macRetinaSupport = EditorGUIUtility.TrTextContent("Mac Retina Support"); - public static readonly GUIContent runInBackground = EditorGUIUtility.TrTextContent("Run In Background*"); - public static readonly GUIContent callOnDisableOnAssetBundleUnload = EditorGUIUtility.TrTextContent("Call OnDisable On AssetBundle Unload", "Call OnDisable on MonoBehaviours and ScriptableObjects when unloading AssetBundles"); - public static readonly GUIContent defaultIsNativeResolution = EditorGUIUtility.TrTextContent("Default Is Native Resolution"); - public static readonly GUIContent defaultScreenOrientation = EditorGUIUtility.TrTextContent("Default Orientation*"); - public static readonly GUIContent allowedAutoRotateToPortrait = EditorGUIUtility.TrTextContent("Portrait"); - public static readonly GUIContent allowedAutoRotateToPortraitUpsideDown = EditorGUIUtility.TrTextContent("Portrait Upside Down"); - public static readonly GUIContent allowedAutoRotateToLandscapeRight = EditorGUIUtility.TrTextContent("Landscape Right"); - public static readonly GUIContent allowedAutoRotateToLandscapeLeft = EditorGUIUtility.TrTextContent("Landscape Left"); - public static readonly GUIContent UIRequiresFullScreen = EditorGUIUtility.TrTextContent("Requires Fullscreen"); - public static readonly GUIContent UIStatusBarHidden = EditorGUIUtility.TrTextContent("Status Bar Hidden"); - public static readonly GUIContent UIStatusBarStyle = EditorGUIUtility.TrTextContent("Status Bar Style"); - public static readonly GUIContent fullscreenMode = EditorGUIUtility.TrTextContent("Fullscreen Mode ", " Not all platforms support all modes"); - public static readonly GUIContent exclusiveFullscreen = EditorGUIUtility.TrTextContent("Exclusive Fullscreen"); - public static readonly GUIContent fullscreenWindow = EditorGUIUtility.TrTextContent("Fullscreen Window"); - public static readonly GUIContent maximizedWindow = EditorGUIUtility.TrTextContent("Maximized Window"); - public static readonly GUIContent displayResolutionDialogEnabledLabel = EditorGUIUtility.TrTextContent("Enabled (Deprecated)"); - public static readonly GUIContent displayResolutionDialogHiddenLabel = EditorGUIUtility.TrTextContent("Hidden by Default (Deprecated)"); - public static readonly GUIContent visibleInBackground = EditorGUIUtility.TrTextContent("Visible In Background"); - public static readonly GUIContent allowFullscreenSwitch = EditorGUIUtility.TrTextContent("Allow Fullscreen Switch*"); - public static readonly GUIContent useFlipModelSwapChain = EditorGUIUtility.TrTextContent("Use DXGI flip model swapchain for D3D11", "Disable this option to fallback to Windows 7-style BitBlt model. Using flip model (leaving this option enabled) ensures the best performance. This setting affects only D3D11 graphics API."); - public static readonly GUIContent use32BitDisplayBuffer = EditorGUIUtility.TrTextContent("Use 32-bit Display Buffer*", "If set Display Buffer will be created to hold 32-bit color values. Use it only if you see banding, as it has performance implications."); - public static readonly GUIContent disableDepthAndStencilBuffers = EditorGUIUtility.TrTextContent("Disable Depth and Stencil*"); - public static readonly GUIContent preserveFramebufferAlpha = EditorGUIUtility.TrTextContent("Render Over Native UI*", "Enable this option ONLY if you want Unity to render on top of the native Android or iOS UI."); - public static readonly GUIContent logObjCUncaughtExceptions = EditorGUIUtility.TrTextContent("Log Obj-C Uncaught Exceptions*"); - public static readonly GUIContent enableCrashReportAPI = EditorGUIUtility.TrTextContent("Enable CrashReport API*"); - public static readonly GUIContent activeColorSpace = EditorGUIUtility.TrTextContent("Color Space*"); - public static readonly GUIContent unsupportedMSAAFallback = EditorGUIUtility.TrTextContent("MSAA Fallback"); - public static readonly GUIContent colorGamut = EditorGUIUtility.TrTextContent("Color Gamut*"); - public static readonly GUIContent colorGamutForMac = EditorGUIUtility.TrTextContent("Color Gamut For Mac*"); - public static readonly GUIContent metalForceHardShadows = EditorGUIUtility.TrTextContent("Force hard shadows on Metal*"); - public static readonly GUIContent metalAPIValidation = EditorGUIUtility.TrTextContent("Metal API Validation*", "When enabled, additional binding state validation is applied."); - public static readonly GUIContent metalFramebufferOnly = EditorGUIUtility.TrTextContent("Metal Write-Only Backbuffer*", "Set framebufferOnly flag on backbuffer. This prevents readback from backbuffer but enables some driver optimizations."); - public static readonly GUIContent metalUseMetalDisplayLink = EditorGUIUtility.TrTextContent("Use MetalDisplayLink*", "CAMetalDisplayLink provides smoother frame pacing and decreases stuttering. It also makes Time.deltaTime more stable and deterministic."); - public static readonly GUIContent framebufferDepthMemorylessMode = EditorGUIUtility.TrTextContent("Memoryless Depth*", "Memoryless mode of framebuffer depth"); - public static readonly GUIContent vulkanEnableSetSRGBWrite = EditorGUIUtility.TrTextContent("SRGB Write Mode*", "If set, enables Graphics.SetSRGBWrite() for toggling sRGB write mode during the frame but may decrease performance especially on tiled GPUs."); - public static readonly GUIContent vulkanNumSwapchainBuffers = EditorGUIUtility.TrTextContent("Number of swapchain buffers*"); - public static readonly GUIContent vulkanEnableLateAcquireNextImage = EditorGUIUtility.TrTextContent("Get swapchain image late as possible*", "If set, renders to a staging image to delay acquiring the swapchain buffer."); - public static readonly GUIContent vulkanEnableCommandBufferRecycling = EditorGUIUtility.TrTextContent("Recycle command buffers*", "When enabled, command buffers are recycled after they have been executed as opposed to being freed."); - public static readonly GUIContent d3d12FilterLists = EditorGUIUtility.TrTextContent("Device Filtering Asset", "This asset defines one or more device filter lists that may allow or disallow the use of the D3D12 API on a given device or a set a preferred graphics mode for devices that match a given filter."); - public static readonly GUIContent webGPUFilterLists = EditorGUIUtility.TrTextContent("Device Filtering Asset", "This asset defines one or more device filter lists that may allow or disallow the use of the WebGPU API on a given device or a set a preferred graphics mode for devices that match a given filter."); - public static readonly GUIContent mTRendering = EditorGUIUtility.TrTextContent("Multithreaded Rendering*"); - public static readonly GUIContent staticBatching = EditorGUIUtility.TrTextContent("Static Batching"); - public static readonly GUIContent dynamicBatching = EditorGUIUtility.TrTextContent("Dynamic Batching", "Toggle Dynamic Batching. Note: Sprites are always dynamically batched."); - public static readonly GUIContent warningDynamicBatching = EditorGUIUtility.TrTextContent("Dynamic Batching has been removed due to limited performance benefits on modern hardware. This option no longer has any effect. Use GPU Instancing instead."); - public static readonly GUIContent spriteBatchingVertexThreshold = EditorGUIUtility.TrTextContent("Sprite Batching Threshold", "Maximum vertex threshold of a sprite to be batched. Any sprite with vertex count above this value is not batched."); - public static readonly GUIContent spriteBatchingMaxVertexCount = EditorGUIUtility.TrTextContent("Sprite Batching Max Vertex Count", "Maximum vertex count per batch."); - public static readonly GUIContent graphicsJobsNonExperimental = EditorGUIUtility.TrTextContent("Graphics Jobs"); - public static readonly GUIContent graphicsJobsExperimental = EditorGUIUtility.TrTextContent("Graphics Jobs (Experimental)"); - public static readonly GUIContent graphicsJobsMode = EditorGUIUtility.TrTextContent("Graphics Jobs Mode"); - public static readonly GUIContent graphicsJobsSyncAfterKick = EditorGUIUtility.TrTextContent("Sync after kick (fallback)", "This prevents graphics jobs from running in parallel to the render thread. Enable this if you see artifacts with graphics jobs."); - public static readonly GUIContent appleDeveloperTeamID = EditorGUIUtility.TrTextContent("iOS Developer Team ID", "Developers can retrieve their Team ID by visiting the Apple Developer site under Account > Membership."); - public static readonly GUIContent gcIncremental = EditorGUIUtility.TrTextContent("Use incremental GC*", "With incremental Garbage Collection, the Garbage Collector will try to time-slice the collection task into multiple steps, to avoid long GC times preventing content from running smoothly."); - public static readonly GUIContent accelerometerFrequency = EditorGUIUtility.TrTextContent("Accelerometer Frequency*"); - public static readonly GUIContent cameraUsageDescription = EditorGUIUtility.TrTextContent("Camera Usage Description*", "String shown to the user when requesting permission to use the device camera. Written to the NSCameraUsageDescription field in Xcode project's info.plist file"); - public static readonly GUIContent locationUsageDescription = EditorGUIUtility.TrTextContent("Location Usage Description*", "String shown to the user when requesting permission to access the device location. Written to the NSLocationWhenInUseUsageDescription field in Xcode project's info.plist file."); - public static readonly GUIContent microphoneUsageDescription = EditorGUIUtility.TrTextContent("Microphone Usage Description*", "String shown to the user when requesting to use the device microphone. Written to the NSMicrophoneUsageDescription field in Xcode project's info.plist file"); - public static readonly GUIContent muteOtherAudioSources = EditorGUIUtility.TrTextContent("Mute Other Audio Sources*"); - public static readonly GUIContent prepareIOSForRecording = EditorGUIUtility.TrTextContent("Prepare iOS for Recording"); - public static readonly GUIContent forceIOSSpeakersWhenRecording = EditorGUIUtility.TrTextContent("Force iOS Speakers when Recording"); - public static readonly GUIContent adjustIOSFPSUsingThermalState = EditorGUIUtility.TrTextContent("Adjust iOS FPS based on thermal state", "When the device overheats, iOS enters Serious and then Critical thermal states. In Critical state, iOS reduces system-wide performance to lower device temperature. If this setting is enabled Unity proactively lowers the frame rate in Serious and Critical thermal states, helping prevent the device from becoming too hot, improving responsiveness under overheating conditions, and reducing the likelihood of GPU timeouts or rendering freezes."); - public static readonly GUIContent thermalStateSeriousIOSFPS = EditorGUIUtility.TrTextContent("Serious Thermal State FPS", "When the device enters Serious Thermal State Unity will lower the frame rate to this value."); - public static readonly GUIContent thermalStateCriticalIOSFPS = EditorGUIUtility.TrTextContent("Critical Thermal State FPS", "When the device enters Critical Thermal State Unity will lower the frame rate to this value."); - public static readonly GUIContent UIRequiresPersistentWiFi = EditorGUIUtility.TrTextContent("Requires Persistent WiFi*"); - public static readonly GUIContent insecureHttpOption = EditorGUIUtility.TrTextContent("Allow downloads over HTTP*", ""); - public static readonly GUIContent autoGraphicsAPI = EditorGUIUtility.TrTextContent("Auto Graphics API"); - public static readonly GUIContent autoGraphicsAPIForWindows = EditorGUIUtility.TrTextContent("Auto Graphics API for Windows"); - public static readonly GUIContent autoGraphicsAPIForMac = EditorGUIUtility.TrTextContent("Auto Graphics API for Mac"); - public static readonly GUIContent autoGraphicsAPIForLinux = EditorGUIUtility.TrTextContent("Auto Graphics API for Linux"); - - public static readonly GUIContent iOSURLSchemes = EditorGUIUtility.TrTextContent("Supported URL schemes*"); - public static readonly GUIContent requireAEP = EditorGUIUtility.TrTextContent("Require ES3.1+AEP"); - public static readonly GUIContent require32 = EditorGUIUtility.TrTextContent("Require ES3.2"); - public static readonly GUIContent skinOnGPU = EditorGUIUtility.TrTextContent("GPU Skinning*", "Calculate mesh skinning and blend shapes on the GPU via shaders"); - public static readonly GUIContent scriptingDefineSymbols = EditorGUIUtility.TrTextContent("Scripting Define Symbols", "Preprocessor defines passed to the C# script compiler."); - public static readonly GUIContent additionalCompilerArguments = EditorGUIUtility.TrTextContent("Additional Compiler Arguments", "Additional arguments passed to the C# script compiler."); - public static readonly GUIContent scriptingDefineSymbolsCopyDefines = EditorGUIUtility.TrTextContent("Copy Defines", "Copy applied defines"); - public static readonly GUIContent suppressCommonWarnings = EditorGUIUtility.TrTextContent("Suppress Common Warnings", "Suppresses C# warnings CS0169, CS0649, and CS0282."); - public static readonly GUIContent scriptingBackend = EditorGUIUtility.TrTextContent("Scripting Backend"); - public static readonly GUIContent managedStrippingLevel = EditorGUIUtility.TrTextContent("Managed Stripping Level", "If scripting backend is IL2CPP, managed stripping can't be disabled."); - public static readonly GUIContent managedCodeVariant = EditorGUIUtility.TrTextContent("Managed Code Variant", "Defines how C# code in the project is compiled when exporting a build. Each variant level is inclusive of the next level: for instance, the Debug variant has Unity checks enabled, whereas the Checked variant has Instrumented code paths enabled."); - public static readonly GUIContent il2cppCompilerConfiguration = EditorGUIUtility.TrTextContent("C++ Compiler Configuration", "The C++ compiler configuration used when compiling IL2CPP generated code."); - public static readonly GUIContent il2cppCodeGeneration = EditorGUIUtility.TrTextContent("IL2CPP Code Generation", "Determines whether IL2CPP should generate code optimized for runtime performance or build size/iteration."); - public static readonly GUIContent[] il2cppCodeGenerationNames = new GUIContent[] { EditorGUIUtility.TrTextContent("Optimize for runtime speed"), EditorGUIUtility.TrTextContent("Optimize for code size and build time") }; - public static readonly GUIContent il2cppStacktraceInformation = EditorGUIUtility.TrTextContent("IL2CPP Stacktrace Information", "Which information to include in stack traces. Including the file name and line number may increase build size."); - public static readonly GUIContent il2CppLTOMode = EditorGUIUtility.TrTextContent("IL2CPP LTO Mode", "Link Time Optimization mode. Full LTO produces smaller and faster code but takes longer to link. Thin LTO is faster to link with nearly equivalent optimization."); - public static readonly GUIContent il2CppLTOModeDisabled = EditorGUIUtility.TrTextContent("IL2CPP LTO Mode", "LTO is only applied in Master builds. Switch the C++ Compiler Configuration to Master to enable LTO."); + public static readonly GUIContent cursorHotspot = L10n.TextContent("Cursor Hotspot", null, null, null); + public static readonly GUIContent defaultCursor = L10n.TextContent("Default Cursor", null, null, null); + public static readonly GUIContent vertexChannelCompressionMask = L10n.TextContent("Vertex Compression*", "Select which vertex channels should be compressed. Compression can save memory and bandwidth, but precision will be lower.", null, null); + + public static readonly GUIContent resolutionPresentationTitle = L10n.TextContent("Resolution and Presentation", null, null, null); + public static readonly GUIContent resolutionTitle = L10n.TextContent("Resolution", null, null, null); + public static readonly GUIContent orientationTitle = L10n.TextContent("Orientation", null, null, null); + public static readonly GUIContent allowedOrientationTitle = L10n.TextContent("Allowed Orientations for Auto Rotation", null, null, null); + public static readonly GUIContent multitaskingSupportTitle = L10n.TextContent("Multitasking Support", null, null, null); + public static readonly GUIContent statusBarTitle = L10n.TextContent("Status Bar", null, null, null); + public static readonly GUIContent standalonePlayerOptionsTitle = L10n.TextContent("Standalone Player Options", null, null, null); + public static readonly GUIContent debuggingCrashReportingTitle = L10n.TextContent("Debugging and crash reporting", null, null, null); + public static readonly GUIContent crashReportingTitle = L10n.TextContent("Crash Reporting", null, null, null); + public static readonly GUIContent otherSettingsTitle = L10n.TextContent("Other Settings", null, null, null); + public static readonly GUIContent renderingTitle = L10n.TextContent("Rendering", null, null, null); + public static readonly GUIContent vulkanSettingsTitle = L10n.TextContent("Vulkan Settings", null, null, null); + public static readonly GUIContent d3d12SettingsTitle = L10n.TextContent("D3D12 Settings", null, null, null); + + public static readonly GUIContent webGPUSettingsTitle = L10n.TextContent("WebGPU Settings", null, null, null); + public static readonly GUIContent identificationTitle = L10n.TextContent("Identification", null, null, null); + public static readonly GUIContent configurationTitle = L10n.TextContent("Configuration", null, null, null); + public static readonly GUIContent optimizationTitle = L10n.TextContent("Optimization", null, null, null); + public static readonly GUIContent loggingTitle = L10n.TextContent("Stack Trace*", null, null, null); + public static readonly GUIContent legacyTitle = L10n.TextContent("Legacy", null, null, null); + public static readonly GUIContent publishingSettingsTitle = L10n.TextContent("Publishing Settings", null, null, null); + public static readonly GUIContent captureLogsTitle = L10n.TextContent("Capture Logs", null, null, null); + + public static readonly GUIContent usePlayerLog = L10n.TextContent("Use Player Log", null, null, null); + public static readonly GUIContent resizableWindow = L10n.TextContent("Resizable Window", null, null, null); + public static readonly GUIContent forceSingleInstance = L10n.TextContent("Force Single Instance", null, null, null); + + public static readonly GUIContent shaderSectionTitle = L10n.TextContent("Shader Settings", null, null, null); + public static readonly GUIContent shaderVariantLoadingTitle = L10n.TextContent("Shader Variant Loading Settings", null, null, null); + public static readonly GUIContent defaultShaderChunkSize = L10n.TextContent("Default chunk size (MB)*", "Use this setting to control how much memory is used when loading shader variants.", null, null); + public static readonly GUIContent defaultShaderChunkCount = L10n.TextContent("Default chunk count*", "Use this setting to control how much memory is used when loading shader variants.", null, null); + public static readonly GUIContent platformShaderChunkSize = L10n.TextContent("Chunk size (MB)", "Use this setting to control how much memory is used when loading shader variants.", null, null); + public static readonly GUIContent platformShaderChunkCount = L10n.TextContent("Chunk count", "Use this setting to control how much memory is used when loading shader variants.", null, null); + + public static readonly GUIContent bakeCollisionMeshes = L10n.TextContent("Prebake Collision Meshes*", "Bake collision data into the meshes on build time", null, null); + public static readonly GUIContent dedicatedServerOptimizations = L10n.TextContent("Enable Dedicated Server optimizations", "Performs additional optimizations on Dedicated Server builds.", null, null); + public static readonly GUIContent keepLoadedShadersAlive = L10n.TextContent("Keep Loaded Shaders Alive*", "Prevents shaders from being unloaded", null, null); + public static readonly GUIContent preloadedAssets = L10n.TextContent("Preloaded Assets*", "Assets to load at start up in the player and kept alive until the player terminates", null, null); + public static readonly GUIContent stripEngineCode = L10n.TextContent("Strip Engine Code*", "Strip Unused Engine Code - Note that byte code stripping of managed assemblies is always enabled for the IL2CPP scripting backend.", null, null); + public static readonly GUIContent iPhoneScriptCallOptimization = L10n.TextContent("Script Call Optimization*", null, null, null); + public static readonly GUIContent enableInternalProfiler = L10n.TextContent("Enable Internal Profiler* (Deprecated)", "Internal profiler counters should be accessed by scripts using UnityEngine.Profiling::Profiler API.", null, null); + public static readonly GUIContent stripUnusedMeshComponents = L10n.TextContent("Optimize Mesh Data*", "Remove unused mesh components", null, null); + public static readonly GUIContent strictShaderVariantMatching = L10n.TextContent("Strict shader variant matching*", "When enabled, if a shader variant is missing, Unity uses the error shader and displays an error in the Console.", null, null); + public static readonly GUIContent mipStripping = L10n.TextContent("Texture Mipmap Stripping*", "Remove unused texture mipmap levels from package builds, reducing package size on disk. Limits the texture quality settings to the highest mipmap level that was included during the build.", null, null); + public static readonly GUIContent enableFrameTimingStats = L10n.TextContent("Frame Timing Stats", "Enable gathering of CPU/GPU frame timing statistics.", null, null); + public static readonly GUIContent enableOpenGLProfilerGPURecorders = L10n.TextContent("OpenGL: Profiler GPU Recorders", "Enable Profiler Recorders when rendering with OpenGL. Always enabled with other rendering APIs. Optional on OpenGL due to potential incompatibility with Frame Timing Stats and the GPU Profiler.", null, null); + public static readonly GUIContent defaultScreenWidth = L10n.TextContent("Default Screen Width", null, null, null); + public static readonly GUIContent defaultScreenHeight = L10n.TextContent("Default Screen Height", null, null, null); + public static readonly GUIContent macRetinaSupport = L10n.TextContent("Mac Retina Support", null, null, null); + public static readonly GUIContent runInBackground = L10n.TextContent("Run In Background*", null, null, null); + public static readonly GUIContent callOnDisableOnAssetBundleUnload = L10n.TextContent("Call OnDisable On AssetBundle Unload", "Call OnDisable on MonoBehaviours and ScriptableObjects when unloading AssetBundles", null, null); + public static readonly GUIContent defaultIsNativeResolution = L10n.TextContent("Default Is Native Resolution", null, null, null); + public static readonly GUIContent defaultScreenOrientation = L10n.TextContent("Default Orientation*", null, null, null); + public static readonly GUIContent allowedAutoRotateToPortrait = L10n.TextContent("Portrait", null, null, null); + public static readonly GUIContent allowedAutoRotateToPortraitUpsideDown = L10n.TextContent("Portrait Upside Down", null, null, null); + public static readonly GUIContent allowedAutoRotateToLandscapeRight = L10n.TextContent("Landscape Right", null, null, null); + public static readonly GUIContent allowedAutoRotateToLandscapeLeft = L10n.TextContent("Landscape Left", null, null, null); + public static readonly GUIContent UIRequiresFullScreen = L10n.TextContent("Requires Fullscreen", null, null, null); + public static readonly GUIContent UIStatusBarHidden = L10n.TextContent("Status Bar Hidden", null, null, null); + public static readonly GUIContent UIStatusBarStyle = L10n.TextContent("Status Bar Style", null, null, null); + public static readonly GUIContent fullscreenMode = L10n.TextContent("Fullscreen Mode ", " Not all platforms support all modes", null, null); + public static readonly GUIContent exclusiveFullscreen = L10n.TextContent("Exclusive Fullscreen", null, null, null); + public static readonly GUIContent fullscreenWindow = L10n.TextContent("Fullscreen Window", null, null, null); + public static readonly GUIContent maximizedWindow = L10n.TextContent("Maximized Window", null, null, null); + public static readonly GUIContent displayResolutionDialogEnabledLabel = L10n.TextContent("Enabled (Deprecated)", null, null, null); + public static readonly GUIContent displayResolutionDialogHiddenLabel = L10n.TextContent("Hidden by Default (Deprecated)", null, null, null); + public static readonly GUIContent visibleInBackground = L10n.TextContent("Visible In Background", null, null, null); + public static readonly GUIContent allowFullscreenSwitch = L10n.TextContent("Allow Fullscreen Switch*", null, null, null); + public static readonly GUIContent useFlipModelSwapChain = L10n.TextContent("Use DXGI flip model swapchain for D3D11", "Disable this option to fallback to Windows 7-style BitBlt model. Using flip model (leaving this option enabled) ensures the best performance. This setting affects only D3D11 graphics API.", null, null); + public static readonly GUIContent use32BitDisplayBuffer = L10n.TextContent("Use 32-bit Display Buffer*", "If set Display Buffer will be created to hold 32-bit color values. Use it only if you see banding, as it has performance implications.", null, null); + public static readonly GUIContent disableDepthAndStencilBuffers = L10n.TextContent("Disable Depth and Stencil*", null, null, null); + public static readonly GUIContent preserveFramebufferAlpha = L10n.TextContent("Render Over Native UI*", "Enable this option ONLY if you want Unity to render on top of the native Android or iOS UI.", null, null); + public static readonly GUIContent logObjCUncaughtExceptions = L10n.TextContent("Log Obj-C Uncaught Exceptions*", null, null, null); + public static readonly GUIContent enableCrashReportAPI = L10n.TextContent("Enable CrashReport API*", null, null, null); + public static readonly GUIContent activeColorSpace = L10n.TextContent("Color Space*", null, null, null); + public static readonly GUIContent unsupportedMSAAFallback = L10n.TextContent("MSAA Fallback", null, null, null); + public static readonly GUIContent colorGamut = L10n.TextContent("Color Gamut*", null, null, null); + public static readonly GUIContent colorGamutForMac = L10n.TextContent("Color Gamut For Mac*", null, null, null); + public static readonly GUIContent metalForceHardShadows = L10n.TextContent("Force hard shadows on Metal*", null, null, null); + public static readonly GUIContent metalAPIValidation = L10n.TextContent("Metal API Validation*", "When enabled, additional binding state validation is applied.", null, null); + public static readonly GUIContent metalFramebufferOnly = L10n.TextContent("Metal Write-Only Backbuffer*", "Set framebufferOnly flag on backbuffer. This prevents readback from backbuffer but enables some driver optimizations.", null, null); + public static readonly GUIContent metalUseMetalDisplayLink = L10n.TextContent("Use MetalDisplayLink*", "CAMetalDisplayLink provides smoother frame pacing and decreases stuttering. It also makes Time.deltaTime more stable and deterministic.", null, null); + public static readonly GUIContent framebufferDepthMemorylessMode = L10n.TextContent("Memoryless Depth*", "Memoryless mode of framebuffer depth", null, null); + public static readonly GUIContent vulkanEnableSetSRGBWrite = L10n.TextContent("SRGB Write Mode*", "If set, enables Graphics.SetSRGBWrite() for toggling sRGB write mode during the frame but may decrease performance especially on tiled GPUs.", null, null); + public static readonly GUIContent vulkanNumSwapchainBuffers = L10n.TextContent("Number of swapchain buffers*", null, null, null); + public static readonly GUIContent vulkanEnableLateAcquireNextImage = L10n.TextContent("Get swapchain image late as possible*", "If set, renders to a staging image to delay acquiring the swapchain buffer.", null, null); + public static readonly GUIContent vulkanEnableCommandBufferRecycling = L10n.TextContent("Recycle command buffers*", "When enabled, command buffers are recycled after they have been executed as opposed to being freed.", null, null); + public static readonly GUIContent d3d12FilterLists = L10n.TextContent("Device Filtering Asset", "This asset defines one or more device filter lists that may allow or disallow the use of the D3D12 API on a given device or a set a preferred graphics mode for devices that match a given filter.", null, null); + public static readonly GUIContent webGPUFilterLists = L10n.TextContent("Device Filtering Asset", "This asset defines one or more device filter lists that may allow or disallow the use of the WebGPU API on a given device or a set a preferred graphics mode for devices that match a given filter.", null, null); + public static readonly GUIContent mTRendering = L10n.TextContent("Multithreaded Rendering*", null, null, null); + public static readonly GUIContent staticBatching = L10n.TextContent("Static Batching", null, null, null); + public static readonly GUIContent dynamicBatching = L10n.TextContent("Dynamic Batching", "Toggle Dynamic Batching. Note: Sprites are always dynamically batched.", null, null); + public static readonly GUIContent warningDynamicBatching = L10n.TextContent("Dynamic Batching has been removed due to limited performance benefits on modern hardware. This option no longer has any effect. Use GPU Instancing instead.", null, null, null); + public static readonly GUIContent spriteBatchingVertexThreshold = L10n.TextContent("Sprite Batching Threshold", "Maximum vertex threshold of a sprite to be batched. Any sprite with vertex count above this value is not batched.", null, null); + public static readonly GUIContent spriteBatchingMaxVertexCount = L10n.TextContent("Sprite Batching Max Vertex Count", "Maximum vertex count per batch.", null, null); + public static readonly GUIContent graphicsJobsNonExperimental = L10n.TextContent("Graphics Jobs", null, null, null); + public static readonly GUIContent graphicsJobsExperimental = L10n.TextContent("Graphics Jobs (Experimental)", null, null, null); + public static readonly GUIContent graphicsJobsMode = L10n.TextContent("Graphics Jobs Mode", null, null, null); + public static readonly GUIContent graphicsJobsSyncAfterKick = L10n.TextContent("Sync after kick (fallback)", "This prevents graphics jobs from running in parallel to the render thread. Enable this if you see artifacts with graphics jobs.", null, null); + public static readonly GUIContent appleDeveloperTeamID = L10n.TextContent("iOS Developer Team ID", "Developers can retrieve their Team ID by visiting the Apple Developer site under Account > Membership.", null, null); + public static readonly GUIContent gcIncremental = L10n.TextContent("Use incremental GC*", "With incremental Garbage Collection, the Garbage Collector will try to time-slice the collection task into multiple steps, to avoid long GC times preventing content from running smoothly.", null, null); + public static readonly GUIContent accelerometerFrequency = L10n.TextContent("Accelerometer Frequency*", null, null, null); + public static readonly GUIContent cameraUsageDescription = L10n.TextContent("Camera Usage Description*", "String shown to the user when requesting permission to use the device camera. Written to the NSCameraUsageDescription field in Xcode project's info.plist file", null, null); + public static readonly GUIContent locationUsageDescription = L10n.TextContent("Location Usage Description*", "String shown to the user when requesting permission to access the device location. Written to the NSLocationWhenInUseUsageDescription field in Xcode project's info.plist file.", null, null); + public static readonly GUIContent microphoneUsageDescription = L10n.TextContent("Microphone Usage Description*", "String shown to the user when requesting to use the device microphone. Written to the NSMicrophoneUsageDescription field in Xcode project's info.plist file", null, null); + public static readonly GUIContent muteOtherAudioSources = L10n.TextContent("Mute Other Audio Sources*", null, null, null); + public static readonly GUIContent prepareIOSForRecording = L10n.TextContent("Prepare iOS for Recording", null, null, null); + public static readonly GUIContent forceIOSSpeakersWhenRecording = L10n.TextContent("Force iOS Speakers when Recording", null, null, null); + public static readonly GUIContent adjustIOSFPSUsingThermalState = L10n.TextContent("Adjust iOS FPS based on thermal state", "When the device overheats, iOS enters Serious and then Critical thermal states. In Critical state, iOS reduces system-wide performance to lower device temperature. If this setting is enabled Unity proactively lowers the frame rate in Serious and Critical thermal states, helping prevent the device from becoming too hot, improving responsiveness under overheating conditions, and reducing the likelihood of GPU timeouts or rendering freezes.", null, null); + public static readonly GUIContent thermalStateSeriousIOSFPS = L10n.TextContent("Serious Thermal State FPS", "When the device enters Serious Thermal State Unity will lower the frame rate to this value.", null, null); + public static readonly GUIContent thermalStateCriticalIOSFPS = L10n.TextContent("Critical Thermal State FPS", "When the device enters Critical Thermal State Unity will lower the frame rate to this value.", null, null); + public static readonly GUIContent UIRequiresPersistentWiFi = L10n.TextContent("Requires Persistent WiFi*", null, null, null); + public static readonly GUIContent insecureHttpOption = L10n.TextContent("Allow downloads over HTTP*", "", null, null); + public static readonly GUIContent autoGraphicsAPI = L10n.TextContent("Auto Graphics API", null, null, null); + public static readonly GUIContent autoGraphicsAPIForWindows = L10n.TextContent("Auto Graphics API for Windows", null, null, null); + public static readonly GUIContent autoGraphicsAPIForMac = L10n.TextContent("Auto Graphics API for Mac", null, null, null); + public static readonly GUIContent autoGraphicsAPIForLinux = L10n.TextContent("Auto Graphics API for Linux", null, null, null); + + public static readonly GUIContent iOSURLSchemes = L10n.TextContent("Supported URL schemes*", null, null, null); + public static readonly GUIContent useGLES30Shaders = L10n.TextContent("Use OpenGL ES 3.0 shaders", null, null, null); + public static readonly GUIContent requireAEP = L10n.TextContent("Require ES3.1+AEP", null, null, null); + public static readonly GUIContent require32 = L10n.TextContent("Require ES3.2", null, null, null); + public static readonly GUIContent skinOnGPU = L10n.TextContent("GPU Skinning*", "Calculate mesh skinning and blend shapes on the GPU via shaders", null, null); + public static readonly GUIContent scriptingDefineSymbols = L10n.TextContent("Scripting Define Symbols", "Preprocessor defines passed to the C# script compiler.", null, null); + public static readonly GUIContent additionalCompilerArguments = L10n.TextContent("Additional Compiler Arguments", "Additional arguments passed to the C# script compiler.", null, null); + public static readonly GUIContent scriptingDefineSymbolsCopyDefines = L10n.TextContent("Copy Defines", "Copy applied defines", null, null); + public static readonly GUIContent suppressCommonWarnings = L10n.TextContent("Suppress Common Warnings", "Suppresses C# warnings CS0169, CS0649, and CS0282.", null, null); + public static readonly GUIContent scriptingBackend = L10n.TextContent("Scripting Backend", null, null, null); + public static readonly GUIContent managedStrippingLevel = L10n.TextContent("Managed Stripping Level", "If scripting backend is IL2CPP, managed stripping can't be disabled.", null, null); + public static readonly GUIContent managedCodeVariant = L10n.TextContent("Managed Code Variant", "Defines how C# code in the project is compiled when exporting a build. Each variant level is inclusive of the next level: for instance, the Debug variant has Unity checks enabled, whereas the Checked variant has Instrumented code paths enabled.", null, null); + public static readonly GUIContent il2cppCompilerConfiguration = L10n.TextContent("C++ Compiler Configuration", "The C++ compiler configuration used when compiling IL2CPP generated code.", null, null); + public static readonly GUIContent il2cppCodeGeneration = L10n.TextContent("IL2CPP Code Generation", "Determines whether IL2CPP should generate code optimized for runtime performance or build size/iteration.", null, null); + public static readonly GUIContent[] il2cppCodeGenerationNames = new GUIContent[] { L10n.TextContent("Optimize for runtime speed", null, null, null), L10n.TextContent("Optimize for code size and build time", null, null, null) }; + public static readonly GUIContent il2cppStacktraceInformation = L10n.TextContent("IL2CPP Stacktrace Information", "Which information to include in stack traces. Including the file name and line number may increase build size.", null, null); + public static readonly GUIContent il2CppLTOMode = L10n.TextContent("IL2CPP LTO Mode", "Link Time Optimization mode. Full LTO produces smaller and faster code but takes longer to link. Thin LTO is faster to link with nearly equivalent optimization.", null, null); + public static readonly GUIContent il2CppLTOModeDisabled = L10n.TextContent("IL2CPP LTO Mode", "LTO is only applied in Master builds. Switch the C++ Compiler Configuration to Master to enable LTO.", null, null); public static readonly GUIContent[] il2CppLTOModeOptions = SettingsContentNonSearchable.il2CppLTOModeOptions; public static readonly GUIContent[] il2CppLTOModeNoneOption = SettingsContentNonSearchable.il2CppLTOModeNoneOption; - public static readonly GUIContent scriptingMono2x = EditorGUIUtility.TrTextContent("Mono"); - public static readonly GUIContent scriptingIL2CPP = EditorGUIUtility.TrTextContent("IL2CPP"); - public static readonly GUIContent scriptingCoreCLR = EditorGUIUtility.TrTextContent("CoreCLR (Experimental)"); - public static readonly GUIContent apiCompatibilityLevel = EditorGUIUtility.TrTextContent("Api Compatibility Level*"); - public static readonly GUIContent apiCompatibilityLevel_NET_4_6 = EditorGUIUtility.TrTextContent(".NET 4.x"); - public static readonly GUIContent apiCompatibilityLevel_NET_Standard_2_0 = EditorGUIUtility.TrTextContent(".NET Standard 2.0"); - public static readonly GUIContent apiCompatibilityLevel_NET_FW_Unity = EditorGUIUtility.TrTextContent(".NET Framework"); - public static readonly GUIContent apiCompatibilityLevel_NET_Standard = EditorGUIUtility.TrTextContent(".NET Standard 2.1"); - public static readonly GUIContent apiCompatibilityLevel_NET_10 = EditorGUIUtility.TrTextContent(".NET Standard 2.1 - .NET Preview (Experimental)"); - public static readonly GUIContent editorAssembliesCompatibilityLevel = EditorGUIUtility.TrTextContent("Editor Assemblies Compatibility Level*"); - public static readonly GUIContent editorAssembliesCompatibilityLevel_Default = EditorGUIUtility.TrTextContent("Default (.NET Framework)"); - public static readonly GUIContent editorAssembliesCompatibilityLevel_NET_Framework = EditorGUIUtility.TrTextContent(".NET Framework"); - public static readonly GUIContent editorAssembliesCompatibilityLevel_NET_Standard = EditorGUIUtility.TrTextContent(".NET Standard"); - public static readonly GUIContent scriptCompilationTitle = EditorGUIUtility.TrTextContent("Script Compilation"); - public static readonly GUIContent useDeterministicCompilation = EditorGUIUtility.TrTextContent("Use Deterministic Compilation", "Compile with -deterministic compilation flag"); - public static readonly GUIContent activeInputHandling = EditorGUIUtility.TrTextContent("Active Input Handling*"); - public static readonly GUIContent[] activeInputHandlingOptions = new GUIContent[] { EditorGUIUtility.TrTextContent("Input Manager (Old)"), EditorGUIUtility.TrTextContent("Input System Package (New)"), SettingsContentNonSearchable.activeInputHandlingBoth }; - public static readonly GUIContent normalMapEncodingLabel = EditorGUIUtility.TrTextContent("Normal Map Encoding"); - public static readonly GUIContent[] normalMapEncodingNames = { SettingsContentNonSearchable.normalMapEncodingXYZ, EditorGUIUtility.TrTextContent("DXT5nm-style") }; - public static readonly GUIContent lightmapEncodingLabel = EditorGUIUtility.TrTextContent("Lightmap Encoding", "Affects the encoding scheme and compression format of the lightmaps."); + public static readonly GUIContent scriptingMono2x = L10n.TextContent("Mono", null, null, null); + public static readonly GUIContent scriptingIL2CPP = L10n.TextContent("IL2CPP", null, null, null); + public static readonly GUIContent scriptingCoreCLR = L10n.TextContent("CoreCLR (Experimental)", null, null, null); + public static readonly GUIContent apiCompatibilityLevel = L10n.TextContent("Api Compatibility Level*", null, null, null); + public static readonly GUIContent apiCompatibilityLevel_NET_4_6 = L10n.TextContent(".NET 4.x", null, null, null); + public static readonly GUIContent apiCompatibilityLevel_NET_Standard_2_0 = L10n.TextContent(".NET Standard 2.0", null, null, null); + public static readonly GUIContent apiCompatibilityLevel_NET_FW_Unity = L10n.TextContent(".NET Framework", null, null, null); + public static readonly GUIContent apiCompatibilityLevel_NET_Standard = L10n.TextContent(".NET Standard 2.1", null, null, null); + public static readonly GUIContent apiCompatibilityLevel_NET_10 = L10n.TextContent(".NET Standard 2.1 - .NET Preview (Experimental)", null, null, null); + public static readonly GUIContent editorAssembliesCompatibilityLevel = L10n.TextContent("Editor Assemblies Compatibility Level*", null, null, null); + public static readonly GUIContent editorAssembliesCompatibilityLevel_Default = L10n.TextContent("Default (.NET Framework)", null, null, null); + public static readonly GUIContent editorAssembliesCompatibilityLevel_NET_Framework = L10n.TextContent(".NET Framework", null, null, null); + public static readonly GUIContent editorAssembliesCompatibilityLevel_NET_Standard = L10n.TextContent(".NET Standard", null, null, null); + public static readonly GUIContent scriptCompilationTitle = L10n.TextContent("Script Compilation", null, null, null); + public static readonly GUIContent useDeterministicCompilation = L10n.TextContent("Use Deterministic Compilation", "Compile with -deterministic compilation flag", null, null); + public static readonly GUIContent activeInputHandling = L10n.TextContent("Active Input Handling*", null, null, null); + public static readonly GUIContent[] activeInputHandlingOptions = new GUIContent[] { L10n.TextContent("Input Manager (Old)", null, null, null), L10n.TextContent("Input System Package (New)", null, null, null), SettingsContentNonSearchable.activeInputHandlingBoth }; + public static readonly GUIContent normalMapEncodingLabel = L10n.TextContent("Normal Map Encoding", null, null, null); + public static readonly GUIContent[] normalMapEncodingNames = { SettingsContentNonSearchable.normalMapEncodingXYZ, L10n.TextContent("DXT5nm-style", null, null, null) }; + public static readonly GUIContent lightmapEncodingLabel = L10n.TextContent("Lightmap Encoding", "Affects the encoding scheme and compression format of the lightmaps.", null, null); public static readonly GUIContent[] lightmapEncodingNames = SettingsContentNonSearchable.lightmapEncodingNames; - public static readonly GUIContent hdrCubemapEncodingLabel = EditorGUIUtility.TrTextContent("HDR Cubemap Encoding", "Determines which encoding scheme Unity uses to encode HDR cubemaps."); + public static readonly GUIContent hdrCubemapEncodingLabel = L10n.TextContent("HDR Cubemap Encoding", "Determines which encoding scheme Unity uses to encode HDR cubemaps.", null, null); public static readonly GUIContent[] hdrCubemapEncodingNames = SettingsContentNonSearchable.hdrCubemapEncodingNames; - public static readonly GUIContent lightmapStreamingEnabled = EditorGUIUtility.TrTextContent("Lightmap Streaming", "Only load larger lightmap mipmap levels as needed to render the current game cameras. Requires texture mipmap streaming to be enabled in quality settings. This value is applied to the light map textures as they are generated."); - public static readonly GUIContent lightmapStreamingPriority = EditorGUIUtility.TrTextContent("Streaming Priority", "Lightmap mipmap streaming priority when there's contention for resources. Positive numbers represent higher priority. Valid range is -128 to 127. This value is applied to the light map textures as they are generated."); - public static readonly GUIContent legacyClampBlendShapeWeights = EditorGUIUtility.TrTextContent("Clamp BlendShapes (Deprecated)*", "If set, the range of BlendShape weights in SkinnedMeshRenderers will be clamped."); - public static readonly GUIContent virtualTexturingSupportEnabled = EditorGUIUtility.TrTextContent("Virtual Texturing (Experimental)*", "Enable Virtual Texturing. This feature is experimental and not ready for production use. Changing this value requires an Editor restart."); - public static readonly GUIContent shaderPrecisionModel = EditorGUIUtility.TrTextContent("Shader Precision Model*", "Controls the default sampler precision and the definition of HLSL half."); + public static readonly GUIContent lightmapStreamingEnabled = L10n.TextContent("Lightmap Streaming", "Only load larger lightmap mipmap levels as needed to render the current game cameras. Requires texture mipmap streaming to be enabled in quality settings. This value is applied to the light map textures as they are generated.", null, null); + public static readonly GUIContent lightmapStreamingPriority = L10n.TextContent("Streaming Priority", "Lightmap mipmap streaming priority when there's contention for resources. Positive numbers represent higher priority. Valid range is -128 to 127. This value is applied to the light map textures as they are generated.", null, null); + public static readonly GUIContent legacyClampBlendShapeWeights = L10n.TextContent("Clamp BlendShapes (Deprecated)*", "If set, the range of BlendShape weights in SkinnedMeshRenderers will be clamped.", null, null); + public static readonly GUIContent virtualTexturingSupportEnabled = L10n.TextContent("Virtual Texturing (Experimental)*", "Enable Virtual Texturing. This feature is experimental and not ready for production use. Changing this value requires an Editor restart.", null, null); + public static readonly GUIContent shaderPrecisionModel = L10n.TextContent("Shader Precision Model*", "Controls the default sampler precision and the definition of HLSL half.", null, null); public static readonly GUIContent[] shaderPrecisionModelOptions = SettingsContentNonSearchable.shaderPrecisionModelOptions; - public static readonly GUIContent stereo360CaptureCheckbox = EditorGUIUtility.TrTextContent("360 Stereo Capture*"); - public static readonly GUIContent forceSRGBBlit = EditorGUIUtility.TrTextContent("Force SRGB blit", "Force SRGB blit for Linear color space."); - public static readonly GUIContent loadStoreDebugModeCheckbox = EditorGUIUtility.TrTextContent("Load/Store Action Debug Mode", "Initializes Framebuffer such that errors in the load/store actions will be visually apparent. (Removed in Release Builds)"); - public static readonly GUIContent allowHDRDisplay = EditorGUIUtility.TrTextContent("Allow HDR Display Output*", "Enable the use of HDR displays and include all the resources required for them to function correctly."); - public static readonly GUIContent useHDRDisplay = EditorGUIUtility.TrTextContent("Use HDR Display Output*", "Checks if the main display supports HDR and if it does, switches to HDR output at the start of the application."); - public static readonly GUIContent captureStartupLogs = EditorGUIUtility.TrTextContent("Capture Startup Logs", "Capture startup logs for later processing."); + public static readonly GUIContent stereo360CaptureCheckbox = L10n.TextContent("360 Stereo Capture*", null, null, null); + public static readonly GUIContent forceSRGBBlit = L10n.TextContent("Force SRGB blit", "Force SRGB blit for Linear color space.", null, null); + public static readonly GUIContent loadStoreDebugModeCheckbox = L10n.TextContent("Load/Store Action Debug Mode", "Initializes Framebuffer such that errors in the load/store actions will be visually apparent. (Removed in Release Builds)", null, null); + public static readonly GUIContent allowHDRDisplay = L10n.TextContent("Allow HDR Display Output*", "Enable the use of HDR displays and include all the resources required for them to function correctly.", null, null); + public static readonly GUIContent useHDRDisplay = L10n.TextContent("Use HDR Display Output*", "Checks if the main display supports HDR and if it does, switches to HDR output at the start of the application.", null, null); + public static readonly GUIContent captureStartupLogs = L10n.TextContent("Capture Startup Logs", "Capture startup logs for later processing.", null, null); public static readonly string undoChangedBatchingString = L10n.Tr("Changed Batching Settings", null); public static readonly string undoChangedGraphicsAPIString = L10n.Tr("Changed Graphics API Settings", null); public static readonly string undoChangedScriptingDefineString = L10n.Tr("Changed Scripting Define Settings", null); @@ -466,6 +467,8 @@ internal static void SyncEditors(BuildTarget target) SerializedProperty m_EnableLoadStoreDebugMode; + // DO NOT REMOVE: required by useGLES30Shaders during GLES30 deprecation + SerializedProperty m_RequireES31; // OpenGL ES 3.1+ - m_RequireES31 removed. Android minspec raised to 3.1 (GDRIV-4724) SerializedProperty m_RequireES31AEP; SerializedProperty m_RequireES32; @@ -594,6 +597,9 @@ internal void OnSyncEditor(BuildTarget target) internal interface IPlayerSettingsAccessor { + GraphicsDeviceType[] GetGraphicsAPIsWithUGKVariants_Internal(BuildTarget platform); + int[] GetGraphicsAPIUGKFlags_Internal(BuildTarget platform); + void SetGraphicsAPIs_Internal(BuildTarget platform, GraphicsDeviceType[] apis, int[] ugkFlags, bool shouldSync); GraphicsDeviceType[] GetGraphicsAPIs_Internal(BuildTarget platform); void SetGraphicsAPIs_Internal(BuildTarget platform, GraphicsDeviceType[] apis, bool shouldSync); bool GetUseDefaultGraphicsAPIs_Internal(BuildTarget platform); @@ -665,6 +671,19 @@ public PlayerSettingsAccessor(PlayerSettings playerSettings) m_PlayerSettings = playerSettings; } + public GraphicsDeviceType[] GetGraphicsAPIsWithUGKVariants_Internal(BuildTarget platform) + { + return m_PlayerSettings.GetGraphicsAPIsWithUGKVariants_Internal(platform); + } + public int[] GetGraphicsAPIUGKFlags_Internal(BuildTarget platform) + { + return m_PlayerSettings.GetGraphicsAPIUGKFlags_Internal(platform); + } + public void SetGraphicsAPIs_Internal(BuildTarget platform, GraphicsDeviceType[] apis, int[] ugkFlags, bool shouldSync) + { + m_PlayerSettings.SetGraphicsAPIs_Internal(platform, apis, ugkFlags, shouldSync); + } + public GraphicsDeviceType[] GetGraphicsAPIs_Internal(BuildTarget platform) { return m_PlayerSettings.GetGraphicsAPIs_Internal(platform); @@ -1056,6 +1075,9 @@ void OnEnable() m_EnableFrameTimingStats = FindPropertyAssert("enableFrameTimingStats"); m_EnableOpenGLProfilerGPURecorders = FindPropertyAssert("enableOpenGLProfilerGPURecorders"); + // DO NOT REMOVE: required by useGLES30Shaders during GLES30 deprecation + m_RequireES31 = FindPropertyAssert("openGLRequireES31"); + m_RequireES31AEP = FindPropertyAssert("openGLRequireES31AEP"); m_RequireES32 = FindPropertyAssert("openGLRequireES32"); @@ -1557,7 +1579,7 @@ private void CommonSettings() { EditorGUILayout.PropertyField(m_CompanyName); EditorGUILayout.PropertyField(m_ProductName); - EditorGUILayout.PropertyField(m_ApplicationBundleVersion, EditorGUIUtility.TrTextContent("Version")); + EditorGUILayout.PropertyField(m_ApplicationBundleVersion, L10n.TextContent("Version", null, null, null)); EditorGUILayout.Space(); m_IconsEditor.LegacyIconSectionGUI(); @@ -1815,6 +1837,60 @@ static private bool IsGraphicsDeviceTypeExperimental(BuildTarget target, Graphic return false; } + // Combined device type and UGK flag for representing UGK / non-UGK variants of the same API + private struct GraphicsAPIEntry + { + public GraphicsDeviceType api; + public bool ugkEnabled; + + public GraphicsAPIEntry(GraphicsDeviceType api, bool ugkEnabled) { this.api = api; this.ugkEnabled = ugkEnabled; } + } + + private List BuildGraphicsAPIEntryList(BuildTarget target) + { + var apis = m_CurrentTarget.GetGraphicsAPIsWithUGKVariants_Internal(target); + var ugkFlags = m_CurrentTarget.GetGraphicsAPIUGKFlags_Internal(target); + var list = new List(); + if (apis != null) + { + for (int i = 0; i < apis.Length; ++i) + list.Add(new GraphicsAPIEntry(apis[i], ugkFlags != null && i < ugkFlags.Length && ugkFlags[i] != 0)); + } + return list; + } + + private void SetGraphicsAPIEntries(BuildTarget target, List entries, bool shouldSync) + { + var apis = new GraphicsDeviceType[entries.Count]; + var ugkFlags = new int[entries.Count]; + for (int i = 0; i < entries.Count; ++i) + { + apis[i] = entries[i].api; + ugkFlags[i] = entries[i].ugkEnabled ? 1 : 0; + } + m_CurrentTarget.SetGraphicsAPIs_Internal(target, apis, ugkFlags, shouldSync); + } + + private static bool GraphicsAPIListContainsAPI(ReorderableList list, GraphicsDeviceType api) + { + return list.list is List entries && entries.Exists(e => e.api == api); + } + + // UGK variants are represented by a "(Graphics Kernel)" suffix in the string. + // We also advertise UGK as experimental. Note that this is different than an experimental graphics API. + static private string GraphicsAPIEntryToString(BuildTarget target, GraphicsAPIEntry entry) + { + var name = GraphicsDeviceTypeToString(target, entry.api); + return entry.ugkEnabled ? name + " (Graphics Kernel) (Experimental)" : name; + } + + // userData for the add API dropdown. + private sealed class AddGraphicsAPIMenuData + { + public BuildTarget target; + public GraphicsAPIEntry[] candidates; // There can be multiple candidates that differ based on UGK flag. + } + // Converts a GraphicsDeviceType to a string, along with visual modifiers for given target platform static private string GraphicsDeviceTypeToString(BuildTarget target, GraphicsDeviceType graphicsDeviceType) { @@ -1833,26 +1909,12 @@ static private string GraphicsDeviceTypeToString(BuildTarget target, GraphicsDev return graphicsDeviceType.ToString(); } - // Parses a GraphicsDeviceType from a string. - static private GraphicsDeviceType GraphicsDeviceTypeFromString(string graphicsDeviceType) - { - graphicsDeviceType = graphicsDeviceType.Replace(" (Deprecated)", ""); - graphicsDeviceType = graphicsDeviceType.Replace(" (Experimental)", ""); - if (graphicsDeviceType == "WebGL 2") return GraphicsDeviceType.OpenGLES3; - return (GraphicsDeviceType)Enum.Parse(typeof(GraphicsDeviceType), graphicsDeviceType, true); - } - private void AddGraphicsDeviceMenuSelected(object userData, string[] options, int selected) { - var target = (BuildTarget)userData; - var apis = m_CurrentTarget.GetGraphicsAPIs_Internal(target); - if (apis == null) - return; - var apiToAdd = GraphicsDeviceTypeFromString(options[selected]); -#pragma warning disable UAC2001 // Avoid Linq - apis = apis.Append(apiToAdd).ToArray(); -#pragma warning restore UAC2001 - m_CurrentTarget.SetGraphicsAPIs_Internal(target, apis, true); + var data = (AddGraphicsAPIMenuData)userData; + var entries = BuildGraphicsAPIEntryList(data.target); + entries.Add(data.candidates[selected]); + SetGraphicsAPIEntries(data.target, entries, true); OnTargetObjectChangedDirectly(); } @@ -1873,15 +1935,31 @@ private void AddGraphicsDeviceElement(BuildTarget target, Rect rect, Reorderable availableDevices = availableDeviceList.ToArray(); } - var names = new string[availableDevices.Length]; - var enabled = new bool[availableDevices.Length]; - for (int i = 0; i < availableDevices.Length; ++i) + var currentEntries = list.list as List; + + // Query the list of UGK capable graphics APIs and add an element for both the UGK and non-UGK API variants. + GraphicsDeviceType[] ugkCapable = PlayerSettings.GetUGKCapableGraphicsAPIs(target) ?? Array.Empty(); + var candidates = new List(); + foreach (var device in availableDevices) { - names[i] = L10n.Tr(GraphicsDeviceTypeToString(target, availableDevices[i]), null); - enabled[i] = !list.list.Contains(availableDevices[i]); + candidates.Add(new GraphicsAPIEntry(device, false)); + // Check if there is also a UGK variant and add it to the list of candidates + if (Array.IndexOf(ugkCapable, device) >= 0) + candidates.Add(new GraphicsAPIEntry(device, true)); } - EditorUtility.DisplayCustomMenu(rect, names, enabled, null, AddGraphicsDeviceMenuSelected, target); + var names = new string[candidates.Count]; + var enabled = new bool[candidates.Count]; + for (int i = 0; i < candidates.Count; ++i) + { + var candidate = candidates[i]; + names[i] = L10n.Tr(GraphicsAPIEntryToString(target, candidate), null); + // Check UGK flag when determining if the API is already enabled + enabled[i] = currentEntries == null || !currentEntries.Exists(e => e.api == candidate.api && e.ugkEnabled == candidate.ugkEnabled); + } + + var data = new AddGraphicsAPIMenuData { target = target, candidates = candidates.ToArray() }; + EditorUtility.DisplayCustomMenu(rect, names, enabled, null, AddGraphicsDeviceMenuSelected, data); } private bool CanRemoveGraphicsDeviceElement(ReorderableList list) @@ -1909,40 +1987,39 @@ private bool CheckRemoveFallbackGraphicsDeviceElement(GraphicsDeviceType removed private void RemoveGraphicsDeviceElement(BuildTarget target, ReorderableList list) { - var apis = m_CurrentTarget.GetGraphicsAPIs_Internal(target); - if (apis == null) + // Edit displayed entries in-place to preserve the UGK flag. + var entries = list.list as List; + if (entries == null) return; // don't allow removing the last API - if (apis.Length < 2) + if (entries.Count < 2) { EditorApplication.Beep(); return; } -#pragma warning disable UAC2001 // Avoid Linq - var apiList = apis.ToList(); -#pragma warning restore UAC2001 - var removedElement = apiList[list.index]; - if (CheckRemoveFallbackGraphicsDeviceElement(removedElement, target, list)) + var removedElement = entries[list.index]; + if (CheckRemoveFallbackGraphicsDeviceElement(removedElement.api, target, list)) { - apiList.RemoveAt(list.index); - apis = apiList.ToArray(); + var newEntries = new List(entries); + newEntries.RemoveAt(list.index); - ApplyChangedGraphicsAPIList(target, apis, list.index == 0); + bool firstAPIDifferent = newEntries.Count > 0 && newEntries[0].api != entries[0].api; + ApplyChangedGraphicsAPIList(target, newEntries, firstAPIDifferent); } } private void ReorderGraphicsDeviceElement(BuildTarget target, ReorderableList list) { - var previousAPIs = m_CurrentTarget.GetGraphicsAPIs_Internal(target); - var apiList = (List)list.list; - var apis = apiList.ToArray(); + var previousEntries = BuildGraphicsAPIEntryList(target); + var entries = new List((List)list.list); var currentDevice = SystemInfo.graphicsDeviceType; - var firstAPIDifferent = (previousAPIs[0] != apis[0]); - var requiresRestart = apis[0] != currentDevice; + // Check if the API has changed in case we need to prompt a restart. Note we don't consider UGK flags here. + var firstAPIDifferent = (previousEntries.Count == 0 || previousEntries[0].api != entries[0].api); + var requiresRestart = entries[0].api != currentDevice; - ApplyChangedGraphicsAPIList(target, apis, firstAPIDifferent && requiresRestart); + ApplyChangedGraphicsAPIList(target, entries, firstAPIDifferent && requiresRestart); } // these two methods are needed for cases when you want to take some action depending on user choice @@ -2026,12 +2103,12 @@ private ChangeGraphicsApiAction CheckApplyGraphicsAPIList(BuildTarget target, bo } } - private void ApplyChangeGraphicsApiAction(BuildTarget target, GraphicsDeviceType[] apis, ChangeGraphicsApiAction action, bool skipRemoveCached) + private void ApplyChangeGraphicsApiAction(BuildTarget target, List entries, ChangeGraphicsApiAction action, bool skipRemoveCached) { isAutoGraphicsAPITouched = true; if (action.changeList) { - m_CurrentTarget.SetGraphicsAPIs_Internal(target, apis, true); + SetGraphicsAPIEntries(target, entries, true); OnTargetObjectChangedDirectly(); } else if (!skipRemoveCached) @@ -2046,17 +2123,17 @@ private void ApplyChangeGraphicsApiAction(BuildTarget target, GraphicsDeviceType } } - private void ApplyChangedGraphicsAPIList(BuildTarget target, GraphicsDeviceType[] apis, bool firstEntryChanged) + private void ApplyChangedGraphicsAPIList(BuildTarget target, List entries, bool firstEntryChanged) { ChangeGraphicsApiAction action = CheckApplyGraphicsAPIList(target, firstEntryChanged, true); - ApplyChangeGraphicsApiAction(target, apis, action, false); + ApplyChangeGraphicsApiAction(target, entries, action, false); } private void DrawGraphicsDeviceElement(BuildTarget target, Rect rect, int index, bool selected, bool focused) { - var name = GraphicsDeviceTypeToString(target, (GraphicsDeviceType)m_GraphicsDeviceLists[target].list[index]); + var entry = (GraphicsAPIEntry)m_GraphicsDeviceLists[target].list[index]; - GUI.Label(rect, name, EditorStyles.label); + GUI.Label(rect, GraphicsAPIEntryToString(target, entry), EditorStyles.label); } private static bool WillEditorUseFirstGraphicsAPI(BuildTarget targetPlatform) @@ -2136,6 +2213,14 @@ void OpenGLES31OptionsGUI(BuildTargetGroup targetGroup, BuildTarget targetPlatfo if (!hasMinES3) return; + var rect = EditorGUILayout.GetControlRect(); + var label = EditorGUI.BeginProperty(rect, SettingsContent.useGLES30Shaders, m_RequireES31); + EditorGUI.BeginChangeCheck(); + bool useES30 = EditorGUI.Toggle(rect, label, !m_RequireES31.boolValue); + if (EditorGUI.EndChangeCheck()) + m_RequireES31.boolValue = !useES30; + EditorGUI.EndProperty(); + EditorGUILayout.PropertyField(m_RequireES31AEP, SettingsContent.requireAEP); EditorGUILayout.PropertyField(m_RequireES32, SettingsContent.require32); } @@ -2149,10 +2234,10 @@ void ExclusiveGraphicsAPIsGUI(BuildTarget targetPlatform, string displayTitle) GUIContent[] names = new GUIContent[availableDevices.Length]; for (int i = 0; i < availableDevices.Length; ++i) { - names[i] = EditorGUIUtility.TrTextContent(L10n.Tr(GraphicsDeviceTypeToString(targetPlatform, availableDevices[i]), null)); + names[i] = L10n.TextContent(GraphicsDeviceTypeToString(targetPlatform, availableDevices[i]), null, null, null); } - GraphicsDeviceType selected = BuildEnumPopup(EditorGUIUtility.TrTextContent(displayTitle), currentDevices[0], availableDevices, names); + GraphicsDeviceType selected = BuildEnumPopup(L10n.TextContent(displayTitle, null, null, null), currentDevices[0], availableDevices, names); if (EditorGUI.EndChangeCheck() && selected != currentDevices[0]) { Undo.RecordObject(target, SettingsContent.undoChangedGraphicsAPIString); @@ -2203,14 +2288,11 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target return; } - GraphicsDeviceType[] devices = m_CurrentTarget.GetGraphicsAPIs_Internal(targetPlatform); -#pragma warning disable UAC2001 // Avoid Linq - var devicesList = (devices != null) ? devices.ToList() : new List(); -#pragma warning restore UAC2001 + var devicesList = BuildGraphicsAPIEntryList(targetPlatform); // create reorderable list for this target if needed if (!m_GraphicsDeviceLists.ContainsKey(targetPlatform)) { - var rlist = new ReorderableList(devicesList, typeof(GraphicsDeviceType), true, true, true, true); + var rlist = new ReorderableList(devicesList, typeof(GraphicsAPIEntry), true, true, true, true); rlist.onAddDropdownCallback = (rect, list) => AddGraphicsDeviceElement(targetPlatform, rect, list); rlist.onCanRemoveCallback = CanRemoveGraphicsDeviceElement; rlist.onRemoveCallback = (list) => RemoveGraphicsDeviceElement(targetPlatform, list); @@ -2223,7 +2305,7 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target } var deviceList = m_GraphicsDeviceLists[targetPlatform]; - GraphicsDeviceType? selectedDevice = deviceList.count > 0 ? (GraphicsDeviceType)deviceList.list[0] : null; + GraphicsDeviceType? selectedDevice = deviceList.count > 0 ? ((GraphicsAPIEntry)deviceList.list[0]).api : (GraphicsDeviceType?)null; var currentDevice = SystemInfo.graphicsDeviceType; bool firstAPIDifferent = currentDevice != selectedDevice; @@ -2305,9 +2387,7 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target SetUseDefaultGraphicsAPIsWithTelemetry(targetPlatform, toggledAutomatic); // we need to update the APIs list when we toggle automatic graphics API - var apiList = (List)deviceList.list; - var apis = apiList.ToArray(); - m_CurrentTarget.SetGraphicsAPIs_Internal(targetPlatform, apis, firstAPIDifferent); + SetGraphicsAPIEntries(targetPlatform, (List)deviceList.list, firstAPIDifferent); OnTargetObjectChangedDirectly(); @@ -2354,7 +2434,7 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target EditorGUILayout.HelpBox(SettingsContentNonSearchable.playerOnlyGraphicsAPIInfo.text, MessageType.Info, true); } - if (targetPlatform == BuildTarget.StandaloneOSX && m_GraphicsDeviceLists[BuildTarget.StandaloneOSX].list.Contains(GraphicsDeviceType.OpenGLCore)) + if (targetPlatform == BuildTarget.StandaloneOSX && GraphicsAPIListContainsAPI(m_GraphicsDeviceLists[BuildTarget.StandaloneOSX], GraphicsDeviceType.OpenGLCore)) { EditorGUILayout.HelpBox(SettingsContentNonSearchable.appleSiliconOpenGLWarning.text, MessageType.Warning, true); } @@ -2366,7 +2446,7 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target { // When EG/GRD unification is done, EG will no longer support GLES bool isEntitiesGraphicsPackageInstalled = UnityEditor.PackageManager.PackageInfo.IsPackageRegistered("com.unity.entities.graphics"); - bool deviceListContainsGLES = deviceList.list.Contains(GraphicsDeviceType.OpenGLES3); + bool deviceListContainsGLES = GraphicsAPIListContainsAPI(deviceList, GraphicsDeviceType.OpenGLES3); if (isEntitiesGraphicsPackageInstalled && deviceListContainsGLES) { EditorGUILayout.HelpBox(SettingsContentNonSearchable.glesWithEntitiesGraphicsDeprecationMessage.text, @@ -2374,7 +2454,7 @@ void GraphicsAPIsGUIOnePlatform(BuildTargetGroup targetGroup, BuildTarget target } } - bool containsDeprecatedAPIs = devicesList.Exists(device => IsGraphicsDeviceTypeDeprecated(targetPlatform, device)); + bool containsDeprecatedAPIs = devicesList.Exists(entry => IsGraphicsDeviceTypeDeprecated(targetPlatform, entry.api)); if (containsDeprecatedAPIs) EditorGUILayout.HelpBox(SettingsContentNonSearchable.graphicsAPIDeprecationMessage.text, MessageType.Warning, true); @@ -3293,8 +3373,8 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, ISettingEditorExte EditorGUI.BeginChangeCheck(); HDRDisplayBitDepth oldBitDepth = (HDRDisplayBitDepth)m_HDRBitDepth.intValue; HDRDisplayBitDepth[] bitDepthValues = { HDRDisplayBitDepth.BitDepth10, HDRDisplayBitDepth.BitDepth16 }; - GUIContent hdrBitDepthLabel = EditorGUIUtility.TrTextContent("Swap Chain Bit Depth", "Affects the bit depth of the final swap chain format and color space."); - GUIContent[] hdrBitDepthNames = { EditorGUIUtility.TrTextContent("Bit Depth 10"), EditorGUIUtility.TrTextContent("Bit Depth 16") }; + GUIContent hdrBitDepthLabel = L10n.TextContent("Swap Chain Bit Depth", "Affects the bit depth of the final swap chain format and color space.", null, null); + GUIContent[] hdrBitDepthNames = { L10n.TextContent("Bit Depth 10", null, null, null), L10n.TextContent("Bit Depth 16", null, null, null) }; HDRDisplayBitDepth bitDepth = BuildEnumPopup(hdrBitDepthLabel, oldBitDepth, bitDepthValues, hdrBitDepthNames); if (EditorGUI.EndChangeCheck()) @@ -3440,7 +3520,7 @@ void ShowWarningIfVirtualTexturingUnsupportedByAPI(IBuildTarget buildTarget, boo if (virtualTexturingUnsupportedAPIContents.TryGetValue(buildTarget, out var guiContent)) warningText = guiContent; else - warningText = virtualTexturingUnsupportedAPIContents[buildTarget] = EditorGUIUtility.TrTextContent($"The target {buildTarget.DisplayName} graphics API does not support Virtual Texturing. To target compatible graphics APIs, uncheck 'Auto Graphics API', and remove OpenGL ES 2/3 and OpenGLCoreOpenGLCore."); + warningText = virtualTexturingUnsupportedAPIContents[buildTarget] = L10n.TextContent($"The target {buildTarget.DisplayName} graphics API does not support Virtual Texturing. To target compatible graphics APIs, uncheck 'Auto Graphics API', and remove OpenGL ES 2/3 and OpenGLCoreOpenGLCore.", null, null, null); if (warningText != null) EditorGUILayout.HelpBox(warningText.text, MessageType.Warning); @@ -3738,10 +3818,10 @@ private ManagedStrippingLevel GetCurrentManagedStrippingLevelForTarget(NamedBuil static readonly ManagedCodeVariant[] k_ManagedCodeVariants = { ManagedCodeVariant.Debug, ManagedCodeVariant.Checked, ManagedCodeVariant.Instrumented, ManagedCodeVariant.Release }; static readonly GUIContent[] k_ManagedCodeVariantNames = { - EditorGUIUtility.TrTextContent("Debug", "Compiles C# code without optimizations. Defines DEBUG and all the same defines as the Checked variant. Used for debugging the code with a debugger."), - EditorGUIUtility.TrTextContent("Checked", "Compiles C# code with optimizations. Defines UNITY_ENABLE_CHECKS, UNITY_ASSERTIONS and all the same defines as the Instrumented variant. Used for running the game with extra checks enabled."), - EditorGUIUtility.TrTextContent("Instrumented", "Compiles C# code with optimizations. Defines UNITY_INCLUDE_INSTRUMENTATION and ENABLE_PROFILER. Used for profiling."), - EditorGUIUtility.TrTextContent("Release", "Compiles C# code with optimizations. Used for running with all unnecessary code paths disabled and for shipping releases to users."), + L10n.TextContent("Debug", "Compiles C# code without optimizations. Defines DEBUG and all the same defines as the Checked variant. Used for debugging the code with a debugger.", null, null), + L10n.TextContent("Checked", "Compiles C# code with optimizations. Defines UNITY_ENABLE_CHECKS, UNITY_ASSERTIONS and all the same defines as the Instrumented variant. Used for running the game with extra checks enabled.", null, null), + L10n.TextContent("Instrumented", "Compiles C# code with optimizations. Defines UNITY_INCLUDE_INSTRUMENTATION and ENABLE_PROFILER. Used for profiling.", null, null), + L10n.TextContent("Release", "Compiles C# code with optimizations. Used for running with all unnecessary code paths disabled and for shipping releases to users.", null, null), }; private ManagedCodeVariant GetCurrentManagedCodeVariantForTarget(NamedBuildTarget namedBuildTarget) @@ -5004,7 +5084,7 @@ private struct PlayerSettingsBox public PlayerSettingsBox(MethodInfo mi, string targetName, string title, int order) { this.mi = mi; - this.title = EditorGUIUtility.TrTextContent(title); + this.title = L10n.TextContent(title, null, null, null); this.order = order; this.TargetName = targetName; } @@ -5072,9 +5152,7 @@ void SyncPlatformAPIsList(BuildTarget target) { if (!m_GraphicsDeviceLists.ContainsKey(target)) return; -#pragma warning disable UAC2001 // Avoid Linq - m_GraphicsDeviceLists[target].list = m_CurrentTarget.GetGraphicsAPIs_Internal(target).ToList(); -#pragma warning restore UAC2001 + m_GraphicsDeviceLists[target].list = BuildGraphicsAPIEntryList(target); } } } diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs index 2ee200648f..1eb9ef2e8a 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs @@ -16,9 +16,9 @@ internal class PlayerSettingsIconsEditor { internal class SettingsContent { - public static readonly GUIContent iconTitle = EditorGUIUtility.TrTextContent("Icon"); - public static readonly GUIContent defaultIcon = EditorGUIUtility.TrTextContent("Default Icon"); - public static readonly GUIContent UIPrerenderedIcon = EditorGUIUtility.TrTextContent("Prerendered Icon"); + public static readonly GUIContent iconTitle = L10n.TextContent("Icon", null, null, null); + public static readonly GUIContent defaultIcon = L10n.TextContent("Default Icon", null, null, null); + public static readonly GUIContent UIPrerenderedIcon = L10n.TextContent("Prerendered Icon", null, null, null); public static string undoChangedIconString { get { return LocalizationDatabase.GetLocalizedString("Changed Icon"); } } } diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsSplashScreenEditor.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsSplashScreenEditor.cs index 2e14c9be08..7ef497bd02 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsSplashScreenEditor.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsSplashScreenEditor.cs @@ -82,28 +82,28 @@ static AssetDeleteResult OnWillDeleteAsset(string asset, RemoveAssetOptions opti internal class Texts { - public static readonly GUIContent animate = EditorGUIUtility.TrTextContent("Animation"); - public static readonly GUIContent backgroundColor = EditorGUIUtility.TrTextContent("Background Color", "Background color when no background image is used. On Android, use this property to set static splash image background color."); - public static readonly GUIContent backgroundImage = EditorGUIUtility.TrTextContent("Background Image", "Image to be used in landscape and portrait (when portrait image is not set)."); - public static readonly GUIContent backgroundPortraitImage = EditorGUIUtility.TrTextContent("Alternate Portrait Image*", "Optional image to be used in portrait mode."); - public static readonly GUIContent backgroundTitle = EditorGUIUtility.TrTextContent("Background*"); - public static readonly GUIContent backgroundZoom = EditorGUIUtility.TrTextContent("Background Zoom"); - public static readonly GUIContent blurBackground = EditorGUIUtility.TrTextContent("Blur Background Image"); - public static readonly GUIContent cancelPreviewSplash = EditorGUIUtility.TrTextContent("Cancel Preview"); - public static readonly GUIContent configDialogBanner = EditorGUIUtility.TrTextContent("Application Config Dialog Banner"); - public static readonly GUIContent configDialogBannerDeprecationWarning = EditorGUIUtility.TrTextContent("Application Config Dialog Banner is deprecated and will be removed in future versions."); - public static readonly GUIContent drawMode = EditorGUIUtility.TrTextContent("Draw Mode"); - public static readonly GUIContent logoDuration = EditorGUIUtility.TrTextContent("Logo Duration", "The time the logo will be shown for."); - public static readonly GUIContent logosTitle = EditorGUIUtility.TrTextContent("Logos*"); - public static readonly GUIContent logoZoom = EditorGUIUtility.TrTextContent("Logo Zoom"); - public static readonly GUIContent overlayOpacity = EditorGUIUtility.TrTextContent("Overlay Opacity", "Overlay strength applied to improve logo visibility."); - public static readonly GUIContent previewSplash = EditorGUIUtility.TrTextContent("Preview", "Preview the splash screen in the game view."); - public static readonly GUIContent showLogo = EditorGUIUtility.TrTextContent("Show Unity Logo"); - public static readonly GUIContent showSplash = EditorGUIUtility.TrTextContent("Show Splash Screen"); - public static readonly GUIContent splashStyle = EditorGUIUtility.TrTextContent("Splash Style"); - public static readonly GUIContent splashTitle = EditorGUIUtility.TrTextContent("Splash Screen"); - public static readonly GUIContent title = EditorGUIUtility.TrTextContent("Splash Image"); - public static readonly GUIContent vrSplashScreen = EditorGUIUtility.TrTextContent("Virtual Reality Splash Image"); + public static readonly GUIContent animate = L10n.TextContent("Animation", null, null, null); + public static readonly GUIContent backgroundColor = L10n.TextContent("Background Color", "Background color when no background image is used. On Android, use this property to set static splash image background color.", null, null); + public static readonly GUIContent backgroundImage = L10n.TextContent("Background Image", "Image to be used in landscape and portrait (when portrait image is not set).", null, null); + public static readonly GUIContent backgroundPortraitImage = L10n.TextContent("Alternate Portrait Image*", "Optional image to be used in portrait mode.", null, null); + public static readonly GUIContent backgroundTitle = L10n.TextContent("Background*", null, null, null); + public static readonly GUIContent backgroundZoom = L10n.TextContent("Background Zoom", null, null, null); + public static readonly GUIContent blurBackground = L10n.TextContent("Blur Background Image", null, null, null); + public static readonly GUIContent cancelPreviewSplash = L10n.TextContent("Cancel Preview", null, null, null); + public static readonly GUIContent configDialogBanner = L10n.TextContent("Application Config Dialog Banner", null, null, null); + public static readonly GUIContent configDialogBannerDeprecationWarning = L10n.TextContent("Application Config Dialog Banner is deprecated and will be removed in future versions.", null, null, null); + public static readonly GUIContent drawMode = L10n.TextContent("Draw Mode", null, null, null); + public static readonly GUIContent logoDuration = L10n.TextContent("Logo Duration", "The time the logo will be shown for.", null, null); + public static readonly GUIContent logosTitle = L10n.TextContent("Logos*", null, null, null); + public static readonly GUIContent logoZoom = L10n.TextContent("Logo Zoom", null, null, null); + public static readonly GUIContent overlayOpacity = L10n.TextContent("Overlay Opacity", "Overlay strength applied to improve logo visibility.", null, null); + public static readonly GUIContent previewSplash = L10n.TextContent("Preview", "Preview the splash screen in the game view.", null, null); + public static readonly GUIContent showLogo = L10n.TextContent("Show Unity Logo", null, null, null); + public static readonly GUIContent showSplash = L10n.TextContent("Show Splash Screen", null, null, null); + public static readonly GUIContent splashStyle = L10n.TextContent("Splash Style", null, null, null); + public static readonly GUIContent splashTitle = L10n.TextContent("Splash Screen", null, null, null); + public static readonly GUIContent title = L10n.TextContent("Splash Image", null, null, null); + public static readonly GUIContent vrSplashScreen = L10n.TextContent("Virtual Reality Splash Image", null, null, null); } public PlayerSettingsSplashScreenEditor(PlayerSettingsEditor owner) diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/WebTemplateManagerBase.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/WebTemplateManagerBase.cs index d7280a3952..dd150820d3 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/WebTemplateManagerBase.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/WebTemplateManagerBase.cs @@ -188,7 +188,7 @@ public void SelectionUI(SerializedProperty templateProp, PlayerSettingsEditor.IP { if (TemplateGUIThumbnails.Length < 1) { - GUILayout.Label(EditorGUIUtility.TrTextContent("No templates found.")); + GUILayout.Label(L10n.TextContent("No templates found.", null, null, null)); } else { diff --git a/Editor/Mono/Inspector/PositionConstraintEditor.cs b/Editor/Mono/Inspector/PositionConstraintEditor.cs index c4224c0acc..5fd53c20d5 100644 --- a/Editor/Mono/Inspector/PositionConstraintEditor.cs +++ b/Editor/Mono/Inspector/PositionConstraintEditor.cs @@ -29,10 +29,10 @@ internal class PositionConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_RestTranslation = EditorGUIUtility.TrTextContent("Position At Rest"); - GUIContent m_TranslationOffset = EditorGUIUtility.TrTextContent("Position Offset"); + GUIContent m_RestTranslation = L10n.TextContent("Position At Rest", null, null, null); + GUIContent m_TranslationOffset = L10n.TextContent("Position Offset", null, null, null); - GUIContent m_TranslationAxes = EditorGUIUtility.TrTextContent("Freeze Position Axes"); + GUIContent m_TranslationAxes = L10n.TextContent("Freeze Position Axes", null, null, null); public override GUIContent AtRest { get { return m_RestTranslation; } } public override GUIContent Offset { get { return m_TranslationOffset; } } diff --git a/Editor/Mono/Inspector/QualitySettingsEditor.cs b/Editor/Mono/Inspector/QualitySettingsEditor.cs index 54afdafa94..d6c675e69b 100644 --- a/Editor/Mono/Inspector/QualitySettingsEditor.cs +++ b/Editor/Mono/Inspector/QualitySettingsEditor.cs @@ -27,42 +27,42 @@ internal class QualitySettingsEditor : ProjectSettingsBaseEditor { private class ContentNonSearchable { - public static readonly GUIContent kSoftParticlesHint = EditorGUIUtility.TrTextContent("Soft Particles require either the Deferred Shading rendering path or Cameras that render depth textures."); - public static readonly GUIContent kMipStrippingHint = EditorGUIUtility.TrTextContent("Detected platforms with textures that never use their highest resolution mipmap levels. Enable Texture Mipmap Stripping in the Player Settings to reduce the package size of those platforms."); - public static readonly GUIContent kAsyncUploadBufferSizeWarning = EditorGUIUtility.TrTextContent("Unity has detected that you are using an upload buffer size of {0} MB with the '{1}' setting enabled. If you have issues with excessive memory usage, you may need to reduce the upload buffer size or disable the '{1}' setting. Memory fragmentation can occur if you choose the latter option."); + public static readonly GUIContent kSoftParticlesHint = L10n.TextContent("Soft Particles require either the Deferred Shading rendering path or Cameras that render depth textures.", null, null, null); + public static readonly GUIContent kMipStrippingHint = L10n.TextContent("Detected platforms with textures that never use their highest resolution mipmap levels. Enable Texture Mipmap Stripping in the Player Settings to reduce the package size of those platforms.", null, null, null); + public static readonly GUIContent kAsyncUploadBufferSizeWarning = L10n.TextContent("Unity has detected that you are using an upload buffer size of {0} MB with the '{1}' setting enabled. If you have issues with excessive memory usage, you may need to reduce the upload buffer size or disable the '{1}' setting. Memory fragmentation can occur if you choose the latter option.", null, null, null); } internal class Content { - public static readonly GUIContent kPlatformTooltip = EditorGUIUtility.TrTextContent("", "Allow quality setting on platform"); - public static readonly GUIContent kAddQualityLevel = EditorGUIUtility.TrTextContent("Add Quality Level"); + public static readonly GUIContent kPlatformTooltip = L10n.TextContent("", "Allow quality setting on platform", null, null); + public static readonly GUIContent kAddQualityLevel = L10n.TextContent("Add Quality Level", null, null, null); - public static readonly GUIContent kGlobalTextureMipmapLimit = EditorGUIUtility.TrTextContent("Global Mipmap Limit", "The base texture quality level."); + public static readonly GUIContent kGlobalTextureMipmapLimit = L10n.TextContent("Global Mipmap Limit", "The base texture quality level.", null, null); - public static readonly GUIContent kTextureMipmapLimitGroupsHeader = EditorGUIUtility.TrTextContent("Mipmap Limit Groups", "Mipmap Limit Groups are used to control quality on a per-texture basis."); + public static readonly GUIContent kTextureMipmapLimitGroupsHeader = L10n.TextContent("Mipmap Limit Groups", "Mipmap Limit Groups are used to control quality on a per-texture basis.", null, null); public static readonly GUIContent[] kTextureMipmapLimitGroupsOverrideModeItems = { - EditorGUIUtility.TrTextContent("Override Global Mipmap Limit: Full Resolution", "Global Mipmap Limit is ignored, upload at full resolution."), - EditorGUIUtility.TrTextContent("Override Global Mipmap Limit: Half Resolution", "Global Mipmap Limit is ignored, upload at half resolution."), - EditorGUIUtility.TrTextContent("Override Global Mipmap Limit: Quarter Resolution", "Global Mipmap Limit is ignored, upload at quarter resolution."), - EditorGUIUtility.TrTextContent("Override Global Mipmap Limit: Eighth Resolution", "Global Mipmap Limit is ignored, upload at eighth resolution.") + L10n.TextContent("Override Global Mipmap Limit: Full Resolution", "Global Mipmap Limit is ignored, upload at full resolution.", null, null), + L10n.TextContent("Override Global Mipmap Limit: Half Resolution", "Global Mipmap Limit is ignored, upload at half resolution.", null, null), + L10n.TextContent("Override Global Mipmap Limit: Quarter Resolution", "Global Mipmap Limit is ignored, upload at quarter resolution.", null, null), + L10n.TextContent("Override Global Mipmap Limit: Eighth Resolution", "Global Mipmap Limit is ignored, upload at eighth resolution.", null, null) }; public static readonly GUIContent[] kTextureMipmapLimitGroupsOffsetModeItems = { - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: -3", "Upload 3 mipmap levels extra compared to the Global Mipmap Limit."), - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: -2", "Upload 2 mipmap levels extra compared to the Global Mipmap Limit."), - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: -1", "Upload 1 mipmap level extra compared to the Global Mipmap Limit."), - EditorGUIUtility.TrTextContent("Use Global Mipmap Limit", "No offset or override occurs, simply use the Global Mipmap Limit. (Default)"), - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: +1", "Upload 1 mipmap level less compared to the Global Mipmap Limit."), - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: +2", "Upload 2 mipmap levels less compared to the Global Mipmap Limit."), - EditorGUIUtility.TrTextContent("Offset Global Mipmap Limit: +3", "Upload 3 mipmap levels less compared to the Global Mipmap Limit.") + L10n.TextContent("Offset Global Mipmap Limit: -3", "Upload 3 mipmap levels extra compared to the Global Mipmap Limit.", null, null), + L10n.TextContent("Offset Global Mipmap Limit: -2", "Upload 2 mipmap levels extra compared to the Global Mipmap Limit.", null, null), + L10n.TextContent("Offset Global Mipmap Limit: -1", "Upload 1 mipmap level extra compared to the Global Mipmap Limit.", null, null), + L10n.TextContent("Use Global Mipmap Limit", "No offset or override occurs, simply use the Global Mipmap Limit. (Default)", null, null), + L10n.TextContent("Offset Global Mipmap Limit: +1", "Upload 1 mipmap level less compared to the Global Mipmap Limit.", null, null), + L10n.TextContent("Offset Global Mipmap Limit: +2", "Upload 2 mipmap levels less compared to the Global Mipmap Limit.", null, null), + L10n.TextContent("Offset Global Mipmap Limit: +3", "Upload 3 mipmap levels less compared to the Global Mipmap Limit.", null, null) }; - public static readonly GUIContent kTextureMipmapLimitGroupsOptions = EditorGUIUtility.TrIconContent("_Menu", "Show additional options"); - public static readonly GUIContent kTextureMipmapLimitGroupsOptionsIdentify = EditorGUIUtility.TrTextContent("Identify textures"); - public static readonly GUIContent kTextureMipmapLimitGroupsOptionsDuplicate = EditorGUIUtility.TrTextContent("Duplicate group"); - public static readonly GUIContent kTextureMipmapLimitGroupsOptionsRename = EditorGUIUtility.TrTextContent("Rename group"); - public static readonly GUIContent kTextureMipmapLimitGroupsAddButton = EditorGUIUtility.TrIconContent("Toolbar Plus", "Create a new mipmap limit group. Note that this adds a group to all quality levels, not only the active one!"); - public static readonly GUIContent kTextureMipmapLimitGroupsRemoveButton = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove mipmap limit group. Note that this removes the group from all quality levels, not only the active one!"); + public static readonly GUIContent kTextureMipmapLimitGroupsOptions = L10n.IconContent("_Menu", "Show additional options", null); + public static readonly GUIContent kTextureMipmapLimitGroupsOptionsIdentify = L10n.TextContent("Identify textures", null, null, null); + public static readonly GUIContent kTextureMipmapLimitGroupsOptionsDuplicate = L10n.TextContent("Duplicate group", null, null, null); + public static readonly GUIContent kTextureMipmapLimitGroupsOptionsRename = L10n.TextContent("Rename group", null, null, null); + public static readonly GUIContent kTextureMipmapLimitGroupsAddButton = L10n.IconContent("Toolbar Plus", "Create a new mipmap limit group. Note that this adds a group to all quality levels, not only the active one!", null); + public static readonly GUIContent kTextureMipmapLimitGroupsRemoveButton = L10n.IconContent("Toolbar Minus", "Remove mipmap limit group. Note that this removes the group from all quality levels, not only the active one!", null); public static readonly string kTextureMipmapLimitGroupsDialogTitleOnUpdate = L10n.Tr("Mipmap Limit Groups: Update textures?", null); public static readonly string kTextureMipmapLimitGroupsDialogMessageOnRemove = L10n.Tr("Textures in your project may still be using '{0}'.\n\nSelect 'No' to remove the group without modifying its associated textures. Relevant textures stay bound to the group and fall back automatically to the global mipmap limit.\n\nSelect 'Yes' to remove the group and reset the group property of associated textures to 'None'. This triggers a re-import and may take some time. An undo cannot revert the importer changes.", null); @@ -72,45 +72,45 @@ internal class Content public static readonly string kTextureMipmapLimitGroupsDialogMessageOnUpdateAssetsError = L10n.Tr("An error occured while updating texture assets: {0}", null); public static readonly string kTextureMipmapLimitGroupsDialogMessageOnIdentifyFail = L10n.Tr("No textures are linked to the mipmap limit group '{0}'.", null); - public static readonly GUIContent kStreamingMipmapsActive = EditorGUIUtility.TrTextContent("Mipmap Streaming", "When enabled, Unity only streams texture mipmap levels relevant to the current Camera's position in a Scene. This reduces the total amount of memory Unity needs for textures. Individual textures must also have 'Stream Mipmap Levels' enabled in their Import Settings."); - public static readonly GUIContent kStreamingMipmapsMemoryBudget = EditorGUIUtility.TrTextContent("Memory Budget", "The amount of memory (in megabytes) to allocate for all loaded textures."); - public static readonly GUIContent kStreamingMipmapsRenderersPerFrame = EditorGUIUtility.TrTextContent("Renderers Per Frame", "The number of renderers to process each frame. A lower number decreases the CPU load but delays mipmap loading."); - public static readonly GUIContent kStreamingMipmapsAddAllCameras = EditorGUIUtility.TrTextContent("Add All Cameras", "When enabled, Unity uses mipmap streaming for every Camera in the Scene. Otherwise, Unity only uses mipmap streaming for Cameras that have an attached Streaming Controller component."); - public static readonly GUIContent kStreamingMipmapsMaxLevelReduction = EditorGUIUtility.TrTextContent("Max Level Reduction", "The maximum number of mipmap levels a texture can drop."); - public static readonly GUIContent kStreamingMipmapsMaxFileIORequests = EditorGUIUtility.TrTextContent("Max IO Requests", "The maximum number of texture file requests from the Mipmap Streaming system that can be active at the same time."); - - public static readonly GUIContent kIconTrash = EditorGUIUtility.TrIconContent("TreeEditor.Trash", "Delete Level"); - public static readonly GUIContent kBillboardsFaceCameraPos = EditorGUIUtility.TrTextContent("Billboards Face Camera Position", "When enabled, terrain billboards face towards the camera position. Otherwise, they face towards the camera plane. This makes billboards look nicer when the camera rotates but it is more resource intensive to process."); - public static readonly GUIContent kUseLegacyDistribution = EditorGUIUtility.TrTextContent("Use Legacy Details Distribution", "When enabled, terrain details will be scattered using the old scattering algorithm that often resulted in overlapping details. Included for backwards compatibility with terrain authored in Unity 2022.1 and earlier."); - public static readonly GUIContent kVSyncCountLabel = EditorGUIUtility.TrTextContent("VSync Count", "Specifies how Unity synchronizes rendering with the refresh rate of the display device."); - public static readonly GUIContent kRealtimeLGiCpuUsageLabel = EditorGUIUtility.TrTextContent("Realtime GI CPU Usage", "How many CPU worker threads to create for Realtime Global Illumination lighting calculations in the Player. Increasing this makes the system react faster to changes in lighting at a cost of using more CPU time. The higher the CPU Usage value, the more worker threads are created for solving Realtime GI."); - public static readonly GUIContent kLODBiasLabel = EditorGUIUtility.TrTextContent("LOD Group Bias", "The bias Unity uses to determine which model to render when a GameObject’s on-screen size is between two LOD levels. Values between 0 and 1 favor the less detailed model. Values greater than 1 favor the more detailed model."); - public static readonly GUIContent kMaximumLODLevelLabel = EditorGUIUtility.TrTextContent("Maximum LOD Group Level", "The highest LOD to use in the application."); - public static readonly GUIContent kMeshLODThresholdLabel = EditorGUIUtility.TrTextContent("Mesh LOD Threshold", "Unity uses this parameter when selecting the Mesh LOD index to render. Increasing this setting makes Unity favor less detailed LODs in the evaluation process."); - public static readonly GUIContent kEnableLODCrossFadeLabel = EditorGUIUtility.TrTextContent("LOD Cross Fade", "Enables or disables LOD Cross Fade."); - - public static readonly GUIContent kAsyncUploadTimeSlice = EditorGUIUtility.TrTextContent("Time Slice", "The amount of time (in milliseconds) Unity spends uploading Texture and Mesh data to the GPU per frame."); - public static readonly GUIContent kAsyncUploadBufferSize = EditorGUIUtility.TrTextContent("Buffer Size", "The size (in megabytes) of the upload buffer Unity uses to stream Texture and Mesh data to GPU."); - public static readonly GUIContent kAsyncUploadPersistentBuffer = EditorGUIUtility.TrTextContent("Persistent Buffer", "When enabled, the upload buffer persists even when there is nothing left to upload."); - - public static readonly GUIContent kOverrideTerrainPixelError = EditorGUIUtility.TrTextContent("", "Whether to override pixel error in active Terrains."); - public static readonly GUIContent kOverrideTerrainBasemapDist = EditorGUIUtility.TrTextContent("", "Whether to override base map distance in active Terrains."); - public static readonly GUIContent kOverrideTerrainDensityScale = EditorGUIUtility.TrTextContent("", "Whether to override detail density scale in active Terrains."); - public static readonly GUIContent kOverrideTerrainDetailDistance = EditorGUIUtility.TrTextContent("", "Whether to override detail distance in active Terrains."); - public static readonly GUIContent kOverrideTerrainTreeDistance = EditorGUIUtility.TrTextContent("", "Whether to override tree distance in active Terrains."); - public static readonly GUIContent kOverrideTerrainBillboardStart = EditorGUIUtility.TrTextContent("", "Whether to override billboard start distance in active Terrains."); - public static readonly GUIContent kOverrideTerrainFadeLength = EditorGUIUtility.TrTextContent("", "Whether to override billboard fade length in active Terrains."); - public static readonly GUIContent kOverrideTerrainMaxTrees = EditorGUIUtility.TrTextContent("", "Whether to override max mesh trees in active Terrains."); - public static readonly GUIContent kTerrainPixelError = EditorGUIUtility.TrTextContent("Pixel Error", "Value set to Terrain pixel error (See Terrain settings)"); - public static readonly GUIContent kTerrainBasemapDistance = EditorGUIUtility.TrTextContent("Base Map Dist.", "Value set to Terrain base map distance (See Terrain settings)"); - public static readonly GUIContent kTerrainDetailDensityScale = EditorGUIUtility.TrTextContent("Detail Density Scale", "Value set to Terrain detail density scale (See Terrain settings)"); - public static readonly GUIContent kTerrainDetailDistance = EditorGUIUtility.TrTextContent("Detail Distance", "Value set to Terrain detail object distance (See Terrain settings)"); - public static readonly GUIContent kTerrainTreeDistance = EditorGUIUtility.TrTextContent("Tree Distance", "Value set to Terrain tree distance (See Terrain settings)"); - public static readonly GUIContent kTerrainBillboardStart = EditorGUIUtility.TrTextContent("Billboard Start", "Value set to Terrain billboard start distance (See Terrain settings)"); - public static readonly GUIContent kTerrainFadeLength = EditorGUIUtility.TrTextContent("Fade Length", "Value set to Terrain billboard fade length (See Terrain settings)"); - public static readonly GUIContent kTerrainMaxTrees = EditorGUIUtility.TrTextContent("Max Mesh Trees", "Value set to Terrain max mesh trees (See Terrain settings)"); - - public static readonly GUIContent kRenderPipelineObject = EditorGUIUtility.TrTextContent("Render Pipeline Asset", "Specifies the Render Pipeline Asset to use for this quality level. It overrides the value set in the Graphics Settings Window."); + public static readonly GUIContent kStreamingMipmapsActive = L10n.TextContent("Mipmap Streaming", "When enabled, Unity only streams texture mipmap levels relevant to the current Camera's position in a Scene. This reduces the total amount of memory Unity needs for textures. Individual textures must also have 'Stream Mipmap Levels' enabled in their Import Settings.", null, null); + public static readonly GUIContent kStreamingMipmapsMemoryBudget = L10n.TextContent("Memory Budget", "The amount of memory (in megabytes) to allocate for all loaded textures.", null, null); + public static readonly GUIContent kStreamingMipmapsRenderersPerFrame = L10n.TextContent("Renderers Per Frame", "The number of renderers to process each frame. A lower number decreases the CPU load but delays mipmap loading.", null, null); + public static readonly GUIContent kStreamingMipmapsAddAllCameras = L10n.TextContent("Add All Cameras", "When enabled, Unity uses mipmap streaming for every Camera in the Scene. Otherwise, Unity only uses mipmap streaming for Cameras that have an attached Streaming Controller component.", null, null); + public static readonly GUIContent kStreamingMipmapsMaxLevelReduction = L10n.TextContent("Max Level Reduction", "The maximum number of mipmap levels a texture can drop.", null, null); + public static readonly GUIContent kStreamingMipmapsMaxFileIORequests = L10n.TextContent("Max IO Requests", "The maximum number of texture file requests from the Mipmap Streaming system that can be active at the same time.", null, null); + + public static readonly GUIContent kIconTrash = L10n.IconContent("TreeEditor.Trash", "Delete Level", null); + public static readonly GUIContent kBillboardsFaceCameraPos = L10n.TextContent("Billboards Face Camera Position", "When enabled, terrain billboards face towards the camera position. Otherwise, they face towards the camera plane. This makes billboards look nicer when the camera rotates but it is more resource intensive to process.", null, null); + public static readonly GUIContent kUseLegacyDistribution = L10n.TextContent("Use Legacy Details Distribution", "When enabled, terrain details will be scattered using the old scattering algorithm that often resulted in overlapping details. Included for backwards compatibility with terrain authored in Unity 2022.1 and earlier.", null, null); + public static readonly GUIContent kVSyncCountLabel = L10n.TextContent("VSync Count", "Specifies how Unity synchronizes rendering with the refresh rate of the display device.", null, null); + public static readonly GUIContent kRealtimeLGiCpuUsageLabel = L10n.TextContent("Realtime GI CPU Usage", "How many CPU worker threads to create for Realtime Global Illumination lighting calculations in the Player. Increasing this makes the system react faster to changes in lighting at a cost of using more CPU time. The higher the CPU Usage value, the more worker threads are created for solving Realtime GI.", null, null); + public static readonly GUIContent kLODBiasLabel = L10n.TextContent("LOD Group Bias", "The bias Unity uses to determine which model to render when a GameObject’s on-screen size is between two LOD levels. Values between 0 and 1 favor the less detailed model. Values greater than 1 favor the more detailed model.", null, null); + public static readonly GUIContent kMaximumLODLevelLabel = L10n.TextContent("Maximum LOD Group Level", "The highest LOD to use in the application.", null, null); + public static readonly GUIContent kMeshLODThresholdLabel = L10n.TextContent("Mesh LOD Threshold", "Unity uses this parameter when selecting the Mesh LOD index to render. Increasing this setting makes Unity favor less detailed LODs in the evaluation process.", null, null); + public static readonly GUIContent kEnableLODCrossFadeLabel = L10n.TextContent("LOD Cross Fade", "Enables or disables LOD Cross Fade.", null, null); + + public static readonly GUIContent kAsyncUploadTimeSlice = L10n.TextContent("Time Slice", "The amount of time (in milliseconds) Unity spends uploading Texture and Mesh data to the GPU per frame.", null, null); + public static readonly GUIContent kAsyncUploadBufferSize = L10n.TextContent("Buffer Size", "The size (in megabytes) of the upload buffer Unity uses to stream Texture and Mesh data to GPU.", null, null); + public static readonly GUIContent kAsyncUploadPersistentBuffer = L10n.TextContent("Persistent Buffer", "When enabled, the upload buffer persists even when there is nothing left to upload.", null, null); + + public static readonly GUIContent kOverrideTerrainPixelError = L10n.TextContent("", "Whether to override pixel error in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainBasemapDist = L10n.TextContent("", "Whether to override base map distance in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainDensityScale = L10n.TextContent("", "Whether to override detail density scale in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainDetailDistance = L10n.TextContent("", "Whether to override detail distance in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainTreeDistance = L10n.TextContent("", "Whether to override tree distance in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainBillboardStart = L10n.TextContent("", "Whether to override billboard start distance in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainFadeLength = L10n.TextContent("", "Whether to override billboard fade length in active Terrains.", null, null); + public static readonly GUIContent kOverrideTerrainMaxTrees = L10n.TextContent("", "Whether to override max mesh trees in active Terrains.", null, null); + public static readonly GUIContent kTerrainPixelError = L10n.TextContent("Pixel Error", "Value set to Terrain pixel error (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainBasemapDistance = L10n.TextContent("Base Map Dist.", "Value set to Terrain base map distance (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainDetailDensityScale = L10n.TextContent("Detail Density Scale", "Value set to Terrain detail density scale (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainDetailDistance = L10n.TextContent("Detail Distance", "Value set to Terrain detail object distance (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainTreeDistance = L10n.TextContent("Tree Distance", "Value set to Terrain tree distance (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainBillboardStart = L10n.TextContent("Billboard Start", "Value set to Terrain billboard start distance (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainFadeLength = L10n.TextContent("Fade Length", "Value set to Terrain billboard fade length (See Terrain settings)", null, null); + public static readonly GUIContent kTerrainMaxTrees = L10n.TextContent("Max Mesh Trees", "Value set to Terrain max mesh trees (See Terrain settings)", null, null); + + public static readonly GUIContent kRenderPipelineObject = L10n.TextContent("Render Pipeline Asset", "Specifies the Render Pipeline Asset to use for this quality level. It overrides the value set in the Graphics Settings Window.", null, null); public static readonly string buildProfileQualitySettingsOverrideWarning = L10n.Tr("The current active build profile has overridden Quality levels inclusion. To ensure that the correct levels are included in your build, see the Build Profiles...", null); public static readonly string buildProfileQualitySettingsInformationSingular = L10n.Tr("Renaming and deleting Quality levels will impact one build profile. To edit Quality levels included in build profiles, go to Build Profiles...", null); @@ -2360,7 +2360,7 @@ void DoTextureMipmapLimitGroupsSettingsDropdown(Rect rect, bool isOffset, int mi const int limitValueToItemsArrayIndexOffset = 3; GUIContent content = (isOffset ? (mipmapLimit > -4 && mipmapLimit < 4) : (mipmapLimit >= 0 && mipmapLimit < 4)) // Is limit within array bounds? ? (isOffset ? Content.kTextureMipmapLimitGroupsOffsetModeItems[mipmapLimit + limitValueToItemsArrayIndexOffset] : Content.kTextureMipmapLimitGroupsOverrideModeItems[mipmapLimit]) - : EditorGUIUtility.TrTextContent($"{(isOffset ? "Offset" : "Override")} Global Mipmap Limit: {((mipmapLimit >= 0) ? $"+{mipmapLimit}" : $"{mipmapLimit}")}", "Custom User Setting"); + : L10n.TextContent($"{(isOffset ? "Offset" : "Override")} Global Mipmap Limit: {((mipmapLimit >= 0) ? $"+{mipmapLimit}" : $"{mipmapLimit}")}", "Custom User Setting", null, null); if (EditorGUI.Button(rect, content, EditorStyles.popup)) { diff --git a/Editor/Mono/Inspector/RayTracingShaderInspector.cs b/Editor/Mono/Inspector/RayTracingShaderInspector.cs index 4d99c1cdc2..be4476b313 100644 --- a/Editor/Mono/Inspector/RayTracingShaderInspector.cs +++ b/Editor/Mono/Inspector/RayTracingShaderInspector.cs @@ -18,16 +18,16 @@ internal class RayTracingShaderInspector : Editor private class Styles { - public GUIContent s_MaxRecursionDepthText = EditorGUIUtility.TrTextContent("Max. Recursion Depth", "Limit on ray recursion for the Ray Tracing pipeline. This is defined in the shader by using max_recursion_depth pragma(e.g. \"#pragma max_recursion_depth 5\"). Applications should pick a limit that is as low as absolutely necessary. A value of 1 means that only primary rays can be cast."); - public GUIContent s_PlatformList = EditorGUIUtility.TrTextContent("Platforms:"); - public GUIContent s_NotSupported = EditorGUIUtility.TrTextContent("Ray Tracing Shader not supported! No graphics APIs with Ray Tracing support found in the graphics APIs list or the importing process failed."); - public GUIContent s_Name = EditorGUIUtility.TrTextContent("Name"); - public GUIContent s_PayloadSize = EditorGUIUtility.TrTextContent("Payload Size (Bytes)"); - public GUIContent s_ParamSize = EditorGUIUtility.TrTextContent("Param. Size (Bytes)"); - public GUIContent s_RayGenShaderNames = EditorGUIUtility.TrTextContent("Ray Generation Shaders", "The list of all ray generation shaders in the shader file. Only one ray generation shader can be executed at a time."); - public GUIContent s_MissShaderNames = EditorGUIUtility.TrTextContent("Miss Shaders", "The list of all miss shaders in the shader file. The index of the miss shader to execute is specified when calling TraceRay HLSL function."); - public GUIContent s_DefaultHitGroupShaderNames = EditorGUIUtility.TrTextContent("Default Hit Shaders", "The list of all hit shaders in the shader file."); - public GUIContent s_CallableShaderNames = EditorGUIUtility.TrTextContent("Callable Shaders", "The list of all callable shaders in the shader file. The index of the callable shader to execute is specified when calling CallShader HLSL function."); + public GUIContent s_MaxRecursionDepthText = L10n.TextContent("Max. Recursion Depth", "Limit on ray recursion for the Ray Tracing pipeline. This is defined in the shader by using max_recursion_depth pragma(e.g. \"#pragma max_recursion_depth 5\"). Applications should pick a limit that is as low as absolutely necessary. A value of 1 means that only primary rays can be cast.", null, null); + public GUIContent s_PlatformList = L10n.TextContent("Platforms:", null, null, null); + public GUIContent s_NotSupported = L10n.TextContent("Ray Tracing Shader not supported! No graphics APIs with Ray Tracing support found in the graphics APIs list or the importing process failed.", null, null, null); + public GUIContent s_Name = L10n.TextContent("Name", null, null, null); + public GUIContent s_PayloadSize = L10n.TextContent("Payload Size (Bytes)", null, null, null); + public GUIContent s_ParamSize = L10n.TextContent("Param. Size (Bytes)", null, null, null); + public GUIContent s_RayGenShaderNames = L10n.TextContent("Ray Generation Shaders", "The list of all ray generation shaders in the shader file. Only one ray generation shader can be executed at a time.", null, null); + public GUIContent s_MissShaderNames = L10n.TextContent("Miss Shaders", "The list of all miss shaders in the shader file. The index of the miss shader to execute is specified when calling TraceRay HLSL function.", null, null); + public GUIContent s_DefaultHitGroupShaderNames = L10n.TextContent("Default Hit Shaders", "The list of all hit shaders in the shader file.", null, null); + public GUIContent s_CallableShaderNames = L10n.TextContent("Callable Shaders", "The list of all callable shaders in the shader file. The index of the callable shader to execute is specified when calling CallShader HLSL function.", null, null); public GUIStyle s_LabelStyle = new GUIStyle(EditorStyles.boldLabel); public Styles() { diff --git a/Editor/Mono/Inspector/RectTransformEditor.cs b/Editor/Mono/Inspector/RectTransformEditor.cs index 7d9894c816..d30e338975 100644 --- a/Editor/Mono/Inspector/RectTransformEditor.cs +++ b/Editor/Mono/Inspector/RectTransformEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: uGUIFramework not yet converted using System; using System.Collections.Generic; using System.Globalization; @@ -84,11 +83,11 @@ class Styles { public GUIStyle measuringLabelStyle = "PreOverlayLabel"; - public GUIContent anchorsContent = EditorGUIUtility.TrTextContent("Anchors"); - public GUIContent anchorMinContent = EditorGUIUtility.TrTextContent("Min", "The normalized position in the parent rectangle that the lower left corner is anchored to."); - public GUIContent anchorMaxContent = EditorGUIUtility.TrTextContent("Max", "The normalized position in the parent rectangle that the upper right corner is anchored to."); - public GUIContent pivotContent = EditorGUIUtility.TrTextContent("Pivot", "The pivot point specified in normalized values between 0 and 1. The pivot point is the origin of this rectangle. Rotation and scaling are around this point."); - public GUIContent transformScaleContent = EditorGUIUtility.TrTextContent("Scale", "The local scaling of this Game Object relative to the parent. This scales everything including image borders and text."); + public GUIContent anchorsContent = L10n.TextContent("Anchors", null, null, null); + public GUIContent anchorMinContent = L10n.TextContent("Min", "The normalized position in the parent rectangle that the lower left corner is anchored to.", null, null); + public GUIContent anchorMaxContent = L10n.TextContent("Max", "The normalized position in the parent rectangle that the upper right corner is anchored to.", null, null); + public GUIContent pivotContent = L10n.TextContent("Pivot", "The pivot point specified in normalized values between 0 and 1. The pivot point is the origin of this rectangle. Rotation and scaling are around this point.", null, null); + public GUIContent transformScaleContent = L10n.TextContent("Scale", "The local scaling of this Game Object relative to the parent. This scales everything including image borders and text.", null, null); public GUIContent rawEditContent; public GUIContent blueprintContent; @@ -166,7 +165,7 @@ void OnEnable() m_LocalScale = serializedObject.FindProperty("m_LocalScale"); if (m_RotationGUI == null) m_RotationGUI = new TransformRotationGUI(); - m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), EditorGUIUtility.TrTextContent("Rotation")); + m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), L10n.TextContent("Rotation", null, null, null)); m_ConstrainProportionsScale = new ConstrainProportionsTransformScale(m_LocalScale.vector3Value); @@ -478,7 +477,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.anchoredPosition.x, (rectTransform, val) => rectTransform.anchoredPosition = new Vector2(val, rectTransform.anchoredPosition.y), DrivenTransformProperties.AnchoredPositionX, - EditorGUIUtility.TrTextContent("Pos X")); + L10n.TextContent("Pos X", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingPosX, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); } @@ -491,7 +490,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.offsetMin.x, (rectTransform, val) => rectTransform.offsetMin = new Vector2(val, rectTransform.offsetMin.y), DrivenTransformProperties.None, - EditorGUIUtility.TrTextContent("Left")); + L10n.TextContent("Left", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingLeft, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); EditorGUI.EndProperty(); @@ -505,7 +504,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.anchoredPosition.y, (rectTransform, val) => rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, val), DrivenTransformProperties.AnchoredPositionY, - EditorGUIUtility.TrTextContent("Pos Y")); + L10n.TextContent("Pos Y", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingPosY, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); } @@ -518,7 +517,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => - rectTransform.offsetMax.y, (rectTransform, val) => rectTransform.offsetMax = new Vector2(rectTransform.offsetMax.x, -val), DrivenTransformProperties.None, - EditorGUIUtility.TrTextContent("Top")); + L10n.TextContent("Top", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingTop, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); EditorGUI.EndProperty(); @@ -530,7 +529,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.transform.localPosition.z, (rectTransform, val) => rectTransform.transform.localPosition = new Vector3(rectTransform.transform.localPosition.x, rectTransform.transform.localPosition.y, val), DrivenTransformProperties.AnchoredPositionZ, - EditorGUIUtility.TrTextContent("Pos Z")); + L10n.TextContent("Pos Z", null, null, null)); EditorGUI.EndProperty(); rect.y += EditorGUIUtility.singleLineHeight * 2; @@ -543,7 +542,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.sizeDelta.x, (rectTransform, val) => rectTransform.sizeDelta = new Vector2(val, rectTransform.sizeDelta.y), DrivenTransformProperties.SizeDeltaX, - anyStretchX ? EditorGUIUtility.TrTextContent("W Delta") : EditorGUIUtility.TrTextContent("Width")); + anyStretchX ? L10n.TextContent("W Delta", null, null, null) : L10n.TextContent("Width", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingWidth, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); } @@ -556,7 +555,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => - rectTransform.offsetMax.x, (rectTransform, val) => rectTransform.offsetMax = new Vector2(-val, rectTransform.offsetMax.y), DrivenTransformProperties.None, - EditorGUIUtility.TrTextContent("Right")); + L10n.TextContent("Right", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingRight, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); EditorGUI.EndProperty(); @@ -570,7 +569,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.sizeDelta.y, (rectTransform, val) => rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, val), DrivenTransformProperties.SizeDeltaY, - anyStretchY ? EditorGUIUtility.TrTextContent("H Delta") : EditorGUIUtility.TrTextContent("Height")); + anyStretchY ? L10n.TextContent("H Delta", null, null, null) : L10n.TextContent("Height", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingHeight, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); } @@ -583,7 +582,7 @@ void SmartPositionAndSizeFields(bool anyWithoutParent, bool anyDrivenX, bool any rectTransform => rectTransform.offsetMin.y, (rectTransform, val) => rectTransform.offsetMin = new Vector2(rectTransform.offsetMin.x, val), DrivenTransformProperties.None, - EditorGUIUtility.TrTextContent("Bottom")); + L10n.TextContent("Bottom", null, null, null)); SetFadingBasedOnControlID(ref m_ChangingBottom, EditorGUIUtility.s_LastControlID); EditorGUI.EndProperty(); EditorGUI.EndProperty(); @@ -1571,4 +1570,3 @@ public static void SetAnchorSmart(RectTransform rectTransform, float value, int } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/ReflectionProbeEditor.cs b/Editor/Mono/Inspector/ReflectionProbeEditor.cs index 9ef8c4f51b..056891e761 100644 --- a/Editor/Mono/Inspector/ReflectionProbeEditor.cs +++ b/Editor/Mono/Inspector/ReflectionProbeEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using System.Collections; using System.Collections.Generic; using System.IO; @@ -96,38 +95,38 @@ static Styles() public static readonly GUIStyle richTextMiniLabel = new GUIStyle(EditorStyles.miniLabel); - public static readonly GUIContent bakeButtonText = EditorGUIUtility.TrTextContent("Bake"); - public static readonly GUIContent bakeButtonTextDisabled = EditorGUIUtility.TrTextContent("Bake", "You need to save the scene before bake"); + public static readonly GUIContent bakeButtonText = L10n.TextContent("Bake", null, null, null); + public static readonly GUIContent bakeButtonTextDisabled = L10n.TextContent("Bake", "You need to save the scene before bake", null, null); public static readonly string[] bakeCustomOptionText = { "Bake as new Cubemap..." }; public static readonly string[] bakeButtonsText = { "Bake All Reflection Probes" }; - public static readonly GUIContent bakeCustomButtonText = EditorGUIUtility.TrTextContent("Bake", "Bakes Reflection Probe's cubemap, overwriting the existing cubemap texture asset (if any)."); - public static readonly GUIContent bakeCustomButtonTextDisabled = EditorGUIUtility.TrTextContent("Bake", "You need to save the scene before bake"); - public static readonly GUIContent runtimeSettingsHeader = EditorGUIUtility.TrTextContent("Runtime Settings", "These settings determine this Probe's priority, blending, intensity, and zone of effect and works in conjunction with the cubemap of this probe when it is rendered."); - public static readonly GUIContent backgroundColorText = EditorGUIUtility.TrTextContent("Background Color", "Camera clears the screen to this color before rendering."); - public static readonly GUIContent clearFlagsText = EditorGUIUtility.TrTextContent("Clear Flags", "Specify how to fill empty areas of the cubemap."); - public static readonly GUIContent intensityText = EditorGUIUtility.TrTextContent("Intensity", "The intensity modifier the Editor applies to this probe's texture in its shader."); - public static readonly GUIContent exposureText = EditorGUIUtility.TrTextContent("Exposure", "The exposure value at capture time. When the scene's exposure differs from this value, the probe's contribution is re-exposed to match."); + public static readonly GUIContent bakeCustomButtonText = L10n.TextContent("Bake", "Bakes Reflection Probe's cubemap, overwriting the existing cubemap texture asset (if any).", null, null); + public static readonly GUIContent bakeCustomButtonTextDisabled = L10n.TextContent("Bake", "You need to save the scene before bake", null, null); + public static readonly GUIContent runtimeSettingsHeader = L10n.TextContent("Runtime Settings", "These settings determine this Probe's priority, blending, intensity, and zone of effect and works in conjunction with the cubemap of this probe when it is rendered.", null, null); + public static readonly GUIContent backgroundColorText = L10n.TextContent("Background Color", "Camera clears the screen to this color before rendering.", null, null); + public static readonly GUIContent clearFlagsText = L10n.TextContent("Clear Flags", "Specify how to fill empty areas of the cubemap.", null, null); + public static readonly GUIContent intensityText = L10n.TextContent("Intensity", "The intensity modifier the Editor applies to this probe's texture in its shader.", null, null); + public static readonly GUIContent exposureText = L10n.TextContent("Exposure", "The exposure value at capture time. When the scene's exposure differs from this value, the probe's contribution is re-exposed to match.", null, null); public static readonly string exposureHelpText = "Exposure setting only available for custom probes. It is set by realtime and baked probes when rendering."; - public static readonly GUIContent resolutionText = EditorGUIUtility.TrTextContent("Resolution", "The resolution of the cubemap."); - public static readonly GUIContent captureCubemapHeader = EditorGUIUtility.TrTextContent("Cubemap Capture Settings", "Settings that determine how to render this probe's cubemap."); - public static readonly GUIContent boxProjectionText = EditorGUIUtility.TrTextContent("Box Projection", "When enabled, Unity assumes that the reflected light is originating from the inside of the probe's box, rather than from infinitely far away. This is useful for box-shaped indoor environments."); - public static readonly GUIContent blendDistanceText = EditorGUIUtility.TrTextContent("Blend Distance", "Area around the probe where it is blended with other probes. Only used in deferred probes."); - public static readonly GUIContent sizeText = EditorGUIUtility.TrTextContent("Box Size", "The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object."); - public static readonly GUIContent centerText = EditorGUIUtility.TrTextContent("Box Offset", "The center of the box in which the reflections will be applied to objects. The value is relative to the position of the Game Object."); - public static readonly GUIContent customCubemapText = EditorGUIUtility.TrTextContent("Cubemap", "Sets a custom cubemap for this probe."); - public static readonly GUIContent importanceText = EditorGUIUtility.TrTextContent("Importance", "When reflection probes overlap, Unity uses Importance to determine which probe should take priority."); - public static readonly GUIContent renderDynamicObjects = EditorGUIUtility.TrTextContent("Dynamic Objects", "If enabled dynamic objects are also rendered into the cubemap"); - public static readonly GUIContent timeSlicing = EditorGUIUtility.TrTextContent("Time Slicing", "If enabled this probe will update over several frames, to help reduce the impact on the frame rate"); - public static readonly GUIContent refreshMode = EditorGUIUtility.TrTextContent("Refresh Mode", "Controls how this probe refreshes in the Player"); - public static readonly GUIContent useOcclusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "If this property is enabled, geometries which are blocked from the probe's line of sight are skipped during rendering."); - public static readonly GUIContent hdrText = EditorGUIUtility.TrTextContent("HDR", "Enable High Dynamic Range rendering."); - public static readonly GUIContent shadowDistanceText = EditorGUIUtility.TrTextContent("Shadow Distance", "Maximum distance at which Unity renders shadows associated with this probe."); - public static readonly GUIContent cullingMaskText = EditorGUIUtility.TrTextContent("Culling Mask", "Allows objects on specified layers to be included or excluded in the reflection."); - public static readonly GUIContent textureTypeError = EditorGUIUtility.TrTextContent("The associated texture is not a Cubemap. If the texture is backed by an asset this can be fixed by setting the texture type to Cubemap in the texture importer and then rebaking the probe."); - - public static readonly GUIContent typeText = EditorGUIUtility.TrTextContent("Type", "Specify the lighting setup for this probe: Baked, Custom, or Realtime."); - public static readonly GUIContent[] reflectionProbeMode = { EditorGUIUtility.TrTextContent("Baked"), EditorGUIUtility.TrTextContent("Custom"), EditorGUIUtility.TrTextContent("Realtime") }; + public static readonly GUIContent resolutionText = L10n.TextContent("Resolution", "The resolution of the cubemap.", null, null); + public static readonly GUIContent captureCubemapHeader = L10n.TextContent("Cubemap Capture Settings", "Settings that determine how to render this probe's cubemap.", null, null); + public static readonly GUIContent boxProjectionText = L10n.TextContent("Box Projection", "When enabled, Unity assumes that the reflected light is originating from the inside of the probe's box, rather than from infinitely far away. This is useful for box-shaped indoor environments.", null, null); + public static readonly GUIContent blendDistanceText = L10n.TextContent("Blend Distance", "Area around the probe where it is blended with other probes. Only used in deferred probes.", null, null); + public static readonly GUIContent sizeText = L10n.TextContent("Box Size", "The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object.", null, null); + public static readonly GUIContent centerText = L10n.TextContent("Box Offset", "The center of the box in which the reflections will be applied to objects. The value is relative to the position of the Game Object.", null, null); + public static readonly GUIContent customCubemapText = L10n.TextContent("Cubemap", "Sets a custom cubemap for this probe.", null, null); + public static readonly GUIContent importanceText = L10n.TextContent("Importance", "When reflection probes overlap, Unity uses Importance to determine which probe should take priority.", null, null); + public static readonly GUIContent renderDynamicObjects = L10n.TextContent("Dynamic Objects", "If enabled dynamic objects are also rendered into the cubemap", null, null); + public static readonly GUIContent timeSlicing = L10n.TextContent("Time Slicing", "If enabled this probe will update over several frames, to help reduce the impact on the frame rate", null, null); + public static readonly GUIContent refreshMode = L10n.TextContent("Refresh Mode", "Controls how this probe refreshes in the Player", null, null); + public static readonly GUIContent useOcclusionCulling = L10n.TextContent("Occlusion Culling", "If this property is enabled, geometries which are blocked from the probe's line of sight are skipped during rendering.", null, null); + public static readonly GUIContent hdrText = L10n.TextContent("HDR", "Enable High Dynamic Range rendering.", null, null); + public static readonly GUIContent shadowDistanceText = L10n.TextContent("Shadow Distance", "Maximum distance at which Unity renders shadows associated with this probe.", null, null); + public static readonly GUIContent cullingMaskText = L10n.TextContent("Culling Mask", "Allows objects on specified layers to be included or excluded in the reflection.", null, null); + public static readonly GUIContent textureTypeError = L10n.TextContent("The associated texture is not a Cubemap. If the texture is backed by an asset this can be fixed by setting the texture type to Cubemap in the texture importer and then rebaking the probe.", null, null, null); + + public static readonly GUIContent typeText = L10n.TextContent("Type", "Specify the lighting setup for this probe: Baked, Custom, or Realtime.", null, null); + public static readonly GUIContent[] reflectionProbeMode = { L10n.TextContent("Baked", null, null, null), L10n.TextContent("Custom", null, null, null), L10n.TextContent("Realtime", null, null, null) }; public static readonly int[] reflectionProbeModeValues = { (int)ReflectionProbeMode.Baked, (int)ReflectionProbeMode.Custom, (int)ReflectionProbeMode.Realtime }; [NoAutoStaticsCleanup] // lazy int[] cache rebuilt on demand by GetResolutionArray; contents are resolution values, safe to persist @@ -137,19 +136,19 @@ static Styles() public static readonly GUIContent[] clearFlags = { - EditorGUIUtility.TrTextContent("Skybox"), - EditorGUIUtility.TrTextContent("Solid Color") + L10n.TextContent("Skybox", null, null, null), + L10n.TextContent("Solid Color", null, null, null) }; public static readonly int[] clearFlagsValues = { 1, 2 }; // taken from Camera.h private static readonly GUIContent customPrivitiveBoundsHandleEditModeButton = new GUIContent( EditorGUIUtility.IconContent("EditShape").image, - EditorGUIUtility.TrTextContent("Adjust the probe's zone of effect. Holding Alt or Shift and click the control handle to pin the center or scale the volume uniformly.").text + L10n.TextContent("Adjust the probe's zone of effect. Holding Alt or Shift and click the control handle to pin the center or scale the volume uniformly.", null, null, null).text ); public static readonly GUIContent[] toolContents = { customPrivitiveBoundsHandleEditModeButton, - EditorGUIUtility.TrIconContent("CapturePosition", "Modify capture position.") + L10n.IconContent("CapturePosition", "Modify capture position.", null) }; public static readonly EditMode.SceneViewEditMode[] sceneViewEditModes = new[] { @@ -941,4 +940,3 @@ void DoBoxEditing() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/RenderPipelineAssetSelector.cs b/Editor/Mono/Inspector/RenderPipelineAssetSelector.cs index d127806c43..2fb99c9cbf 100644 --- a/Editor/Mono/Inspector/RenderPipelineAssetSelector.cs +++ b/Editor/Mono/Inspector/RenderPipelineAssetSelector.cs @@ -16,7 +16,7 @@ public sealed partial class EditorGUI { static class RenderPipelineAssetSelectorStyles { - public static readonly GUIContent renderPipeLabel = EditorGUIUtility.TrTextContent("Scriptable Render Pipeline"); + public static readonly GUIContent renderPipeLabel = L10n.TextContent("Scriptable Render Pipeline", null, null, null); public static string renderPipeChangedWarning => LocalizationDatabase.GetLocalizedString("Changing this render pipeline asset may take a significant amount of time."); public static string renderPipeChangedTitleBox => LocalizationDatabase.GetLocalizedString("Changing Render Pipeline"); diff --git a/Editor/Mono/Inspector/RenderPipelineEditorUtility.cs b/Editor/Mono/Inspector/RenderPipelineEditorUtility.cs index 215f100250..38b324cb1e 100644 --- a/Editor/Mono/Inspector/RenderPipelineEditorUtility.cs +++ b/Editor/Mono/Inspector/RenderPipelineEditorUtility.cs @@ -85,6 +85,9 @@ public static bool TryRemoveLastRenderingLayerName() => TagManager.Internal_TryRemoveLastRenderingLayerName(); [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static Action onRenderingLayerCountChanged; /// diff --git a/Editor/Mono/Inspector/RenderTextureEditor.cs b/Editor/Mono/Inspector/RenderTextureEditor.cs index caebb3e03a..d2babe864e 100644 --- a/Editor/Mono/Inspector/RenderTextureEditor.cs +++ b/Editor/Mono/Inspector/RenderTextureEditor.cs @@ -18,29 +18,29 @@ internal class RenderTextureEditor : TextureInspector private class Styles { - public readonly GUIContent size = EditorGUIUtility.TrTextContent("Size", "Size of the render texture in pixels."); + public readonly GUIContent size = L10n.TextContent("Size", "Size of the render texture in pixels.", null, null); public readonly GUIContent cross = EditorGUIUtility.TextContent("x"); - public readonly GUIContent antiAliasing = EditorGUIUtility.TrTextContent("Anti-aliasing", "Number of anti-aliasing samples."); - public readonly GUIContent colorFormat = EditorGUIUtility.TrTextContent("Color Format", "Format of the color buffer."); - public readonly GUIContent depthStencilFormat = EditorGUIUtility.TrTextContent("Depth Stencil Format", "Format of the depth stencil buffer."); - public readonly GUIContent enableCompatibleFormat = EditorGUIUtility.TrTextContent("Enable Compatible Format", "Lets the color and depth stencil formats be changed to compatible and supported formats for the target platform automatically, if the target platform doesn't support the input format."); - public readonly GUIContent dimension = EditorGUIUtility.TrTextContent("Dimension", "Is the texture 2D, Cube or 3D?"); - public readonly GUIContent enableMipmaps = EditorGUIUtility.TrTextContent("Mipmap", "This render texture will have a mipmap."); - public readonly GUIContent autoGeneratesMipmaps = EditorGUIUtility.TrTextContent("Auto-generate", "This render texture automatically generate its mipmap."); - public readonly GUIContent useDynamicScale = EditorGUIUtility.TrTextContent("Dynamic Scaling", "Allow the texture to be automatically resized by ScalableBufferManager, to support dynamic resolution."); - public readonly GUIContent enableRandomWrite = EditorGUIUtility.TrTextContent("Random Write", "Enable/disable random access write into the color buffer of this render texture."); - public readonly GUIContent shadowSamplingMode = EditorGUIUtility.TrTextContent("Shadow Sampling Mode", "Enable/disable shadow depth-compare sampling and percentage closer filtering."); + public readonly GUIContent antiAliasing = L10n.TextContent("Anti-aliasing", "Number of anti-aliasing samples.", null, null); + public readonly GUIContent colorFormat = L10n.TextContent("Color Format", "Format of the color buffer.", null, null); + public readonly GUIContent depthStencilFormat = L10n.TextContent("Depth Stencil Format", "Format of the depth stencil buffer.", null, null); + public readonly GUIContent enableCompatibleFormat = L10n.TextContent("Enable Compatible Format", "Lets the color and depth stencil formats be changed to compatible and supported formats for the target platform automatically, if the target platform doesn't support the input format.", null, null); + public readonly GUIContent dimension = L10n.TextContent("Dimension", "Is the texture 2D, Cube or 3D?", null, null); + public readonly GUIContent enableMipmaps = L10n.TextContent("Mipmap", "This render texture will have a mipmap.", null, null); + public readonly GUIContent autoGeneratesMipmaps = L10n.TextContent("Auto-generate", "This render texture automatically generate its mipmap.", null, null); + public readonly GUIContent useDynamicScale = L10n.TextContent("Dynamic Scaling", "Allow the texture to be automatically resized by ScalableBufferManager, to support dynamic resolution.", null, null); + public readonly GUIContent enableRandomWrite = L10n.TextContent("Random Write", "Enable/disable random access write into the color buffer of this render texture.", null, null); + public readonly GUIContent shadowSamplingMode = L10n.TextContent("Shadow Sampling Mode", "Enable/disable shadow depth-compare sampling and percentage closer filtering.", null, null); public readonly GUIContent[] renderTextureAntiAliasing = { - EditorGUIUtility.TrTextContent("None"), - EditorGUIUtility.TrTextContent("2 samples"), - EditorGUIUtility.TrTextContent("4 samples"), - EditorGUIUtility.TrTextContent("8 samples") + L10n.TextContent("None", null, null, null), + L10n.TextContent("2 samples", null, null, null), + L10n.TextContent("4 samples", null, null, null), + L10n.TextContent("8 samples", null, null, null) }; public readonly int[] renderTextureAntiAliasingValues = { 1, 2, 4, 8 }; - public readonly GUIContent[] dimensionStrings = { EditorGUIUtility.TextContent("2D"), EditorGUIUtility.TextContent("2D Array"), EditorGUIUtility.TrTextContent("Cube"), EditorGUIUtility.TrTextContent("3D") }; + public readonly GUIContent[] dimensionStrings = { EditorGUIUtility.TextContent("2D"), EditorGUIUtility.TextContent("2D Array"), L10n.TextContent("Cube", null, null, null), L10n.TextContent("3D", null, null, null) }; public readonly int[] dimensionValues = { (int)UnityEngine.Rendering.TextureDimension.Tex2D, (int)UnityEngine.Rendering.TextureDimension.Tex2DArray, (int)UnityEngine.Rendering.TextureDimension.Cube, (int)UnityEngine.Rendering.TextureDimension.Tex3D }; } diff --git a/Editor/Mono/Inspector/RendererEditorBase.cs b/Editor/Mono/Inspector/RendererEditorBase.cs index 422b6a1d31..5fae220dec 100644 --- a/Editor/Mono/Inspector/RendererEditorBase.cs +++ b/Editor/Mono/Inspector/RendererEditorBase.cs @@ -25,16 +25,16 @@ internal class Probes private SerializedProperty m_ProbeAnchor; private SerializedProperty m_ReceiveShadows; - private GUIContent m_LightProbeUsageStyle = EditorGUIUtility.TrTextContent("Light Probes", "Specifies how Light Probes will handle the interpolation of lighting and occlusion. Disabled if the object is set to receive Global Illumination from lightmaps."); - private GUIContent m_LightProbeVolumeOverrideStyle = EditorGUIUtility.TrTextContent("Proxy Volume Override", "If set, the Renderer will use the Light Probe Proxy Volume component from another GameObject."); - private GUIContent m_ReflectionProbeUsageStyle = EditorGUIUtility.TrTextContent("Reflection Probes", "Specifies if or how the object is affected by reflections in the Scene. This property cannot be disabled in deferred rendering modes."); - private GUIContent m_ProbeAnchorStyle = EditorGUIUtility.TrTextContent("Anchor Override", "Specifies the Transform position that will be used for sampling the light probes and reflection probes."); - private GUIContent m_ProbeAnchorNoReflectionProbesStyle = EditorGUIUtility.TrTextContent("Anchor Override", "Specifies the Transform position that will be used for sampling the light probes."); - private GUIContent m_DeferredNote = EditorGUIUtility.TrTextContent("In Deferred Shading, all objects receive shadows and get per-pixel reflection probes."); - private GUIContent m_LightProbeVolumeNote = EditorGUIUtility.TrTextContent("A valid Light Probe Proxy Volume component could not be found."); - private GUIContent m_LightProbeVolumeUnsupportedNote = EditorGUIUtility.TrTextContent("The Light Probe Proxy Volume feature is unsupported by the current graphics hardware or API configuration. Simple 'Blend Probes' mode will be used instead."); - private GUIContent m_LightProbeVolumeUnsupportedOnTreesNote = EditorGUIUtility.TrTextContent("The Light Probe Proxy Volume feature is not supported on tree rendering. Simple 'Blend Probes' mode will be used instead."); - private GUIContent m_LightProbeCustomNote = EditorGUIUtility.TrTextContent("The Custom Provided mode requires SH properties to be sent via MaterialPropertyBlock."); + private GUIContent m_LightProbeUsageStyle = L10n.TextContent("Light Probes", "Specifies how Light Probes will handle the interpolation of lighting and occlusion. Disabled if the object is set to receive Global Illumination from lightmaps.", null, null); + private GUIContent m_LightProbeVolumeOverrideStyle = L10n.TextContent("Proxy Volume Override", "If set, the Renderer will use the Light Probe Proxy Volume component from another GameObject.", null, null); + private GUIContent m_ReflectionProbeUsageStyle = L10n.TextContent("Reflection Probes", "Specifies if or how the object is affected by reflections in the Scene. This property cannot be disabled in deferred rendering modes.", null, null); + private GUIContent m_ProbeAnchorStyle = L10n.TextContent("Anchor Override", "Specifies the Transform position that will be used for sampling the light probes and reflection probes.", null, null); + private GUIContent m_ProbeAnchorNoReflectionProbesStyle = L10n.TextContent("Anchor Override", "Specifies the Transform position that will be used for sampling the light probes.", null, null); + private GUIContent m_DeferredNote = L10n.TextContent("In Deferred Shading, all objects receive shadows and get per-pixel reflection probes.", null, null, null); + private GUIContent m_LightProbeVolumeNote = L10n.TextContent("A valid Light Probe Proxy Volume component could not be found.", null, null, null); + private GUIContent m_LightProbeVolumeUnsupportedNote = L10n.TextContent("The Light Probe Proxy Volume feature is unsupported by the current graphics hardware or API configuration. Simple 'Blend Probes' mode will be used instead.", null, null, null); + private GUIContent m_LightProbeVolumeUnsupportedOnTreesNote = L10n.TextContent("The Light Probe Proxy Volume feature is not supported on tree rendering. Simple 'Blend Probes' mode will be used instead.", null, null, null); + private GUIContent m_LightProbeCustomNote = L10n.TextContent("The Custom Provided mode requires SH properties to be sent via MaterialPropertyBlock.", null, null, null); private GUIContent[] m_ReflectionProbeUsageOptions = Array.ConvertAll(Enum.GetNames(typeof(ReflectionProbeUsage)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); private GUIContent probeAnchorStyle @@ -327,24 +327,24 @@ internal static string[] GetFieldsStringArray() class Styles { - public static readonly GUIContent materials = EditorGUIUtility.TrTextContent("Materials"); - public static readonly GUIContent probeSettings = EditorGUIUtility.TrTextContent("Probes"); - public static readonly GUIContent otherSettings = EditorGUIUtility.TrTextContent("Additional Settings"); - public static readonly GUIContent meshLodSettings = EditorGUIUtility.TrTextContent("Mesh LOD"); - - public static readonly GUIContent maskInteractionLabel = EditorGUIUtility.TrTextContent("Mask Interaction", "Renderer's interaction with a Sprite Mask"); - public static readonly GUIContent dynamicOcclusion = EditorGUIUtility.TrTextContent("Dynamic Occlusion", "Controls if dynamic occlusion culling should be performed for this renderer."); - public static readonly GUIContent motionVectors = EditorGUIUtility.TrTextContent("Motion Vectors", "Specifies whether the Mesh Renders 'Per Object Motion', 'Camera Motion', or 'No Motion' vectors to the Camera Motion Vector Texture."); - public static readonly GUIContent skinnedMotionVectors = EditorGUIUtility.TrTextContent("Skinned Motion Vectors", "Enabling Skinned Motion Vectors will allow generation of high precision motion vectors for the Skinned Mesh. This is achieved by keeping the skinning results of the previous frame in memory thus increasing the memory usage."); - public static readonly GUIContent renderingLayerMask = EditorGUIUtility.TrTextContent("Rendering Layer Mask", "Mask that can be used with SRP DrawRenderers command to filter renderers outside of the normal layering system."); - public static readonly GUIContent rendererPriority = EditorGUIUtility.TrTextContent("Priority", "Sets the priority value that the render pipeline uses to calculate the rendering order."); - public static readonly GUIContent rayTracingModeStyle = EditorGUIUtility.TrTextContent("Ray Tracing Mode", "Describes how the acceleration structure associated with a renderer will update for ray tracing."); + public static readonly GUIContent materials = L10n.TextContent("Materials", null, null, null); + public static readonly GUIContent probeSettings = L10n.TextContent("Probes", null, null, null); + public static readonly GUIContent otherSettings = L10n.TextContent("Additional Settings", null, null, null); + public static readonly GUIContent meshLodSettings = L10n.TextContent("Mesh LOD", null, null, null); + + public static readonly GUIContent maskInteractionLabel = L10n.TextContent("Mask Interaction", "Renderer's interaction with a Sprite Mask", null, null); + public static readonly GUIContent dynamicOcclusion = L10n.TextContent("Dynamic Occlusion", "Controls if dynamic occlusion culling should be performed for this renderer.", null, null); + public static readonly GUIContent motionVectors = L10n.TextContent("Motion Vectors", "Specifies whether the Mesh Renders 'Per Object Motion', 'Camera Motion', or 'No Motion' vectors to the Camera Motion Vector Texture.", null, null); + public static readonly GUIContent skinnedMotionVectors = L10n.TextContent("Skinned Motion Vectors", "Enabling Skinned Motion Vectors will allow generation of high precision motion vectors for the Skinned Mesh. This is achieved by keeping the skinning results of the previous frame in memory thus increasing the memory usage.", null, null); + public static readonly GUIContent renderingLayerMask = L10n.TextContent("Rendering Layer Mask", "Mask that can be used with SRP DrawRenderers command to filter renderers outside of the normal layering system.", null, null); + public static readonly GUIContent rendererPriority = L10n.TextContent("Priority", "Sets the priority value that the render pipeline uses to calculate the rendering order.", null, null); + public static readonly GUIContent rayTracingModeStyle = L10n.TextContent("Ray Tracing Mode", "Describes how the acceleration structure associated with a renderer will update for ray tracing.", null, null); public static readonly GUIContent[] rayTracingModeOptions = Array.ConvertAll(Enum.GetNames(typeof(RayTracingMode)), x => new GUIContent(ObjectNames.NicifyVariableName(x))); - public static readonly GUIContent rayTracingGeomStyle = EditorGUIUtility.TrTextContent("Procedural Geometry", "Specifies whether to treat geometry as procedurally defined by an intersection shader or as a Mesh."); - public static readonly GUIContent rayTracingAccelStructBuildFlagsStyle = EditorGUIUtility.TrTextContent("Acceleration Structure Build Flags", "Specifies whether this renderer overrides the default build flags that you specified when you created a RayTracingAccelerationStructure."); - public static readonly GUIContent forceMeshLodStyle = EditorGUIUtility.TrTextContent("LOD Override", "Disable automatic LOD selection and set the LOD index to the value in the Override Level property."); - public static readonly GUIContent forcedMeshLodLevelStyle = EditorGUIUtility.TrTextContent("Override Level", "Set the LOD index to this value."); - public static readonly GUIContent meshLodSelectionBiasStyle = EditorGUIUtility.TrTextContent("LOD Selection Bias", "The value that Unity adds to the calculated LOD index. Increasing this value results in Unity selecting less detailed LODs, reducing the value - in more detailed LODs."); + public static readonly GUIContent rayTracingGeomStyle = L10n.TextContent("Procedural Geometry", "Specifies whether to treat geometry as procedurally defined by an intersection shader or as a Mesh.", null, null); + public static readonly GUIContent rayTracingAccelStructBuildFlagsStyle = L10n.TextContent("Acceleration Structure Build Flags", "Specifies whether this renderer overrides the default build flags that you specified when you created a RayTracingAccelerationStructure.", null, null); + public static readonly GUIContent forceMeshLodStyle = L10n.TextContent("LOD Override", "Disable automatic LOD selection and set the LOD index to the value in the Override Level property.", null, null); + public static readonly GUIContent forcedMeshLodLevelStyle = L10n.TextContent("Override Level", "Set the LOD index to this value.", null, null); + public static readonly GUIContent meshLodSelectionBiasStyle = L10n.TextContent("LOD Selection Bias", "The value that Unity adds to the calculated LOD index. Increasing this value results in Unity selecting less detailed LODs, reducing the value - in more detailed LODs.", null, null); } private bool m_IsPrefab; diff --git a/Editor/Mono/Inspector/RendererLightingSettings.cs b/Editor/Mono/Inspector/RendererLightingSettings.cs index 46f560f548..79cf39dca0 100644 --- a/Editor/Mono/Inspector/RendererLightingSettings.cs +++ b/Editor/Mono/Inspector/RendererLightingSettings.cs @@ -16,76 +16,76 @@ internal class RendererLightingSettings { static class Styles { - public static readonly GUIContent optimizeRealtimeUVs = EditorGUIUtility.TrTextContent("Optimize Realtime UVs", "Specifies whether the authored mesh UVs get optimized for Realtime Global Illumination or not. When enabled, the authored UVs can get merged, and are scaled and packed for optimization purposes. When disabled, the authored UVs are scaled and packed, but not merged."); - public static readonly GUIContent ignoreNormalsForChartDetection = EditorGUIUtility.TrTextContent("Ignore Normals", "When enabled, prevents the UV charts from being split during the precompute process for Realtime Global Illumination lighting."); + public static readonly GUIContent optimizeRealtimeUVs = L10n.TextContent("Optimize Realtime UVs", "Specifies whether the authored mesh UVs get optimized for Realtime Global Illumination or not. When enabled, the authored UVs can get merged, and are scaled and packed for optimization purposes. When disabled, the authored UVs are scaled and packed, but not merged.", null, null); + public static readonly GUIContent ignoreNormalsForChartDetection = L10n.TextContent("Ignore Normals", "When enabled, prevents the UV charts from being split during the precompute process for Realtime Global Illumination lighting.", null, null); public static readonly int[] minimumChartSizeValues = { 2, 4 }; public static readonly GUIContent[] minimumChartSizeStrings = { - EditorGUIUtility.TrTextContent("2 (Minimum)"), - EditorGUIUtility.TrTextContent("4 (Stitchable)"), + L10n.TextContent("2 (Minimum)", null, null, null), + L10n.TextContent("4 (Stitchable)", null, null, null), }; public static readonly int[] receiveGILightmapValues = { (int)ReceiveGI.Lightmaps, (int)ReceiveGI.LightProbes }; public static readonly GUIContent[] receiveGILightmapStrings = { - EditorGUIUtility.TrTextContent("Lightmaps"), - EditorGUIUtility.TrTextContent("Light Probes") + L10n.TextContent("Lightmaps", null, null, null), + L10n.TextContent("Light Probes", null, null, null) }; - public static readonly GUIContent lightingSettings = EditorGUIUtility.TrTextContent("Lighting"); - public static readonly GUIContent lighting = new GUIContent(EditorGUIUtility.TrTextContent("Lighting").text); // prevent the Lighting window icon from being added - public static readonly GUIContent minimumChartSize = EditorGUIUtility.TrTextContent("Min Chart Size", "Specifies the minimum texel size used for a UV chart. If stitching is required, a value of 4 will create a chart of 4x4 texels to store lighting and directionality. If stitching is not required, a value of 2 will reduce the texel density and provide better lighting build times and run time performance."); - public static readonly GUIContent importantGI = EditorGUIUtility.TrTextContent("Prioritize Illumination", "When enabled, the object will be marked as a priority object and always included in lighting calculations. Useful for objects that will be strongly emissive to make sure that other objects will be illuminated by this object."); - public static readonly GUIContent stitchLightmapSeams = EditorGUIUtility.TrTextContent("Stitch Seams", "When enabled, seams in baked lightmaps will get smoothed."); - public static readonly GUIContent autoUVMaxDistance = EditorGUIUtility.TrTextContent("Max Distance", "Specifies the maximum worldspace distance to be used for UV chart simplification. If charts are within this distance, they will be simplified for optimization purposes."); - public static readonly GUIContent autoUVMaxAngle = EditorGUIUtility.TrTextContent("Max Angle", "Specifies the maximum angle in degrees between faces sharing a UV edge. If the angle between the faces is below this value, the UV charts will be simplified."); - public static readonly GUIContent lightmapParameters = EditorGUIUtility.TrTextContent("Lightmap Parameters", "Allows the adjustment of advanced parameters that affect the process of generating a lightmap for an object using global illumination."); - public static readonly GUIContent atlasTilingX = EditorGUIUtility.TrTextContent("Tiling X"); - public static readonly GUIContent atlasTilingY = EditorGUIUtility.TrTextContent("Tiling Y"); - public static readonly GUIContent atlasOffsetX = EditorGUIUtility.TrTextContent("Offset X"); - public static readonly GUIContent atlasOffsetY = EditorGUIUtility.TrTextContent("Offset Y"); - public static readonly GUIContent clampedSize = EditorGUIUtility.TrTextContent("Object's size in lightmap has reached the max atlas size.", "If you need higher resolution for this object, divide it into smaller meshes or set higher max atlas size via the LightingSettings class."); - public static readonly GUIContent clampedPackingResolution = EditorGUIUtility.TrTextContent("Object's size in the realtime lightmap has reached the maximum size. If you need higher resolution for this object, divide it into smaller meshes."); - public static readonly GUIContent zeroAreaPackingMesh = EditorGUIUtility.TrTextContent("Mesh used by the renderer has zero UV or surface area. Non zero area is required for lightmapping."); - public static readonly GUIContent noNormalsNoLightmapping = EditorGUIUtility.TrTextContent("Mesh used by the renderer doesn't have normals. Normals are needed for lightmapping."); - public static readonly GUIContent noVerticesNoLightmapping = EditorGUIUtility.TrTextContent("Mesh used by the renderer doesn't have vertices. Vertices are needed for lightmapping."); - public static readonly GUIContent unsupportedTopology = EditorGUIUtility.TrTextContent("Mesh with point, strip or line topology is not supported by lightmapping."); - public static readonly GUIContent uvOverlap = EditorGUIUtility.TrTextContent("This GameObject has overlapping UVs. Please adjust Mesh Importer settings or increase chart padding in your modeling package."); - public static readonly GUIContent atlas = EditorGUIUtility.TrTextContent("Baked Lightmap"); - public static readonly GUIContent interactiveAtlas = EditorGUIUtility.TrTextContent("Preview Lightmap"); - public static readonly GUIContent realtimeLM = EditorGUIUtility.TrTextContent("Realtime Lightmap"); - public static readonly GUIContent scaleInLightmap = EditorGUIUtility.TrTextContent("Scale In Lightmap", "Specifies the relative size of object's UVs within a lightmap. A value of 0 will result in the object not being lightmapped, but still contribute lighting to other objects in the Scene."); - public static readonly GUIContent albedoScale = EditorGUIUtility.TrTextContent("Albedo Scale", "Specifies the relative size of object's UVs within its albedo texture that is used when calculating the influence on surrounding objects."); - public static readonly GUIContent atlasIndex = EditorGUIUtility.TrTextContent("Lightmap Index"); - public static readonly GUIContent lightmapResolution = EditorGUIUtility.TrTextContent("Lightmap Resolution"); - public static readonly GUIContent lightmapObjectScale = EditorGUIUtility.TrTextContent("Lightmap Object Scale"); - public static readonly GUIContent pvrInstanceHash = EditorGUIUtility.TrTextContent("Instance Hash", "The hash of the baked GI instance."); - public static readonly GUIContent pvrAtlasHash = EditorGUIUtility.TrTextContent("Atlas Hash", "The hash of the atlas this baked GI instance is a part of."); - public static readonly GUIContent pvrAtlasInstanceOffset = EditorGUIUtility.TrTextContent("Atlas Instance Offset", "The offset into the transform array instances of this atlas start at."); - public static readonly GUIContent realtimeLMResolution = EditorGUIUtility.TrTextContent("System Resolution", "The resolution in texels of the realtime lightmap that this renderer belongs to."); - public static readonly GUIContent realtimeLMInstanceResolution = EditorGUIUtility.TrTextContent("Instance Resolution", "The resolution in texels of the realtime lightmap packed instance."); - public static readonly GUIContent realtimeLMInputSystemHash = EditorGUIUtility.TrTextContent("System Hash", "The hash of the realtime system that the renderer belongs to."); - public static readonly GUIContent realtimeLMInstanceHash = EditorGUIUtility.TrTextContent("Instance Hash", "The hash of the realtime GI instance."); - public static readonly GUIContent realtimeLMGeometryHash = EditorGUIUtility.TrTextContent("Geometry Hash", "The hash of the realtime GI geometry that the renderer is using."); - public static readonly GUIContent uvCharting = EditorGUIUtility.TrTextContent("Realtime UVs"); - public static readonly GUIContent lightmapSettings = EditorGUIUtility.TrTextContent("Lightmapping"); - public static readonly GUIContent castShadows = EditorGUIUtility.TrTextContent("Cast Shadows", "Specifies whether a geometry creates shadows or not when a shadow-casting Light shines on it."); - public static readonly GUIContent receiveShadows = EditorGUIUtility.TrTextContent("Receive Shadows", "When enabled, any shadows cast from other objects are drawn on the geometry."); - public static readonly GUIContent staticShadowCaster = EditorGUIUtility.TrTextContent("Static Shadow Caster", "When enabled, Unity considers this renderer as being static for the sake of shadow rendering. If the SRP implements cached shadow maps, this field indicates to the render pipeline what renderers are considered static and what renderers are considered dynamic."); - public static readonly GUIContent shadowBias = EditorGUIUtility.TrTextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the trail width at each segment."); - public static readonly GUIContent contributeGI = EditorGUIUtility.TrTextContent("Contribute Global Illumination", "When enabled, this GameObject influences lightmaps and Light Probes. If you want this object itself to be lightmapped, you must enable this property."); - public static readonly GUIContent receiveGITitle = EditorGUIUtility.TrTextContent("Receive Global Illumination", "If enabled, this GameObject receives global illumination from lightmaps or Light Probes. To use lightmaps, Contribute Global Illumination must be enabled."); - public static readonly GUIContent lightmapParametersDefault = EditorGUIUtility.TrTextContent("Scene Default Parameters"); - public static readonly GUIContent globalIlluminationMeshLod = EditorGUIUtility.TrTextContent("Mesh LOD for Global Illumination", "The Mesh LOD index to use for Global Illumination."); - public static readonly GUIContent resolutionTooHighWarning = EditorGUIUtility.TrTextContent("Precompute/indirect resolution for this terrain is probably too high. Use a lower realtime/indirect resolution setting in the Lighting window or assign LightmapParameters that use a lower resolution setting. Otherwise it may take a very long time to bake and memory consumption during and after the bake may be very high."); - public static readonly GUIContent resolutionTooLowWarning = EditorGUIUtility.TrTextContent("Precompute/indirect resolution for this terrain is probably too low. If the Clustering stage takes a long time, try using a higher realtime/indirect resolution setting in the Lighting window or assign LightmapParameters that use a higher resolution setting."); - public static readonly GUIContent giNotEnabledInfo = EditorGUIUtility.TrTextContent("Lightmapping settings are currently disabled. Enable Baked Global Illumination or Realtime Global Illumination to display these settings."); - public static readonly GUIContent terrainProbeNotSupported = EditorGUIUtility.TrTextContent("Legacy Light Probes are enabled in the Project's Render Pipeline. These are not supported by Terrain, therefore the Scene's Ambient Probe will be used instead."); - public static readonly GUIContent isPresetInfo = EditorGUIUtility.TrTextContent("The Contribute Global Illumination property cannot be stored in a preset."); - public static readonly GUIContent giMeshNotValid = EditorGUIUtility.TrTextContent("It is not possible to generate lighting for this Mesh because it is missing the required attribute(s). Ensure that this Mesh has normals, vertices, and texture coordinates."); - public static readonly GUIContent giMeshNotValidMultiple = EditorGUIUtility.TrTextContent("It is not possible to generate lighting for these Meshes because one or more of them are missing the required attribute(s). Ensure that all the Meshes you've selected have normals, vertices, and texture coordinates."); - - public static readonly GUIContent openPreview = EditorGUIUtility.TrTextContent("View"); + public static readonly GUIContent lightingSettings = L10n.TextContent("Lighting", null, null, null); + public static readonly GUIContent lighting = new GUIContent(L10n.TextContent("Lighting", null, null, null).text); // prevent the Lighting window icon from being added + public static readonly GUIContent minimumChartSize = L10n.TextContent("Min Chart Size", "Specifies the minimum texel size used for a UV chart. If stitching is required, a value of 4 will create a chart of 4x4 texels to store lighting and directionality. If stitching is not required, a value of 2 will reduce the texel density and provide better lighting build times and run time performance.", null, null); + public static readonly GUIContent importantGI = L10n.TextContent("Prioritize Illumination", "When enabled, the object will be marked as a priority object and always included in lighting calculations. Useful for objects that will be strongly emissive to make sure that other objects will be illuminated by this object.", null, null); + public static readonly GUIContent stitchLightmapSeams = L10n.TextContent("Stitch Seams", "When enabled, seams in baked lightmaps will get smoothed.", null, null); + public static readonly GUIContent autoUVMaxDistance = L10n.TextContent("Max Distance", "Specifies the maximum worldspace distance to be used for UV chart simplification. If charts are within this distance, they will be simplified for optimization purposes.", null, null); + public static readonly GUIContent autoUVMaxAngle = L10n.TextContent("Max Angle", "Specifies the maximum angle in degrees between faces sharing a UV edge. If the angle between the faces is below this value, the UV charts will be simplified.", null, null); + public static readonly GUIContent lightmapParameters = L10n.TextContent("Lightmap Parameters", "Allows the adjustment of advanced parameters that affect the process of generating a lightmap for an object using global illumination.", null, null); + public static readonly GUIContent atlasTilingX = L10n.TextContent("Tiling X", null, null, null); + public static readonly GUIContent atlasTilingY = L10n.TextContent("Tiling Y", null, null, null); + public static readonly GUIContent atlasOffsetX = L10n.TextContent("Offset X", null, null, null); + public static readonly GUIContent atlasOffsetY = L10n.TextContent("Offset Y", null, null, null); + public static readonly GUIContent clampedSize = L10n.TextContent("Object's size in lightmap has reached the max atlas size.", "If you need higher resolution for this object, divide it into smaller meshes or set higher max atlas size via the LightingSettings class.", null, null); + public static readonly GUIContent clampedPackingResolution = L10n.TextContent("Object's size in the realtime lightmap has reached the maximum size. If you need higher resolution for this object, divide it into smaller meshes.", null, null, null); + public static readonly GUIContent zeroAreaPackingMesh = L10n.TextContent("Mesh used by the renderer has zero UV or surface area. Non zero area is required for lightmapping.", null, null, null); + public static readonly GUIContent noNormalsNoLightmapping = L10n.TextContent("Mesh used by the renderer doesn't have normals. Normals are needed for lightmapping.", null, null, null); + public static readonly GUIContent noVerticesNoLightmapping = L10n.TextContent("Mesh used by the renderer doesn't have vertices. Vertices are needed for lightmapping.", null, null, null); + public static readonly GUIContent unsupportedTopology = L10n.TextContent("Mesh with point, strip or line topology is not supported by lightmapping.", null, null, null); + public static readonly GUIContent uvOverlap = L10n.TextContent("This GameObject has overlapping UVs. Please adjust Mesh Importer settings or increase chart padding in your modeling package.", null, null, null); + public static readonly GUIContent atlas = L10n.TextContent("Baked Lightmap", null, null, null); + public static readonly GUIContent interactiveAtlas = L10n.TextContent("Preview Lightmap", null, null, null); + public static readonly GUIContent realtimeLM = L10n.TextContent("Realtime Lightmap", null, null, null); + public static readonly GUIContent scaleInLightmap = L10n.TextContent("Scale In Lightmap", "Specifies the relative size of object's UVs within a lightmap. A value of 0 will result in the object not being lightmapped, but still contribute lighting to other objects in the Scene.", null, null); + public static readonly GUIContent albedoScale = L10n.TextContent("Albedo Scale", "Specifies the relative size of object's UVs within its albedo texture that is used when calculating the influence on surrounding objects.", null, null); + public static readonly GUIContent atlasIndex = L10n.TextContent("Lightmap Index", null, null, null); + public static readonly GUIContent lightmapResolution = L10n.TextContent("Lightmap Resolution", null, null, null); + public static readonly GUIContent lightmapObjectScale = L10n.TextContent("Lightmap Object Scale", null, null, null); + public static readonly GUIContent pvrInstanceHash = L10n.TextContent("Instance Hash", "The hash of the baked GI instance.", null, null); + public static readonly GUIContent pvrAtlasHash = L10n.TextContent("Atlas Hash", "The hash of the atlas this baked GI instance is a part of.", null, null); + public static readonly GUIContent pvrAtlasInstanceOffset = L10n.TextContent("Atlas Instance Offset", "The offset into the transform array instances of this atlas start at.", null, null); + public static readonly GUIContent realtimeLMResolution = L10n.TextContent("System Resolution", "The resolution in texels of the realtime lightmap that this renderer belongs to.", null, null); + public static readonly GUIContent realtimeLMInstanceResolution = L10n.TextContent("Instance Resolution", "The resolution in texels of the realtime lightmap packed instance.", null, null); + public static readonly GUIContent realtimeLMInputSystemHash = L10n.TextContent("System Hash", "The hash of the realtime system that the renderer belongs to.", null, null); + public static readonly GUIContent realtimeLMInstanceHash = L10n.TextContent("Instance Hash", "The hash of the realtime GI instance.", null, null); + public static readonly GUIContent realtimeLMGeometryHash = L10n.TextContent("Geometry Hash", "The hash of the realtime GI geometry that the renderer is using.", null, null); + public static readonly GUIContent uvCharting = L10n.TextContent("Realtime UVs", null, null, null); + public static readonly GUIContent lightmapSettings = L10n.TextContent("Lightmapping", null, null, null); + public static readonly GUIContent castShadows = L10n.TextContent("Cast Shadows", "Specifies whether a geometry creates shadows or not when a shadow-casting Light shines on it.", null, null); + public static readonly GUIContent receiveShadows = L10n.TextContent("Receive Shadows", "When enabled, any shadows cast from other objects are drawn on the geometry.", null, null); + public static readonly GUIContent staticShadowCaster = L10n.TextContent("Static Shadow Caster", "When enabled, Unity considers this renderer as being static for the sake of shadow rendering. If the SRP implements cached shadow maps, this field indicates to the render pipeline what renderers are considered static and what renderers are considered dynamic.", null, null); + public static readonly GUIContent shadowBias = L10n.TextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the trail width at each segment.", null, null); + public static readonly GUIContent contributeGI = L10n.TextContent("Contribute Global Illumination", "When enabled, this GameObject influences lightmaps and Light Probes. If you want this object itself to be lightmapped, you must enable this property.", null, null); + public static readonly GUIContent receiveGITitle = L10n.TextContent("Receive Global Illumination", "If enabled, this GameObject receives global illumination from lightmaps or Light Probes. To use lightmaps, Contribute Global Illumination must be enabled.", null, null); + public static readonly GUIContent lightmapParametersDefault = L10n.TextContent("Scene Default Parameters", null, null, null); + public static readonly GUIContent globalIlluminationMeshLod = L10n.TextContent("Mesh LOD for Global Illumination", "The Mesh LOD index to use for Global Illumination.", null, null); + public static readonly GUIContent resolutionTooHighWarning = L10n.TextContent("Precompute/indirect resolution for this terrain is probably too high. Use a lower realtime/indirect resolution setting in the Lighting window or assign LightmapParameters that use a lower resolution setting. Otherwise it may take a very long time to bake and memory consumption during and after the bake may be very high.", null, null, null); + public static readonly GUIContent resolutionTooLowWarning = L10n.TextContent("Precompute/indirect resolution for this terrain is probably too low. If the Clustering stage takes a long time, try using a higher realtime/indirect resolution setting in the Lighting window or assign LightmapParameters that use a higher resolution setting.", null, null, null); + public static readonly GUIContent giNotEnabledInfo = L10n.TextContent("Lightmapping settings are currently disabled. Enable Baked Global Illumination or Realtime Global Illumination to display these settings.", null, null, null); + public static readonly GUIContent terrainProbeNotSupported = L10n.TextContent("Legacy Light Probes are enabled in the Project's Render Pipeline. These are not supported by Terrain, therefore the Scene's Ambient Probe will be used instead.", null, null, null); + public static readonly GUIContent isPresetInfo = L10n.TextContent("The Contribute Global Illumination property cannot be stored in a preset.", null, null, null); + public static readonly GUIContent giMeshNotValid = L10n.TextContent("It is not possible to generate lighting for this Mesh because it is missing the required attribute(s). Ensure that this Mesh has normals, vertices, and texture coordinates.", null, null, null); + public static readonly GUIContent giMeshNotValidMultiple = L10n.TextContent("It is not possible to generate lighting for these Meshes because one or more of them are missing the required attribute(s). Ensure that all the Meshes you've selected have normals, vertices, and texture coordinates.", null, null, null); + + public static readonly GUIContent openPreview = L10n.TextContent("View", null, null, null); public static readonly GUIStyle openPreviewStyle = EditorStyles.objectFieldThumb.name + "LightmapPreviewOverlay"; public static readonly int previewPadding = 30; public static readonly int previewWidth = 104; diff --git a/Editor/Mono/Inspector/ReorderableListWrapper.cs b/Editor/Mono/Inspector/ReorderableListWrapper.cs index 3c79627858..d698b619b2 100644 --- a/Editor/Mono/Inspector/ReorderableListWrapper.cs +++ b/Editor/Mono/Inspector/ReorderableListWrapper.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: InspectorFramework not yet converted using System; using System.Linq; using UnityEditor; @@ -256,4 +255,3 @@ void DrawChildren(Rect listRect, Rect headerRect, Rect sizeRect, Rect visibleRec } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/RotationConstraintEditor.cs b/Editor/Mono/Inspector/RotationConstraintEditor.cs index 2187571aa4..59d3fd2844 100644 --- a/Editor/Mono/Inspector/RotationConstraintEditor.cs +++ b/Editor/Mono/Inspector/RotationConstraintEditor.cs @@ -28,10 +28,10 @@ internal class RotationConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_RotationAtRest = EditorGUIUtility.TrTextContent("Rotation At Rest"); - GUIContent m_RotationOffset = EditorGUIUtility.TrTextContent("Rotation Offset"); + GUIContent m_RotationAtRest = L10n.TextContent("Rotation At Rest", null, null, null); + GUIContent m_RotationOffset = L10n.TextContent("Rotation Offset", null, null, null); - GUIContent m_RotationAxes = EditorGUIUtility.TrTextContent("Freeze Rotation Axes"); + GUIContent m_RotationAxes = L10n.TextContent("Freeze Rotation Axes", null, null, null); public override GUIContent AtRest { get { return m_RotationAtRest; } } public override GUIContent Offset { get { return m_RotationOffset; } } diff --git a/Editor/Mono/Inspector/ScaleConstraintEditor.cs b/Editor/Mono/Inspector/ScaleConstraintEditor.cs index 7f9c4e6e18..85018c36d1 100644 --- a/Editor/Mono/Inspector/ScaleConstraintEditor.cs +++ b/Editor/Mono/Inspector/ScaleConstraintEditor.cs @@ -28,10 +28,10 @@ internal class ScaleConstraintEditor : ConstraintEditorBase private class Styles : ConstraintStyleBase { - GUIContent m_ScaleAtRest = EditorGUIUtility.TrTextContent("Scale At Rest"); - GUIContent m_ScaleOffset = EditorGUIUtility.TrTextContent("Scale Offset"); + GUIContent m_ScaleAtRest = L10n.TextContent("Scale At Rest", null, null, null); + GUIContent m_ScaleOffset = L10n.TextContent("Scale Offset", null, null, null); - GUIContent m_ScalingAxes = EditorGUIUtility.TrTextContent("Freeze Scaling Axes"); + GUIContent m_ScalingAxes = L10n.TextContent("Freeze Scaling Axes", null, null, null); public override GUIContent AtRest { get { return m_ScaleAtRest; } } public override GUIContent Offset { get { return m_ScaleOffset; } } diff --git a/Editor/Mono/Inspector/ScriptExecutionOrderInspector.cs b/Editor/Mono/Inspector/ScriptExecutionOrderInspector.cs index 6438911d73..27818a581f 100644 --- a/Editor/Mono/Inspector/ScriptExecutionOrderInspector.cs +++ b/Editor/Mono/Inspector/ScriptExecutionOrderInspector.cs @@ -92,11 +92,11 @@ public override int Compare(MonoScript x, MonoScript y) public class Content { - public static readonly GUIContent helpText = EditorGUIUtility.TrTextContent("Add scripts to the custom order and drag them to reorder.\n\nScripts in the custom order can execute before or after the default time and are executed from top to bottom. All other scripts execute at the default time in the order they are loaded.\n\n(Changing the order of a script may modify the meta data for more than one script.)"); - public static readonly GUIContent iconToolbarPlus = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add script to custom order"); - public static readonly GUIContent iconToolbarMinus = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove script from custom order"); - public static readonly GUIContent defaultTimeContent = EditorGUIUtility.TrTextContent("Default Time", "All scripts not in the custom order are executed at the default time."); - public static readonly GUIContent[] emptyMenuOptions = { EditorGUIUtility.TrTextContent("Empty") }; + public static readonly GUIContent helpText = L10n.TextContent("Add scripts to the custom order and drag them to reorder.\n\nScripts in the custom order can execute before or after the default time and are executed from top to bottom. All other scripts execute at the default time in the order they are loaded.\n\n(Changing the order of a script may modify the meta data for more than one script.)", null, null, null); + public static readonly GUIContent iconToolbarPlus = L10n.IconContent("Toolbar Plus", "Add script to custom order", null); + public static readonly GUIContent iconToolbarMinus = L10n.IconContent("Toolbar Minus", "Remove script from custom order", null); + public static readonly GUIContent defaultTimeContent = L10n.TextContent("Default Time", "All scripts not in the custom order are executed at the default time.", null, null); + public static readonly GUIContent[] emptyMenuOptions = { L10n.TextContent("Empty", null, null, null) }; } public static class Styles diff --git a/Editor/Mono/Inspector/ShaderImporterInspector.cs b/Editor/Mono/Inspector/ShaderImporterInspector.cs index fa9a5c7640..a578921dff 100644 --- a/Editor/Mono/Inspector/ShaderImporterInspector.cs +++ b/Editor/Mono/Inspector/ShaderImporterInspector.cs @@ -18,7 +18,7 @@ internal class ShaderImporterInspector : AssetImporterEditor { internal class Styles { - public static readonly GUIContent overridePreprocessor = EditorGUIUtility.TrTextContent("Override preprocessor", "Select preprocessor to use for this shader."); + public static readonly GUIContent overridePreprocessor = L10n.TextContent("Override preprocessor", "Select preprocessor to use for this shader.", null, null); } [Serializable] diff --git a/Editor/Mono/Inspector/ShaderInspector.cs b/Editor/Mono/Inspector/ShaderInspector.cs index 23c2ee1bfd..bbb7be34d9 100644 --- a/Editor/Mono/Inspector/ShaderInspector.cs +++ b/Editor/Mono/Inspector/ShaderInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ShaderSystem not yet converted using System; using UnityEngine; using System.Collections.Generic; @@ -52,21 +51,21 @@ internal class Styles public static readonly Texture2D errorIcon = EditorGUIUtility.LoadIcon("console.erroricon.sml"); public static readonly Texture2D warningIcon = EditorGUIUtility.LoadIcon("console.warnicon.sml"); - public static readonly GUIContent togglePreprocess = EditorGUIUtility.TrTextContent("Preprocess only", "Show preprocessor output instead of compiled shader code"); - public static readonly GUIContent toggleStripLineDirective = EditorGUIUtility.TrTextContent("Strip #line directives", "Strip #line directives from preprocessor output"); - public static readonly GUIContent showSurface = EditorGUIUtility.TrTextContent("Show generated code", "Show generated code of a surface shader"); - public static readonly GUIContent showFF = EditorGUIUtility.TrTextContent("Show generated code", "Show generated code of a fixed function shader"); - public static readonly GUIContent showCurrent = EditorGUIUtility.TrTextContent("Compile and show code \u007C \u25BE"); // vertical bar & dropdow arrow - due to lacking editor style of "mini button with a dropdown" - public static readonly GUIContent overridableKeywords = EditorGUIUtility.TrTextContent("Overridable", "Shader keywords overridable by global shader keyword state"); - public static readonly GUIContent notOverridableKeywords = EditorGUIUtility.TrTextContent("Not overridable", "Shader keywords not overridable by global shader keyword state"); + public static readonly GUIContent togglePreprocess = L10n.TextContent("Preprocess only", "Show preprocessor output instead of compiled shader code", null, null); + public static readonly GUIContent toggleStripLineDirective = L10n.TextContent("Strip #line directives", "Strip #line directives from preprocessor output", null, null); + public static readonly GUIContent showSurface = L10n.TextContent("Show generated code", "Show generated code of a surface shader", null, null); + public static readonly GUIContent showFF = L10n.TextContent("Show generated code", "Show generated code of a fixed function shader", null, null); + public static readonly GUIContent showCurrent = L10n.TextContent("Compile and show code \u007C \u25BE", null, null, null); // vertical bar & dropdow arrow - due to lacking editor style of "mini button with a dropdown" + public static readonly GUIContent overridableKeywords = L10n.TextContent("Overridable", "Shader keywords overridable by global shader keyword state", null, null); + public static readonly GUIContent notOverridableKeywords = L10n.TextContent("Not overridable", "Shader keywords not overridable by global shader keyword state", null, null); public static readonly GUIStyle messageStyle = "CN StatusInfo"; public static readonly GUIStyle evenBackground = "CN EntryBackEven"; - public static readonly GUIContent no = EditorGUIUtility.TrTextContent("no"); - public static readonly GUIContent builtinShader = EditorGUIUtility.TrTextContent("Built-in shader"); + public static readonly GUIContent no = L10n.TextContent("no", null, null, null); + public static readonly GUIContent builtinShader = L10n.TextContent("Built-in shader", null, null, null); - public static readonly GUIContent arrayValuePopupButton = EditorGUIUtility.TrTextContent("..."); + public static readonly GUIContent arrayValuePopupButton = L10n.TextContent("...", null, null, null); } static readonly int kErrorViewHash = "ShaderErrorView".GetHashCode(); @@ -326,7 +325,7 @@ internal static void ShaderErrorListUI(Object shader, ShaderMessage[] messages, // need to copy current value to be used in delegate // (C# closures close over variables, not their values) var errorIndex = i; - menu.AddItem(EditorGUIUtility.TrTextContent("Copy error text"), false, delegate { + menu.AddItem(L10n.TextContent("Copy error text", null, null, null), false, delegate { string errMsg = messages[errorIndex].message; if (!string.IsNullOrEmpty(messages[errorIndex].messageDetails)) { @@ -802,4 +801,3 @@ void DoShaderVariants(EditorWindow caller, ref Rect drawPos) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs b/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs index abdee6ffed..e6e9606c57 100644 --- a/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs +++ b/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ShaderSystem not yet converted using UnityEngine; using System.Collections.Generic; @@ -13,8 +12,8 @@ internal class ShaderVariantCollectionInspector : Editor { private class Styles { - public static readonly GUIContent iconAdd = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add variant"); - public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove entry"); + public static readonly GUIContent iconAdd = L10n.IconContent("Toolbar Plus", "Add variant", null); + public static readonly GUIContent iconRemove = L10n.IconContent("Toolbar Minus", "Remove entry", null); public static readonly GUIStyle invisibleButton = "InvisibleButton"; } @@ -392,4 +391,3 @@ private void Draw(Rect windowRect) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/SkinnedMeshRendererEditor.cs b/Editor/Mono/Inspector/SkinnedMeshRendererEditor.cs index 4b8902fdbb..e144a72a9a 100644 --- a/Editor/Mono/Inspector/SkinnedMeshRendererEditor.cs +++ b/Editor/Mono/Inspector/SkinnedMeshRendererEditor.cs @@ -16,13 +16,13 @@ internal class SkinnedMeshRendererEditor : RendererEditorBase { protected class Styles { - public static readonly GUIContent legacyClampBlendShapeWeightsInfo = EditorGUIUtility.TrTextContent("Note that BlendShape weight range is clamped. This can be disabled in Player Settings."); - public static readonly GUIContent meshNotSupportingSkinningInfo = EditorGUIUtility.TrTextContent("The assigned mesh is missing either bone weights with bind pose, or blend shapes. This might cause the mesh not to render in the Player. If your mesh does not have either bone weights with bind pose, or blend shapes, use a Mesh Renderer instead of Skinned Mesh Renderer."); - public static readonly GUIContent bounds = EditorGUIUtility.TrTextContent("Bounds", "The bounding box that encapsulates the mesh."); - public static readonly GUIContent quality = EditorGUIUtility.TrTextContent("Quality", "Number of bones to use per vertex during skinning."); - public static readonly GUIContent updateWhenOffscreen = EditorGUIUtility.TrTextContent("Update When Offscreen", "If an accurate bounding volume representation should be calculated every frame. "); - public static readonly GUIContent mesh = EditorGUIUtility.TrTextContent("Mesh", "The mesh used by this renderer."); - public static readonly GUIContent rootBone = EditorGUIUtility.TrTextContent("Root Bone", "Transform with which the bounds move, and the space in which skinning is computed."); + public static readonly GUIContent legacyClampBlendShapeWeightsInfo = L10n.TextContent("Note that BlendShape weight range is clamped. This can be disabled in Player Settings.", null, null, null); + public static readonly GUIContent meshNotSupportingSkinningInfo = L10n.TextContent("The assigned mesh is missing either bone weights with bind pose, or blend shapes. This might cause the mesh not to render in the Player. If your mesh does not have either bone weights with bind pose, or blend shapes, use a Mesh Renderer instead of Skinned Mesh Renderer.", null, null, null); + public static readonly GUIContent bounds = L10n.TextContent("Bounds", "The bounding box that encapsulates the mesh.", null, null); + public static readonly GUIContent quality = L10n.TextContent("Quality", "Number of bones to use per vertex during skinning.", null, null); + public static readonly GUIContent updateWhenOffscreen = L10n.TextContent("Update When Offscreen", "If an accurate bounding volume representation should be calculated every frame. ", null, null); + public static readonly GUIContent mesh = L10n.TextContent("Mesh", "The mesh used by this renderer.", null, null); + public static readonly GUIContent rootBone = L10n.TextContent("Root Bone", "Transform with which the bounds move, and the space in which skinning is computed.", null, null); } private SerializedProperty m_AABB; diff --git a/Editor/Mono/Inspector/SkyboxPanoramicShaderGUI.cs b/Editor/Mono/Inspector/SkyboxPanoramicShaderGUI.cs index 7c1b9783fe..17c29120fa 100644 --- a/Editor/Mono/Inspector/SkyboxPanoramicShaderGUI.cs +++ b/Editor/Mono/Inspector/SkyboxPanoramicShaderGUI.cs @@ -18,9 +18,9 @@ class Styles public static GUIContent Get3DLayoutContent(MaterialProperty property) { if (s_Stereo3DLayoutContent == null) - s_Stereo3DLayoutContent = EditorGUIUtility.TrTextContent( + s_Stereo3DLayoutContent = L10n.TextContent( property.displayName, - "Layout of 3D content in the source. Only meaningful when stereoscopic render is used."); + "Layout of 3D content in the source. Only meaningful when stereoscopic render is used.", null, null); return s_Stereo3DLayoutContent; } diff --git a/Editor/Mono/Inspector/SortingGroupEditor.cs b/Editor/Mono/Inspector/SortingGroupEditor.cs index 8380277af6..2d64b44a79 100644 --- a/Editor/Mono/Inspector/SortingGroupEditor.cs +++ b/Editor/Mono/Inspector/SortingGroupEditor.cs @@ -14,8 +14,8 @@ internal class SortingGroupEditor : Editor { private static class Styles { - public static readonly GUIContent m_SortAtRootStyle = EditorGUIUtility.TrTextContent("Sort At Root" - , "Ignores all parent Sorting Groups and sorts at the root level against other Sorting Groups and Renderers"); + public static readonly GUIContent m_SortAtRootStyle = L10n.TextContent("Sort At Root" + , "Ignores all parent Sorting Groups and sorts at the root level against other Sorting Groups and Renderers", null, null); } diff --git a/Editor/Mono/Inspector/SortingLayerEditorUtility.cs b/Editor/Mono/Inspector/SortingLayerEditorUtility.cs index 7842703fd4..52692bb9ec 100644 --- a/Editor/Mono/Inspector/SortingLayerEditorUtility.cs +++ b/Editor/Mono/Inspector/SortingLayerEditorUtility.cs @@ -16,8 +16,8 @@ private static class Styles [NoAutoStaticsCleanup] // lazily built from EditorStyles.popup (a GUIStyle); rebuilt on demand and safe to persist private static GUIStyle m_BoldPopupStyle; - public static readonly GUIContent m_SortingLayerStyle = EditorGUIUtility.TrTextContent("Sorting Layer", "Name of the Renderer's sorting layer"); - public static readonly GUIContent m_SortingOrderStyle = EditorGUIUtility.TrTextContent("Order in Layer", "Renderer's order within a sorting layer"); + public static readonly GUIContent m_SortingLayerStyle = L10n.TextContent("Sorting Layer", "Name of the Renderer's sorting layer", null, null); + public static readonly GUIContent m_SortingOrderStyle = L10n.TextContent("Order in Layer", "Renderer's order within a sorting layer", null, null); public static GUIStyle boldPopupStyle { diff --git a/Editor/Mono/Inspector/SpeedTree8ShaderGUI.cs b/Editor/Mono/Inspector/SpeedTree8ShaderGUI.cs index 4c3a7b2a7e..5fa609742e 100644 --- a/Editor/Mono/Inspector/SpeedTree8ShaderGUI.cs +++ b/Editor/Mono/Inspector/SpeedTree8ShaderGUI.cs @@ -12,27 +12,27 @@ internal class SpeedTree8ShaderGUI : ShaderGUI { private static class Styles { - public static readonly GUIContent colorText = EditorGUIUtility.TrTextContent("Color", "Color (RGB) and Opacity (A)"); - public static readonly GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal", "Normal (RGB)"); - public static readonly GUIContent extraMapText = EditorGUIUtility.TrTextContent("Extra", "Smoothness (R), Metallic (G), AO (B)"); - public static readonly GUIContent subsurfaceMapText = EditorGUIUtility.TrTextContent("Subsurface", "Subsurface (RGB)"); - - public static readonly GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value"); - public static readonly GUIContent metallicText = EditorGUIUtility.TrTextContent("Metallic", "Metallic value"); - - public static readonly GUIContent twoSidedText = EditorGUIUtility.TrTextContent("Two-Sided", "Set this material to render as two-sided"); - public static readonly GUIContent windQualityText = EditorGUIUtility.TrTextContent("Wind Quality", "Wind quality setting"); - public static readonly GUIContent hueVariationText = EditorGUIUtility.TrTextContent("Hue Variation", "Hue variation Color (RGB) and Amount (A)"); - public static readonly GUIContent normalMappingText = EditorGUIUtility.TrTextContent("Normal Map", "Enable normal mapping"); - public static readonly GUIContent subsurfaceText = EditorGUIUtility.TrTextContent("Subsurface", "Enable subsurface scattering"); - public static readonly GUIContent subsurfaceIndirectText = EditorGUIUtility.TrTextContent("Indirect Subsurface", "Scalar on subsurface from indirect light"); - - public static readonly GUIContent billboardText = EditorGUIUtility.TrTextContent("Billboard", "Enable billboard features (crossfading, etc.)"); - public static readonly GUIContent billboardShadowFadeText = EditorGUIUtility.TrTextContent("Shadow Fade", "Fade shadow effect on billboards"); - - public static readonly GUIContent primaryMapsText = EditorGUIUtility.TrTextContent("Maps"); - public static readonly GUIContent optionsText = EditorGUIUtility.TrTextContent("Options"); - public static readonly GUIContent advancedText = EditorGUIUtility.TrTextContent("Advanced Options"); + public static readonly GUIContent colorText = L10n.TextContent("Color", "Color (RGB) and Opacity (A)", null, null); + public static readonly GUIContent normalMapText = L10n.TextContent("Normal", "Normal (RGB)", null, null); + public static readonly GUIContent extraMapText = L10n.TextContent("Extra", "Smoothness (R), Metallic (G), AO (B)", null, null); + public static readonly GUIContent subsurfaceMapText = L10n.TextContent("Subsurface", "Subsurface (RGB)", null, null); + + public static readonly GUIContent smoothnessText = L10n.TextContent("Smoothness", "Smoothness value", null, null); + public static readonly GUIContent metallicText = L10n.TextContent("Metallic", "Metallic value", null, null); + + public static readonly GUIContent twoSidedText = L10n.TextContent("Two-Sided", "Set this material to render as two-sided", null, null); + public static readonly GUIContent windQualityText = L10n.TextContent("Wind Quality", "Wind quality setting", null, null); + public static readonly GUIContent hueVariationText = L10n.TextContent("Hue Variation", "Hue variation Color (RGB) and Amount (A)", null, null); + public static readonly GUIContent normalMappingText = L10n.TextContent("Normal Map", "Enable normal mapping", null, null); + public static readonly GUIContent subsurfaceText = L10n.TextContent("Subsurface", "Enable subsurface scattering", null, null); + public static readonly GUIContent subsurfaceIndirectText = L10n.TextContent("Indirect Subsurface", "Scalar on subsurface from indirect light", null, null); + + public static readonly GUIContent billboardText = L10n.TextContent("Billboard", "Enable billboard features (crossfading, etc.)", null, null); + public static readonly GUIContent billboardShadowFadeText = L10n.TextContent("Shadow Fade", "Fade shadow effect on billboards", null, null); + + public static readonly GUIContent primaryMapsText = L10n.TextContent("Maps", null, null, null); + public static readonly GUIContent optionsText = L10n.TextContent("Options", null, null, null); + public static readonly GUIContent advancedText = L10n.TextContent("Advanced Options", null, null, null); } public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) diff --git a/Editor/Mono/Inspector/SpeedTree9ShaderGUI.cs b/Editor/Mono/Inspector/SpeedTree9ShaderGUI.cs index aa8ae18062..906bb89ee7 100644 --- a/Editor/Mono/Inspector/SpeedTree9ShaderGUI.cs +++ b/Editor/Mono/Inspector/SpeedTree9ShaderGUI.cs @@ -10,32 +10,32 @@ internal class SpeedTree9ShaderGUI : ShaderGUI { private static class Styles { - public static readonly GUIContent colorText = EditorGUIUtility.TrTextContent("Color", "Color (RGB) and Opacity (A)"); - public static readonly GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal", "Normal (RGB)"); - public static readonly GUIContent extraMapText = EditorGUIUtility.TrTextContent("Extra", "Smoothness (R), Metallic (G), AO (B)"); - public static readonly GUIContent subsurfaceMapText = EditorGUIUtility.TrTextContent("Subsurface", "Subsurface (RGB)"); - - public static readonly GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value"); - public static readonly GUIContent metallicText = EditorGUIUtility.TrTextContent("Metallic", "Metallic value"); - - public static readonly GUIContent twoSidedText = EditorGUIUtility.TrTextContent("Two-Sided", "Set this material to render as two-sided"); - public static readonly GUIContent hueVariationText = EditorGUIUtility.TrTextContent("Hue Variation", "Hue variation Color (RGB) and Amount (A)"); - public static readonly GUIContent normalMappingText = EditorGUIUtility.TrTextContent("Normal Map", "Enable normal mapping"); - public static readonly GUIContent subsurfaceText = EditorGUIUtility.TrTextContent("Subsurface", "Enable subsurface scattering"); - public static readonly GUIContent subsurfaceIndirectText = EditorGUIUtility.TrTextContent("Indirect Subsurface", "Scalar on subsurface from indirect light"); - - public static readonly GUIContent windSharedText = EditorGUIUtility.TrTextContent("Shared Motion", "Wind quality setting"); - public static readonly GUIContent windBranch1Text = EditorGUIUtility.TrTextContent("Branch1 Motion", "Wind quality setting"); - public static readonly GUIContent windBranch2Text = EditorGUIUtility.TrTextContent("Branch2 Motion", "Wind quality setting"); - public static readonly GUIContent windRippleText = EditorGUIUtility.TrTextContent("Ripple Motion", "Wind quality setting"); - public static readonly GUIContent windShimmerText = EditorGUIUtility.TrTextContent("Shimmer Motion", "Wind quality setting"); - - public static readonly GUIContent billboardText = EditorGUIUtility.TrTextContent("Billboard", "Enable billboard features (crossfading, etc.)"); - public static readonly GUIContent billboardShadowFadeText = EditorGUIUtility.TrTextContent("Shadow Fade", "Fade shadow effect on billboards"); - - public static readonly GUIContent primaryMapsText = EditorGUIUtility.TrTextContent("Maps"); - public static readonly GUIContent optionsText = EditorGUIUtility.TrTextContent("Options"); - public static readonly GUIContent advancedText = EditorGUIUtility.TrTextContent("Advanced Options"); + public static readonly GUIContent colorText = L10n.TextContent("Color", "Color (RGB) and Opacity (A)", null, null); + public static readonly GUIContent normalMapText = L10n.TextContent("Normal", "Normal (RGB)", null, null); + public static readonly GUIContent extraMapText = L10n.TextContent("Extra", "Smoothness (R), Metallic (G), AO (B)", null, null); + public static readonly GUIContent subsurfaceMapText = L10n.TextContent("Subsurface", "Subsurface (RGB)", null, null); + + public static readonly GUIContent smoothnessText = L10n.TextContent("Smoothness", "Smoothness value", null, null); + public static readonly GUIContent metallicText = L10n.TextContent("Metallic", "Metallic value", null, null); + + public static readonly GUIContent twoSidedText = L10n.TextContent("Two-Sided", "Set this material to render as two-sided", null, null); + public static readonly GUIContent hueVariationText = L10n.TextContent("Hue Variation", "Hue variation Color (RGB) and Amount (A)", null, null); + public static readonly GUIContent normalMappingText = L10n.TextContent("Normal Map", "Enable normal mapping", null, null); + public static readonly GUIContent subsurfaceText = L10n.TextContent("Subsurface", "Enable subsurface scattering", null, null); + public static readonly GUIContent subsurfaceIndirectText = L10n.TextContent("Indirect Subsurface", "Scalar on subsurface from indirect light", null, null); + + public static readonly GUIContent windSharedText = L10n.TextContent("Shared Motion", "Wind quality setting", null, null); + public static readonly GUIContent windBranch1Text = L10n.TextContent("Branch1 Motion", "Wind quality setting", null, null); + public static readonly GUIContent windBranch2Text = L10n.TextContent("Branch2 Motion", "Wind quality setting", null, null); + public static readonly GUIContent windRippleText = L10n.TextContent("Ripple Motion", "Wind quality setting", null, null); + public static readonly GUIContent windShimmerText = L10n.TextContent("Shimmer Motion", "Wind quality setting", null, null); + + public static readonly GUIContent billboardText = L10n.TextContent("Billboard", "Enable billboard features (crossfading, etc.)", null, null); + public static readonly GUIContent billboardShadowFadeText = L10n.TextContent("Shadow Fade", "Fade shadow effect on billboards", null, null); + + public static readonly GUIContent primaryMapsText = L10n.TextContent("Maps", null, null, null); + public static readonly GUIContent optionsText = L10n.TextContent("Options", null, null, null); + public static readonly GUIContent advancedText = L10n.TextContent("Advanced Options", null, null, null); } public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) @@ -100,7 +100,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro // leaf facing MaterialProperty propLeafFacing = FindProperty("_LeafFacingKwToggle", properties); - MakeAlignedProperty(propLeafFacing, EditorGUIUtility.TrTextContent("Leaf Facing", "Toggles the effect that renders the leaves facing the camera."), materialEditor, true); + MakeAlignedProperty(propLeafFacing, L10n.TextContent("Leaf Facing", "Toggles the effect that renders the leaves facing the camera.", null, null), materialEditor, true); // wind MaterialProperty propWindShared = FindProperty("_WIND_SHARED", properties); diff --git a/Editor/Mono/Inspector/SpriteFrameInspector.cs b/Editor/Mono/Inspector/SpriteFrameInspector.cs index c8dbcf933f..0e12306c62 100644 --- a/Editor/Mono/Inspector/SpriteFrameInspector.cs +++ b/Editor/Mono/Inspector/SpriteFrameInspector.cs @@ -20,13 +20,13 @@ internal class SpriteInspector : Editor { private static class Styles { - public static readonly GUIContent nameLabel = EditorGUIUtility.TrTextContent("Name", "The name for the Sprite."); - public static readonly GUIContent spriteAlignmentLabel = EditorGUIUtility.TrTextContent("Pivot", "The value is normalized to the Sprite's size where (0, 0) is the lower left and (1, 1) is the upper right. May be used for syncing animation frames of different sizes."); - public static readonly GUIContent spriteAlignmentText = EditorGUIUtility.TrTextContent("X:{0:0.##}, Y:{1:0.##}"); - public static readonly GUIContent borderLabel = EditorGUIUtility.TrTextContent("Border", "Border values for the Sprite set in Sprite Editor window. May be useful for 9-Slicing Sprites. The values are in pixels units."); - public static readonly GUIContent borderText = EditorGUIUtility.TrTextContent("L:{0:0.##} B:{1:0.##} R:{2:0.##} T:{3:0.##}"); - public static readonly GUIContent multiValueText = EditorGUIUtility.TrTextContent("-"); - public static readonly GUIContent elemenText = EditorGUIUtility.TrTextContent("Element {0}"); + public static readonly GUIContent nameLabel = L10n.TextContent("Name", "The name for the Sprite.", null, null); + public static readonly GUIContent spriteAlignmentLabel = L10n.TextContent("Pivot", "The value is normalized to the Sprite's size where (0, 0) is the lower left and (1, 1) is the upper right. May be used for syncing animation frames of different sizes.", null, null); + public static readonly GUIContent spriteAlignmentText = L10n.TextContent("X:{0:0.##}, Y:{1:0.##}", null, null, null); + public static readonly GUIContent borderLabel = L10n.TextContent("Border", "Border values for the Sprite set in Sprite Editor window. May be useful for 9-Slicing Sprites. The values are in pixels units.", null, null); + public static readonly GUIContent borderText = L10n.TextContent("L:{0:0.##} B:{1:0.##} R:{2:0.##} T:{3:0.##}", null, null, null); + public static readonly GUIContent multiValueText = L10n.TextContent("-", null, null, null); + public static readonly GUIContent elemenText = L10n.TextContent("Element {0}", null, null, null); } SerializedProperty m_Name; @@ -110,7 +110,7 @@ public override VisualElement CreateInspectorGUI() var image = new Image() { image = EditorGUIUtility.GetHelpIcon(MessageType.Warning), - tooltip = EditorGUIUtility.TrTextContent("ScriptableObject that was previously assigned is no longer available.").text, + tooltip = L10n.TextContent("ScriptableObject that was previously assigned is no longer available.", null, null, null).text, style = { maxHeight = EditorGUI.kSingleLineHeight, diff --git a/Editor/Mono/Inspector/SpriteRendererEditor.cs b/Editor/Mono/Inspector/SpriteRendererEditor.cs index 0d9d2274f0..3f7d8609bb 100644 --- a/Editor/Mono/Inspector/SpriteRendererEditor.cs +++ b/Editor/Mono/Inspector/SpriteRendererEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: _2D not yet converted using UnityEditorInternal; using UnityEngine; using System.Collections.Generic; @@ -21,27 +20,27 @@ internal class SpriteRendererEditor : RendererEditorBase class Styles { - public static readonly GUIContent flipLabel = EditorGUIUtility.TrTextContent("Flip", "Sprite flipping"); - public static readonly GUIContent flipXLabel = EditorGUIUtility.TrTextContent("X", "Sprite horizontal flipping"); - public static readonly GUIContent flipYLabel = EditorGUIUtility.TrTextContent("Y", "Sprite vertical flipping"); + public static readonly GUIContent flipLabel = L10n.TextContent("Flip", "Sprite flipping", null, null); + public static readonly GUIContent flipXLabel = L10n.TextContent("X", "Sprite horizontal flipping", null, null); + public static readonly GUIContent flipYLabel = L10n.TextContent("Y", "Sprite vertical flipping", null, null); public static readonly int flipToggleHash = "FlipToggleHash".GetHashCode(); - public static readonly GUIContent fullTileLabel = EditorGUIUtility.TrTextContent("Tile Mode", "Specify the 9-slice tiling behaviour"); - public static readonly GUIContent fullTileThresholdLabel = EditorGUIUtility.TrTextContent("Stretch Value", "This value defines how much the center portion will stretch before it tiles."); - public static readonly GUIContent drawModeLabel = EditorGUIUtility.TrTextContent("Draw Mode", "Specify the draw mode for the sprite"); - public static readonly GUIContent widthLabel = EditorGUIUtility.TrTextContent("Width", "The width dimension value for the sprite"); - public static readonly GUIContent heightLabel = EditorGUIUtility.TrTextContent("Height", "The height dimension value for the sprite"); - public static readonly GUIContent sizeLabel = EditorGUIUtility.TrTextContent("Size", "The rendering dimension for the sprite"); - public static readonly GUIContent notFullRectWarningLabel = EditorGUIUtility.TrTextContent("Sprite Tiling might not appear correctly because the Sprite used is not generated with Full Rect or Sprite Mode is set to Polygon mode. To fix this, change the Mesh Type in the Sprite's import setting to Full Rect and Sprite Mode is either Single or Multiple"); - public static readonly GUIContent notFullRectMultiEditWarningLabel = EditorGUIUtility.TrTextContent("Sprite Tiling might not appear correctly because some of the Sprites used are not generated with Full Rect. To fix this, change the Mesh Type in the Sprite's import setting to Full Rect"); + public static readonly GUIContent fullTileLabel = L10n.TextContent("Tile Mode", "Specify the 9-slice tiling behaviour", null, null); + public static readonly GUIContent fullTileThresholdLabel = L10n.TextContent("Stretch Value", "This value defines how much the center portion will stretch before it tiles.", null, null); + public static readonly GUIContent drawModeLabel = L10n.TextContent("Draw Mode", "Specify the draw mode for the sprite", null, null); + public static readonly GUIContent widthLabel = L10n.TextContent("Width", "The width dimension value for the sprite", null, null); + public static readonly GUIContent heightLabel = L10n.TextContent("Height", "The height dimension value for the sprite", null, null); + public static readonly GUIContent sizeLabel = L10n.TextContent("Size", "The rendering dimension for the sprite", null, null); + public static readonly GUIContent notFullRectWarningLabel = L10n.TextContent("Sprite Tiling might not appear correctly because the Sprite used is not generated with Full Rect or Sprite Mode is set to Polygon mode. To fix this, change the Mesh Type in the Sprite's import setting to Full Rect and Sprite Mode is either Single or Multiple", null, null, null); + public static readonly GUIContent notFullRectMultiEditWarningLabel = L10n.TextContent("Sprite Tiling might not appear correctly because some of the Sprites used are not generated with Full Rect. To fix this, change the Mesh Type in the Sprite's import setting to Full Rect", null, null, null); public static readonly int sizeFieldHash = "SpriteRendererSizeField".GetHashCode(); - public static readonly GUIContent materialLabel = EditorGUIUtility.TrTextContent("Material", "Material to be used by SpriteRenderer"); - public static readonly GUIContent spriteLabel = EditorGUIUtility.TrTextContent("Sprite", "The Sprite to render"); - public static readonly GUIContent colorLabel = EditorGUIUtility.TrTextContent("Color", "Rendering color for the Sprite graphic"); - public static readonly GUIContent maskInteractionLabel = EditorGUIUtility.TrTextContent("Mask Interaction", "SpriteRenderer's interaction with a Sprite Mask"); - public static readonly GUIContent spriteSortPointLabel = EditorGUIUtility.TrTextContent("Sprite Sort Point", "Determines which position of the Sprite which is used for sorting"); + public static readonly GUIContent materialLabel = L10n.TextContent("Material", "Material to be used by SpriteRenderer", null, null); + public static readonly GUIContent spriteLabel = L10n.TextContent("Sprite", "The Sprite to render", null, null); + public static readonly GUIContent colorLabel = L10n.TextContent("Color", "Rendering color for the Sprite graphic", null, null); + public static readonly GUIContent maskInteractionLabel = L10n.TextContent("Mask Interaction", "SpriteRenderer's interaction with a Sprite Mask", null, null); + public static readonly GUIContent spriteSortPointLabel = L10n.TextContent("Sprite Sort Point", "Determines which position of the Sprite which is used for sorting", null, null); public static readonly Texture2D warningIcon = EditorGUIUtility.LoadIcon("console.warnicon"); - public static readonly GUIContent drawModeChange = EditorGUIUtility.TrTextContent("Draw mode Change"); + public static readonly GUIContent drawModeChange = L10n.TextContent("Draw mode Change", null, null, null); } private SerializedProperty m_FlipX; @@ -385,4 +384,3 @@ private static void ShowWarning(string message) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/StandardParticlesShaderGUI.cs b/Editor/Mono/Inspector/StandardParticlesShaderGUI.cs index ef5aa060c5..dcd74afb6a 100644 --- a/Editor/Mono/Inspector/StandardParticlesShaderGUI.cs +++ b/Editor/Mono/Inspector/StandardParticlesShaderGUI.cs @@ -40,54 +40,54 @@ public enum ColorMode private static class Styles { - public static readonly GUIContent albedoText = EditorGUIUtility.TrTextContent("Albedo", "Albedo (RGB) and Transparency (A)."); - public static readonly GUIContent alphaCutoffText = EditorGUIUtility.TrTextContent("Alpha Cutoff", "Threshold for alpha cutoff."); - public static readonly GUIContent metallicMapText = EditorGUIUtility.TrTextContent("Metallic", "Metallic (R) and Smoothness (A)."); - public static readonly GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value."); - public static readonly GUIContent smoothnessScaleText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness scale factor."); - public static readonly GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map."); - public static readonly GUIContent emissionText = EditorGUIUtility.TrTextContent("Color", "Emission (RGB)."); - - public static readonly GUIContent renderingMode = EditorGUIUtility.TrTextContent("Rendering Mode", "Determines the transparency and blending method for drawing the object to the screen."); + public static readonly GUIContent albedoText = L10n.TextContent("Albedo", "Albedo (RGB) and Transparency (A).", null, null); + public static readonly GUIContent alphaCutoffText = L10n.TextContent("Alpha Cutoff", "Threshold for alpha cutoff.", null, null); + public static readonly GUIContent metallicMapText = L10n.TextContent("Metallic", "Metallic (R) and Smoothness (A).", null, null); + public static readonly GUIContent smoothnessText = L10n.TextContent("Smoothness", "Smoothness value.", null, null); + public static readonly GUIContent smoothnessScaleText = L10n.TextContent("Smoothness", "Smoothness scale factor.", null, null); + public static readonly GUIContent normalMapText = L10n.TextContent("Normal Map", "Normal Map.", null, null); + public static readonly GUIContent emissionText = L10n.TextContent("Color", "Emission (RGB).", null, null); + + public static readonly GUIContent renderingMode = L10n.TextContent("Rendering Mode", "Determines the transparency and blending method for drawing the object to the screen.", null, null); public static readonly GUIContent[] blendNames = Array.ConvertAll(Enum.GetNames(typeof(BlendMode)), item => new GUIContent(item)); - public static readonly GUIContent colorMode = EditorGUIUtility.TrTextContent("Color Mode", "Determines the blending mode between the particle color and the texture albedo."); + public static readonly GUIContent colorMode = L10n.TextContent("Color Mode", "Determines the blending mode between the particle color and the texture albedo.", null, null); public static readonly GUIContent[] colorNames = Array.ConvertAll(Enum.GetNames(typeof(ColorMode)), item => new GUIContent(item)); - public static readonly GUIContent flipbookBlending = EditorGUIUtility.TrTextContent("Flip-Book Frame Blending", "Enables blending between the frames of animated texture sheets."); - public static readonly GUIContent twoSidedEnabled = EditorGUIUtility.TrTextContent("Two Sided", "Render both front and back faces of the particle geometry."); + public static readonly GUIContent flipbookBlending = L10n.TextContent("Flip-Book Frame Blending", "Enables blending between the frames of animated texture sheets.", null, null); + public static readonly GUIContent twoSidedEnabled = L10n.TextContent("Two Sided", "Render both front and back faces of the particle geometry.", null, null); - public static readonly GUIContent distortionEnabled = EditorGUIUtility.TrTextContent("Distortion", "Use a grab pass and normal map to simulate refraction."); - public static readonly GUIContent distortionStrengthText = EditorGUIUtility.TrTextContent("Strength", "Distortion Strength."); - public static readonly GUIContent distortionBlendText = EditorGUIUtility.TrTextContent("Blend", "Weighting between albedo and grab pass."); + public static readonly GUIContent distortionEnabled = L10n.TextContent("Distortion", "Use a grab pass and normal map to simulate refraction.", null, null); + public static readonly GUIContent distortionStrengthText = L10n.TextContent("Strength", "Distortion Strength.", null, null); + public static readonly GUIContent distortionBlendText = L10n.TextContent("Blend", "Weighting between albedo and grab pass.", null, null); - public static readonly GUIContent softParticlesEnabled = EditorGUIUtility.TrTextContent("Soft Particles", "Fade out particle geometry when it gets close to the surface of objects written into the depth buffer."); - public static readonly GUIContent softParticlesNearFadeDistanceText = EditorGUIUtility.TrTextContent("Near fade", "Soft Particles near fade distance."); - public static readonly GUIContent softParticlesFarFadeDistanceText = EditorGUIUtility.TrTextContent("Far fade", "Soft Particles far fade distance."); + public static readonly GUIContent softParticlesEnabled = L10n.TextContent("Soft Particles", "Fade out particle geometry when it gets close to the surface of objects written into the depth buffer.", null, null); + public static readonly GUIContent softParticlesNearFadeDistanceText = L10n.TextContent("Near fade", "Soft Particles near fade distance.", null, null); + public static readonly GUIContent softParticlesFarFadeDistanceText = L10n.TextContent("Far fade", "Soft Particles far fade distance.", null, null); - public static readonly GUIContent cameraFadingEnabled = EditorGUIUtility.TrTextContent("Camera Fading", "Fade out particle geometry when it gets close to the camera."); - public static readonly GUIContent cameraNearFadeDistanceText = EditorGUIUtility.TrTextContent("Near fade", "Camera near fade distance."); - public static readonly GUIContent cameraFarFadeDistanceText = EditorGUIUtility.TrTextContent("Far fade", "Camera far fade distance."); + public static readonly GUIContent cameraFadingEnabled = L10n.TextContent("Camera Fading", "Fade out particle geometry when it gets close to the camera.", null, null); + public static readonly GUIContent cameraNearFadeDistanceText = L10n.TextContent("Near fade", "Camera near fade distance.", null, null); + public static readonly GUIContent cameraFarFadeDistanceText = L10n.TextContent("Far fade", "Camera far fade distance.", null, null); - public static readonly GUIContent emissionEnabled = EditorGUIUtility.TrTextContent("Emission"); + public static readonly GUIContent emissionEnabled = L10n.TextContent("Emission", null, null, null); - public static readonly GUIContent blendingOptionsText = EditorGUIUtility.TrTextContent("Blending Options"); - public static readonly GUIContent mainOptionsText = EditorGUIUtility.TrTextContent("Main Options"); - public static readonly GUIContent mapsOptionsText = EditorGUIUtility.TrTextContent("Maps"); - public static readonly GUIContent advancedText = EditorGUIUtility.TrTextContent("Advanced Options"); - public static readonly GUIContent requiredVertexStreamsText = EditorGUIUtility.TrTextContent("Required Vertex Streams"); + public static readonly GUIContent blendingOptionsText = L10n.TextContent("Blending Options", null, null, null); + public static readonly GUIContent mainOptionsText = L10n.TextContent("Main Options", null, null, null); + public static readonly GUIContent mapsOptionsText = L10n.TextContent("Maps", null, null, null); + public static readonly GUIContent advancedText = L10n.TextContent("Advanced Options", null, null, null); + public static readonly GUIContent requiredVertexStreamsText = L10n.TextContent("Required Vertex Streams", null, null, null); - public static readonly GUIContent streamPositionText = EditorGUIUtility.TrTextContent("Position (POSITION.xyz)"); - public static readonly GUIContent streamNormalText = EditorGUIUtility.TrTextContent("Normal (NORMAL.xyz)"); - public static readonly GUIContent streamColorText = EditorGUIUtility.TrTextContent("Color (COLOR.xyzw)"); - public static readonly GUIContent streamColorInstancedText = EditorGUIUtility.TrTextContent("Color (INSTANCED0.xyzw)"); - public static readonly GUIContent streamUVText = EditorGUIUtility.TrTextContent("UV (TEXCOORD0.xy)"); - public static readonly GUIContent streamUV2Text = EditorGUIUtility.TrTextContent("UV2 (TEXCOORD0.zw)"); - public static readonly GUIContent streamAnimBlendText = EditorGUIUtility.TrTextContent("AnimBlend (TEXCOORD1.x)"); - public static readonly GUIContent streamAnimFrameText = EditorGUIUtility.TrTextContent("AnimFrame (INSTANCED1.x)"); - public static readonly GUIContent streamTangentText = EditorGUIUtility.TrTextContent("Tangent (TANGENT.xyzw)"); + public static readonly GUIContent streamPositionText = L10n.TextContent("Position (POSITION.xyz)", null, null, null); + public static readonly GUIContent streamNormalText = L10n.TextContent("Normal (NORMAL.xyz)", null, null, null); + public static readonly GUIContent streamColorText = L10n.TextContent("Color (COLOR.xyzw)", null, null, null); + public static readonly GUIContent streamColorInstancedText = L10n.TextContent("Color (INSTANCED0.xyzw)", null, null, null); + public static readonly GUIContent streamUVText = L10n.TextContent("UV (TEXCOORD0.xy)", null, null, null); + public static readonly GUIContent streamUV2Text = L10n.TextContent("UV2 (TEXCOORD0.zw)", null, null, null); + public static readonly GUIContent streamAnimBlendText = L10n.TextContent("AnimBlend (TEXCOORD1.x)", null, null, null); + public static readonly GUIContent streamAnimFrameText = L10n.TextContent("AnimFrame (INSTANCED1.x)", null, null, null); + public static readonly GUIContent streamTangentText = L10n.TextContent("Tangent (TANGENT.xyzw)", null, null, null); - public static readonly GUIContent streamApplyToAllSystemsText = EditorGUIUtility.TrTextContent("Apply to Systems", "Apply the vertex stream layout to all Particle Systems using this material"); + public static readonly GUIContent streamApplyToAllSystemsText = L10n.TextContent("Apply to Systems", "Apply the vertex stream layout to all Particle Systems using this material", null, null); public static readonly string undoApplyCustomVertexStreams = L10n.Tr("Apply custom vertex streams from material", null); } diff --git a/Editor/Mono/Inspector/StandardShaderGUI.cs b/Editor/Mono/Inspector/StandardShaderGUI.cs index 1a86f1e044..563eda5f25 100644 --- a/Editor/Mono/Inspector/StandardShaderGUI.cs +++ b/Editor/Mono/Inspector/StandardShaderGUI.cs @@ -32,24 +32,24 @@ public enum SmoothnessMapChannel private static class Styles { - public static readonly GUIContent uvSetLabel = EditorGUIUtility.TrTextContent("UV Set"); - - public static readonly GUIContent albedoText = EditorGUIUtility.TrTextContent("Albedo", "Albedo (RGB) and Transparency (A)"); - public static readonly GUIContent alphaCutoffText = EditorGUIUtility.TrTextContent("Alpha Cutoff", "Threshold for alpha cutoff"); - public static readonly GUIContent specularMapText = EditorGUIUtility.TrTextContent("Specular", "Specular (RGB) and Smoothness (A)"); - public static readonly GUIContent metallicMapText = EditorGUIUtility.TrTextContent("Metallic", "Metallic (R) and Smoothness (A)"); - public static readonly GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value"); - public static readonly GUIContent smoothnessScaleText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness scale factor"); - public static readonly GUIContent smoothnessMapChannelText = EditorGUIUtility.TrTextContent("Source", "Smoothness texture and channel"); - public static readonly GUIContent highlightsText = EditorGUIUtility.TrTextContent("Specular Highlights", "Specular Highlights"); - public static readonly GUIContent reflectionsText = EditorGUIUtility.TrTextContent("Reflections", "Glossy Reflections"); - public static readonly GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map"); - public static readonly GUIContent heightMapText = EditorGUIUtility.TrTextContent("Height Map", "Height Map (G)"); - public static readonly GUIContent occlusionText = EditorGUIUtility.TrTextContent("Occlusion", "Occlusion (G)"); - public static readonly GUIContent emissionText = EditorGUIUtility.TrTextContent("Color", "Emission (RGB)"); - public static readonly GUIContent detailMaskText = EditorGUIUtility.TrTextContent("Detail Mask", "Mask for Secondary Maps (A)"); - public static readonly GUIContent detailAlbedoText = EditorGUIUtility.TrTextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2"); - public static readonly GUIContent detailNormalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map"); + public static readonly GUIContent uvSetLabel = L10n.TextContent("UV Set", null, null, null); + + public static readonly GUIContent albedoText = L10n.TextContent("Albedo", "Albedo (RGB) and Transparency (A)", null, null); + public static readonly GUIContent alphaCutoffText = L10n.TextContent("Alpha Cutoff", "Threshold for alpha cutoff", null, null); + public static readonly GUIContent specularMapText = L10n.TextContent("Specular", "Specular (RGB) and Smoothness (A)", null, null); + public static readonly GUIContent metallicMapText = L10n.TextContent("Metallic", "Metallic (R) and Smoothness (A)", null, null); + public static readonly GUIContent smoothnessText = L10n.TextContent("Smoothness", "Smoothness value", null, null); + public static readonly GUIContent smoothnessScaleText = L10n.TextContent("Smoothness", "Smoothness scale factor", null, null); + public static readonly GUIContent smoothnessMapChannelText = L10n.TextContent("Source", "Smoothness texture and channel", null, null); + public static readonly GUIContent highlightsText = L10n.TextContent("Specular Highlights", "Specular Highlights", null, null); + public static readonly GUIContent reflectionsText = L10n.TextContent("Reflections", "Glossy Reflections", null, null); + public static readonly GUIContent normalMapText = L10n.TextContent("Normal Map", "Normal Map", null, null); + public static readonly GUIContent heightMapText = L10n.TextContent("Height Map", "Height Map (G)", null, null); + public static readonly GUIContent occlusionText = L10n.TextContent("Occlusion", "Occlusion (G)", null, null); + public static readonly GUIContent emissionText = L10n.TextContent("Color", "Emission (RGB)", null, null); + public static readonly GUIContent detailMaskText = L10n.TextContent("Detail Mask", "Mask for Secondary Maps (A)", null, null); + public static readonly GUIContent detailAlbedoText = L10n.TextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2", null, null); + public static readonly GUIContent detailNormalMapText = L10n.TextContent("Normal Map", "Normal Map", null, null); public static readonly string primaryMapsText = "Main Maps"; public static readonly string secondaryMapsText = "Secondary Maps"; @@ -274,8 +274,8 @@ void DoNormalArea() if (bumpScale.floatValue != 1 && UnityEditorInternal.InternalEditorUtility.IsMobilePlatform(EditorUserBuildSettings.activeBuildTarget)) if (m_MaterialEditor.HelpBoxWithButton( - EditorGUIUtility.TrTextContent("Bump scale is not supported on mobile platforms"), - EditorGUIUtility.TrTextContent("Fix Now"))) + L10n.TextContent("Bump scale is not supported on mobile platforms", null, null, null), + L10n.TextContent("Fix Now", null, null, null))) { bumpScale.floatValue = 1; } diff --git a/Editor/Mono/Inspector/TagManagerInspector.cs b/Editor/Mono/Inspector/TagManagerInspector.cs index 3326a1fbe2..420b57a1aa 100644 --- a/Editor/Mono/Inspector/TagManagerInspector.cs +++ b/Editor/Mono/Inspector/TagManagerInspector.cs @@ -43,15 +43,15 @@ internal enum InitialExpansionState internal class StylesNonSearchable { - public static readonly GUIContent existingTagMessage = EditorGUIUtility.TrTextContent("Tag with \"{0}\" name already exists."); + public static readonly GUIContent existingTagMessage = L10n.TextContent("Tag with \"{0}\" name already exists.", null, null, null); } internal class Styles { - public static readonly GUIContent tags = EditorGUIUtility.TrTextContent("Tags"); - public static readonly GUIContent sortingLayers = EditorGUIUtility.TrTextContent("Sorting Layers"); - public static readonly GUIContent layers = EditorGUIUtility.TrTextContent("Layers"); - public static readonly GUIContent renderingLayers = EditorGUIUtility.TrTextContent("Rendering Layers"); + public static readonly GUIContent tags = L10n.TextContent("Tags", null, null, null); + public static readonly GUIContent sortingLayers = L10n.TextContent("Sorting Layers", null, null, null); + public static readonly GUIContent layers = L10n.TextContent("Layers", null, null, null); + public static readonly GUIContent renderingLayers = L10n.TextContent("Rendering Layers", null, null, null); public static readonly float elementHeight = EditorGUIUtility.singleLineHeight + 2; public const float headerListHeight = 3; diff --git a/Editor/Mono/Inspector/Texture2DArrayPreview.cs b/Editor/Mono/Inspector/Texture2DArrayPreview.cs index c9394ca0c2..f982b83e3e 100644 --- a/Editor/Mono/Inspector/Texture2DArrayPreview.cs +++ b/Editor/Mono/Inspector/Texture2DArrayPreview.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Texture not yet converted using System.Collections.Generic; using UnityEngine; using UnityEngine.Experimental.Rendering; @@ -199,4 +198,3 @@ public Texture2D RenderStaticPreview(Texture target, string assetPath, Object[] } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/Texture3DPreview.cs b/Editor/Mono/Inspector/Texture3DPreview.cs index 89301a1fca..66c52a1592 100644 --- a/Editor/Mono/Inspector/Texture3DPreview.cs +++ b/Editor/Mono/Inspector/Texture3DPreview.cs @@ -84,17 +84,17 @@ static class MaterialProps static class Styles { - public static readonly GUIContent ramp = EditorGUIUtility.TrTextContent("Ramp", "Use gradient color ramp visualization"); - public static readonly GUIContent quality = EditorGUIUtility.TrTextContent("Quality", "Sample per texture pixel modifier"); - public static readonly GUIContent alpha = EditorGUIUtility.TrTextContent("Alpha", "Opacity of the texture visualization"); - public static readonly GUIContent x = EditorGUIUtility.TrTextContent("X"); - public static readonly GUIContent y = EditorGUIUtility.TrTextContent("Y"); - public static readonly GUIContent z = EditorGUIUtility.TrTextContent("Z"); - public static readonly GUIContent scale = EditorGUIUtility.TrTextContent("Scale", "SDF value scale (how many texels SDF value of 1 represents)"); - public static readonly GUIContent offset = EditorGUIUtility.TrTextContent("Offset", "SDF surface is at this value"); - public static readonly GUIContent volume = EditorGUIUtility.TrTextContent("Volume", "Volumetric rendering display"); - public static readonly GUIContent slice = EditorGUIUtility.TrTextContent("Slice", "Display three planar slices of the texture"); - public static readonly GUIContent sdf = EditorGUIUtility.TrTextContent("SDF", "Display texture as a Signed Distance Field surface"); + public static readonly GUIContent ramp = L10n.TextContent("Ramp", "Use gradient color ramp visualization", null, null); + public static readonly GUIContent quality = L10n.TextContent("Quality", "Sample per texture pixel modifier", null, null); + public static readonly GUIContent alpha = L10n.TextContent("Alpha", "Opacity of the texture visualization", null, null); + public static readonly GUIContent x = L10n.TextContent("X", null, null, null); + public static readonly GUIContent y = L10n.TextContent("Y", null, null, null); + public static readonly GUIContent z = L10n.TextContent("Z", null, null, null); + public static readonly GUIContent scale = L10n.TextContent("Scale", "SDF value scale (how many texels SDF value of 1 represents)", null, null); + public static readonly GUIContent offset = L10n.TextContent("Offset", "SDF surface is at this value", null, null); + public static readonly GUIContent volume = L10n.TextContent("Volume", "Volumetric rendering display", null, null); + public static readonly GUIContent slice = L10n.TextContent("Slice", "Display three planar slices of the texture", null, null); + public static readonly GUIContent sdf = L10n.TextContent("SDF", "Display texture as a Signed Distance Field surface", null, null); } const float s_SliderWidth = 40; diff --git a/Editor/Mono/Inspector/TextureInspector.cs b/Editor/Mono/Inspector/TextureInspector.cs index 6334395ac8..2139a3033c 100644 --- a/Editor/Mono/Inspector/TextureInspector.cs +++ b/Editor/Mono/Inspector/TextureInspector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Texture not yet converted using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; using UnityEngine; @@ -75,27 +74,27 @@ static class Styles public static readonly GUIContent[] previewChannelIcons = { - EditorGUIUtility.TrIconContent("PreTexRGB"), - EditorGUIUtility.TrIconContent("PreTexR"), - EditorGUIUtility.TrIconContent("PreTexG"), - EditorGUIUtility.TrIconContent("PreTexB"), - EditorGUIUtility.TrIconContent("PreTexA") + L10n.IconContent("PreTexRGB", null, null), + L10n.IconContent("PreTexR", null, null), + L10n.IconContent("PreTexG", null, null), + L10n.IconContent("PreTexB", null, null), + L10n.IconContent("PreTexA", null, null) }; - public static readonly GUIContent previewColorIcon = EditorGUIUtility.TrIconContent("Color", "Displaying grayscale. Click to switch to color."); - public static readonly GUIContent previewGrayscaleIcon = EditorGUIUtility.TrIconContent("Grayscale", "Displaying color. Click to switch to grayscale."); + public static readonly GUIContent previewColorIcon = L10n.IconContent("Color", "Displaying grayscale. Click to switch to color.", null); + public static readonly GUIContent previewGrayscaleIcon = L10n.IconContent("Grayscale", "Displaying color. Click to switch to grayscale.", null); - public static readonly GUIContent wrapModeLabel = EditorGUIUtility.TrTextContent("Wrap Mode"); - public static readonly GUIContent wrapU = EditorGUIUtility.TrTextContent("U axis"); - public static readonly GUIContent wrapV = EditorGUIUtility.TrTextContent("V axis"); - public static readonly GUIContent wrapW = EditorGUIUtility.TrTextContent("W axis"); + public static readonly GUIContent wrapModeLabel = L10n.TextContent("Wrap Mode", null, null, null); + public static readonly GUIContent wrapU = L10n.TextContent("U axis", null, null, null); + public static readonly GUIContent wrapV = L10n.TextContent("V axis", null, null, null); + public static readonly GUIContent wrapW = L10n.TextContent("W axis", null, null, null); public static readonly GUIContent[] wrapModeContents = { - EditorGUIUtility.TrTextContent("Repeat"), - EditorGUIUtility.TrTextContent("Clamp"), - EditorGUIUtility.TrTextContent("Mirror"), - EditorGUIUtility.TrTextContent("Mirror Once"), - EditorGUIUtility.TrTextContent("Per-axis") + L10n.TextContent("Repeat", null, null, null), + L10n.TextContent("Clamp", null, null, null), + L10n.TextContent("Mirror", null, null, null), + L10n.TextContent("Mirror Once", null, null, null), + L10n.TextContent("Per-axis", null, null, null) }; public static readonly int[] wrapModeValues = { @@ -1251,4 +1250,3 @@ public static Vector2 Drag2D(Vector2 scrollPosition, Rect position) return scrollPosition; } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/TimeControl.cs b/Editor/Mono/Inspector/TimeControl.cs index f4d722e669..98472abc1a 100644 --- a/Editor/Mono/Inspector/TimeControl.cs +++ b/Editor/Mono/Inspector/TimeControl.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: MecanimAnimation not yet converted using UnityEngine; using UnityEditor; using UnityEditorInternal; @@ -231,4 +230,3 @@ public void Update() } }//class TimeControl }//namespace UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/TimeManagerInspector.cs b/Editor/Mono/Inspector/TimeManagerInspector.cs index 9251573645..b3fcce7642 100644 --- a/Editor/Mono/Inspector/TimeManagerInspector.cs +++ b/Editor/Mono/Inspector/TimeManagerInspector.cs @@ -14,10 +14,10 @@ internal class TimeManagerEditor : Editor { class Content { - public static readonly GUIContent fixedTimestepLabel = EditorGUIUtility.TrTextContent("Fixed Timestep", "A framerate-independent interval that dictates when physics calculations and FixedUpdate() events are performed."); - public static readonly GUIContent maxAllowedTimestepLabel = EditorGUIUtility.TrTextContent("Maximum Allowed Timestep", "A framerate-independent interval that caps the worst-case scenario when framerate is low. Physics calculations and FixedUpdate() events will not be performed for longer time than specified."); - public static readonly GUIContent timeScaleLabel = EditorGUIUtility.TrTextContent("Time Scale", "The speed at which time progresses. Change this value to simulate bullet-time effects. A value of 1 means real-time. A value of .5 means half speed; a value of 2 is double speed."); - public static readonly GUIContent maxParticleTimestepLabel = EditorGUIUtility.TrTextContent("Maximum Particle Timestep", "The maximum frame delta time Unity permits for a single iteration of the Particle System update. If the delta time is larger than this value, Unity will run the Particle System update multiple times during the frame with smaller timesteps. This preserves the quality of the simulation."); + public static readonly GUIContent fixedTimestepLabel = L10n.TextContent("Fixed Timestep", "A framerate-independent interval that dictates when physics calculations and FixedUpdate() events are performed.", null, null); + public static readonly GUIContent maxAllowedTimestepLabel = L10n.TextContent("Maximum Allowed Timestep", "A framerate-independent interval that caps the worst-case scenario when framerate is low. Physics calculations and FixedUpdate() events will not be performed for longer time than specified.", null, null); + public static readonly GUIContent timeScaleLabel = L10n.TextContent("Time Scale", "The speed at which time progresses. Change this value to simulate bullet-time effects. A value of 1 means real-time. A value of .5 means half speed; a value of 2 is double speed.", null, null); + public static readonly GUIContent maxParticleTimestepLabel = L10n.TextContent("Maximum Particle Timestep", "The maximum frame delta time Unity permits for a single iteration of the Particle System update. If the delta time is larger than this value, Unity will run the Particle System update multiple times during the frame with smaller timesteps. This preserves the quality of the simulation.", null, null); } SerializedProperty m_FixedTimestepCountProperty; diff --git a/Editor/Mono/Inspector/TrailRendererEditor.cs b/Editor/Mono/Inspector/TrailRendererEditor.cs index aecad305ce..15fe844261 100644 --- a/Editor/Mono/Inspector/TrailRendererEditor.cs +++ b/Editor/Mono/Inspector/TrailRendererEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: VisualEffects not yet converted using System.Collections.Generic; using System.Linq; using UnityEditor.EditorTools; @@ -20,28 +19,28 @@ internal partial class TrailRendererInspector : RendererEditorBase { private class Styles { - public static readonly GUIContent colorGradient = EditorGUIUtility.TrTextContent("Color", "The gradient describing the color along the trail."); - public static readonly GUIContent numCornerVertices = EditorGUIUtility.TrTextContent("Corner Vertices", "How many vertices to add for each corner."); - public static readonly GUIContent numCapVertices = EditorGUIUtility.TrTextContent("End Cap Vertices", "How many vertices to add at each end."); - public static readonly GUIContent alignment = EditorGUIUtility.TrTextContent("Alignment", "Trails can rotate to face their transform component or the camera. When using TransformZ mode, lines extrude along the XY plane of the Transform."); - public static readonly GUIContent textureMode = EditorGUIUtility.TrTextContent("Texture Mode", "Should the U coordinate be stretched or tiled?"); - public static readonly GUIContent textureScale = EditorGUIUtility.TrTextContent("Texture Scale", "Scale the texture along the UV coordinates using this multiplier."); - public static readonly GUIContent shadowBias = EditorGUIUtility.TrTextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the trail width at each segment."); - public static readonly GUIContent generateLightingData = EditorGUIUtility.TrTextContent("Generate Lighting Data", "Toggle generation of normal and tangent data, for use in lit shaders."); - public static readonly GUIContent applyActiveColorSpace = EditorGUIUtility.TrTextContent("Apply Active Color Space", "When using Linear Rendering, colors will be converted appropriately before being passed to the GPU."); - - public static readonly GUIContent play = EditorGUIUtility.TrTextContent("Play"); - public static readonly GUIContent playDisabled = EditorGUIUtility.TrTextContent("Play", "Play is disabled, because the Time Scale in the Time Manager is set to 0.0."); - public static readonly GUIContent stop = EditorGUIUtility.TrTextContent("Stop"); - public static readonly GUIContent pause = EditorGUIUtility.TrTextContent("Pause"); - public static readonly GUIContent restart = EditorGUIUtility.TrTextContent("Restart"); - public static readonly GUIContent movementSpeed = EditorGUIUtility.TrTextContent("Movement Speed", "Speed is also affected by the Time Scale setting in the Time Manager."); - public static readonly GUIContent movementSpeedDisabled = EditorGUIUtility.TrTextContent("Movement Speed", "Speed is locked to 0.0, because the Time Scale in the Time Manager is set to 0.0."); - public static readonly GUIContent timeScale = EditorGUIUtility.TrTextContent("Time Scale", "Speed up or slow down the preview of the trail."); - public static readonly GUIContent timeScaleDisabled = EditorGUIUtility.TrTextContent("Time Scale", "Time Scale is locked to 0.0, because the Time Scale in the Time Manager is set to 0.0."); - public static readonly GUIContent showBounds = EditorGUIUtility.TrTextContent("Show Bounds", "Show world space bounding boxes."); - public static readonly GUIContent previewShape = EditorGUIUtility.TrTextContent("Shape", "The trail preview will follow the selected shape."); - public static readonly GUIContent previewShapeSize = EditorGUIUtility.TrTextContent("Shape Size", "The size of the shape."); + public static readonly GUIContent colorGradient = L10n.TextContent("Color", "The gradient describing the color along the trail.", null, null); + public static readonly GUIContent numCornerVertices = L10n.TextContent("Corner Vertices", "How many vertices to add for each corner.", null, null); + public static readonly GUIContent numCapVertices = L10n.TextContent("End Cap Vertices", "How many vertices to add at each end.", null, null); + public static readonly GUIContent alignment = L10n.TextContent("Alignment", "Trails can rotate to face their transform component or the camera. When using TransformZ mode, lines extrude along the XY plane of the Transform.", null, null); + public static readonly GUIContent textureMode = L10n.TextContent("Texture Mode", "Should the U coordinate be stretched or tiled?", null, null); + public static readonly GUIContent textureScale = L10n.TextContent("Texture Scale", "Scale the texture along the UV coordinates using this multiplier.", null, null); + public static readonly GUIContent shadowBias = L10n.TextContent("Shadow Bias", "Apply a shadow bias to prevent self-shadowing artifacts. The specified value is the proportion of the trail width at each segment.", null, null); + public static readonly GUIContent generateLightingData = L10n.TextContent("Generate Lighting Data", "Toggle generation of normal and tangent data, for use in lit shaders.", null, null); + public static readonly GUIContent applyActiveColorSpace = L10n.TextContent("Apply Active Color Space", "When using Linear Rendering, colors will be converted appropriately before being passed to the GPU.", null, null); + + public static readonly GUIContent play = L10n.TextContent("Play", null, null, null); + public static readonly GUIContent playDisabled = L10n.TextContent("Play", "Play is disabled, because the Time Scale in the Time Manager is set to 0.0.", null, null); + public static readonly GUIContent stop = L10n.TextContent("Stop", null, null, null); + public static readonly GUIContent pause = L10n.TextContent("Pause", null, null, null); + public static readonly GUIContent restart = L10n.TextContent("Restart", null, null, null); + public static readonly GUIContent movementSpeed = L10n.TextContent("Movement Speed", "Speed is also affected by the Time Scale setting in the Time Manager.", null, null); + public static readonly GUIContent movementSpeedDisabled = L10n.TextContent("Movement Speed", "Speed is locked to 0.0, because the Time Scale in the Time Manager is set to 0.0.", null, null); + public static readonly GUIContent timeScale = L10n.TextContent("Time Scale", "Speed up or slow down the preview of the trail.", null, null); + public static readonly GUIContent timeScaleDisabled = L10n.TextContent("Time Scale", "Time Scale is locked to 0.0, because the Time Scale in the Time Manager is set to 0.0.", null, null); + public static readonly GUIContent showBounds = L10n.TextContent("Show Bounds", "Show world space bounding boxes.", null, null); + public static readonly GUIContent previewShape = L10n.TextContent("Shape", "The trail preview will follow the selected shape.", null, null); + public static readonly GUIContent previewShapeSize = L10n.TextContent("Shape Size", "The size of the shape.", null, null); public static readonly GUIContent toolIcon = EditorGUIUtility.IconContent("ParticleShapeTool", "Shape gizmo editing mode."); @@ -830,4 +829,3 @@ private static float DoSimpleSpringHandle(float radius, bool editable, float rot } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/TransformInspector.cs b/Editor/Mono/Inspector/TransformInspector.cs index 10d77a69ef..80f2a32fc7 100644 --- a/Editor/Mono/Inspector/TransformInspector.cs +++ b/Editor/Mono/Inspector/TransformInspector.cs @@ -20,8 +20,8 @@ internal class TransformInspector : Editor class Contents { - public GUIContent positionContent = EditorGUIUtility.TrTextContent("Position", "The local position of this GameObject relative to the parent."); - public GUIContent scaleContent = EditorGUIUtility.TrTextContent("Scale", "The local scaling of this GameObject relative to the parent."); + public GUIContent positionContent = L10n.TextContent("Position", "The local position of this GameObject relative to the parent.", null, null); + public GUIContent scaleContent = L10n.TextContent("Scale", "The local scaling of this GameObject relative to the parent.", null, null); public string floatingPointWarning = LocalizationDatabase.GetLocalizedString("Due to floating-point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range."); } [NoAutoStaticsCleanup] // GUIContent/string-only lazy Contents cache; contents survive code reload @@ -35,7 +35,7 @@ public void OnEnable() if (m_RotationGUI == null) m_RotationGUI = new TransformRotationGUI(); - m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), EditorGUIUtility.TrTextContent("Rotation", "The local rotation of this GameObject relative to the parent.")); + m_RotationGUI.OnEnable(serializedObject.FindProperty("m_LocalRotation"), L10n.TextContent("Rotation", "The local rotation of this GameObject relative to the parent.", null, null)); m_ConstrainProportionsScale = new ConstrainProportionsTransformScale(m_Scale.vector3Value); } diff --git a/Editor/Mono/Inspector/TransformRotationGUI.cs b/Editor/Mono/Inspector/TransformRotationGUI.cs index 35ab9e67ac..85edd0bcd0 100644 --- a/Editor/Mono/Inspector/TransformRotationGUI.cs +++ b/Editor/Mono/Inspector/TransformRotationGUI.cs @@ -9,7 +9,7 @@ namespace UnityEditor [System.Serializable] internal class TransformRotationGUI { - private GUIContent rotationContent = EditorGUIUtility.TrTextContent("Rotation", "The local rotation of this Game Object relative to the parent."); + private GUIContent rotationContent = L10n.TextContent("Rotation", "The local rotation of this Game Object relative to the parent.", null, null); private const float kQuaternionFloatPrecision = 1e-6f; EditorGUI.NumberFieldValue[] m_EulerFloats = diff --git a/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs b/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs index f1904c41db..ac775f1553 100644 --- a/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs +++ b/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: UIToolkitControls not yet converted using System; using System.Text; using Unity.Properties; @@ -193,4 +192,3 @@ public override void SetValueWithoutNotify(Object newValue) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/VisualElements/ProjectSettings/BuiltInShaderElement.cs b/Editor/Mono/Inspector/VisualElements/ProjectSettings/BuiltInShaderElement.cs index 7f802c3cb3..713573e90c 100644 --- a/Editor/Mono/Inspector/VisualElements/ProjectSettings/BuiltInShaderElement.cs +++ b/Editor/Mono/Inspector/VisualElements/ProjectSettings/BuiltInShaderElement.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ShaderSystem not yet converted using System; using UnityEngine; using UnityEngine.UIElements; @@ -107,4 +106,3 @@ public void ApplyTooltips() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/VisualElements/RenderingLayerMaskField.cs b/Editor/Mono/Inspector/VisualElements/RenderingLayerMaskField.cs index 41d87af8bf..96cc49f6d0 100644 --- a/Editor/Mono/Inspector/VisualElements/RenderingLayerMaskField.cs +++ b/Editor/Mono/Inspector/VisualElements/RenderingLayerMaskField.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SRPSettings not yet converted using System.Collections.Generic; using UnityEditor.Rendering; using UnityEngine; @@ -182,4 +181,3 @@ void UpdateHelpBoxVisibility(uint mask) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Inspector/WindInspector.cs b/Editor/Mono/Inspector/WindInspector.cs index fbe2162571..264e736612 100644 --- a/Editor/Mono/Inspector/WindInspector.cs +++ b/Editor/Mono/Inspector/WindInspector.cs @@ -15,12 +15,12 @@ internal class WindInspector : Editor { private class Styles { - public static readonly GUIContent Mode = EditorGUIUtility.TrTextContent("Mode", "The wind blows towards a direction or outwards within a sphere"); - public static readonly GUIContent Radius = EditorGUIUtility.TrTextContent("Radius", "The radius of the spherical area"); - public static readonly GUIContent WindMain = EditorGUIUtility.TrTextContent("Main", "Overall strength of the wind"); - public static readonly GUIContent WindTurbulence = EditorGUIUtility.TrTextContent("Turbulence", "Randomness in strength"); - public static readonly GUIContent WindPulseMagnitude = EditorGUIUtility.TrTextContent("Pulse Magnitude", "Strength of the wind pulses"); - public static readonly GUIContent WindPulseFrequency = EditorGUIUtility.TrTextContent("Pulse Frequency", "Frequency of the wind pulses"); + public static readonly GUIContent Mode = L10n.TextContent("Mode", "The wind blows towards a direction or outwards within a sphere", null, null); + public static readonly GUIContent Radius = L10n.TextContent("Radius", "The radius of the spherical area", null, null); + public static readonly GUIContent WindMain = L10n.TextContent("Main", "Overall strength of the wind", null, null); + public static readonly GUIContent WindTurbulence = L10n.TextContent("Turbulence", "Randomness in strength", null, null); + public static readonly GUIContent WindPulseMagnitude = L10n.TextContent("Pulse Magnitude", "Strength of the wind pulses", null, null); + public static readonly GUIContent WindPulseFrequency = L10n.TextContent("Pulse Frequency", "Frequency of the wind pulses", null, null); } private SerializedProperty m_Mode; diff --git a/Editor/Mono/InternalEditorUtility.bindings.cs b/Editor/Mono/InternalEditorUtility.bindings.cs index a44504a332..2d37979b0f 100644 --- a/Editor/Mono/InternalEditorUtility.bindings.cs +++ b/Editor/Mono/InternalEditorUtility.bindings.cs @@ -370,8 +370,8 @@ internal static void DrawMeshNotReadableHelpBox(Mesh mesh, string componentName) if (CanMeshBeModifiedFromCode(meshPath)) { if (DrawWarningHelpBoxWithButton( - EditorGUIUtility.TrTextContent(message), - EditorGUIUtility.TrTextContent("Enable"))) + L10n.TextContent(message, null, null, null), + L10n.TextContent("Enable", null, null, null))) { ImportMeshAsReadable(mesh); } @@ -379,8 +379,8 @@ internal static void DrawMeshNotReadableHelpBox(Mesh mesh, string componentName) else { if (DrawWarningHelpBoxWithButton( - EditorGUIUtility.TrTextContent(message), - EditorGUIUtility.TrTextContent("View"))) + L10n.TextContent(message, null, null, null), + L10n.TextContent("View", null, null, null))) { Selection.objects = new UnityEngine.Object[] { mesh }; } diff --git a/Editor/Mono/Loadable/LoadableObjectIdEditorUtility.cs b/Editor/Mono/Loadable/LoadableObjectIdEditorUtility.cs index d77176490e..36a41ae923 100644 --- a/Editor/Mono/Loadable/LoadableObjectIdEditorUtility.cs +++ b/Editor/Mono/Loadable/LoadableObjectIdEditorUtility.cs @@ -56,8 +56,8 @@ internal static string GetLoadableObjectIdTooltip() /// public static bool TryDeconstructLoadableObjectId(LoadableObjectId loadableObjectId, out GUID guid, out long localId, out FileIdentifierType fileType) { - // If this is a runtime handle (has ObjectIdHash), we cannot extract GUID/lfid/type - if (loadableObjectId.m_ObjectIdHash.isValid) + // If this is a baked runtime handle (has a stable file id), we cannot extract GUID/lfid/type + if (loadableObjectId.m_StableFileId.isValid) { guid = new GUID(); localId = 0; @@ -142,7 +142,7 @@ public static LoadableObjectId CreateLoadableObjectId(GUID guid, FileIdentifierT loadableObjectId.m_GUID = guid; loadableObjectId.m_FileIdentifierType = fileType; loadableObjectId.m_LocalIdentifierInFile = localId; - loadableObjectId.m_ObjectIdHash = new Hash128(); + loadableObjectId.m_StableFileId = new Hash128(); return loadableObjectId; } diff --git a/Editor/Mono/MaterialProperty.cs b/Editor/Mono/MaterialProperty.cs index 46559ea775..00d8ec6cfd 100644 --- a/Editor/Mono/MaterialProperty.cs +++ b/Editor/Mono/MaterialProperty.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SRPFoundation not yet converted using System; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -249,14 +248,14 @@ private static class Styles static readonly Color overrideLineColor_d = new Color32(0xC4, 0xC4, 0xC4, 0xFF); public static Color overrideLineColor { get { return EditorGUIUtility.isProSkin ? overrideLineColor_d : overrideLineColor_l; } } - public static readonly GUIContent revertContent = EditorGUIUtility.TrTextContent("Revert"); - public static readonly GUIContent revertAllContent = EditorGUIUtility.TrTextContent("Revert all Overrides"); - public static readonly GUIContent lockContent = EditorGUIUtility.TrTextContent("Lock in children"); - public static readonly GUIContent lockOriginContent = EditorGUIUtility.TrTextContent("See lock origin"); + public static readonly GUIContent revertContent = L10n.TextContent("Revert", null, null, null); + public static readonly GUIContent revertAllContent = L10n.TextContent("Revert all Overrides", null, null, null); + public static readonly GUIContent lockContent = L10n.TextContent("Lock in children", null, null, null); + public static readonly GUIContent lockOriginContent = L10n.TextContent("See lock origin", null, null, null); - public static readonly GUIContent resetContent = EditorGUIUtility.TrTextContent("Reset"); - public static readonly GUIContent copyContent = EditorGUIUtility.TrTextContent("Copy"); - public static readonly GUIContent pasteContent = EditorGUIUtility.TrTextContent("Paste"); + public static readonly GUIContent resetContent = L10n.TextContent("Reset", null, null, null); + public static readonly GUIContent copyContent = L10n.TextContent("Copy", null, null, null); + public static readonly GUIContent pasteContent = L10n.TextContent("Paste", null, null, null); [NoAutoStaticsCleanup] // capture-less editor icon loaded by fixed name; survives reload static readonly Texture lockInChildrenIcon = EditorGUIUtility.IconContent("HierarchyLock").image; @@ -400,7 +399,7 @@ public static void DoPropertyContextMenu(bool lockMenusOnly, Object[] targets, b { if (menu.GetItemCount() != 0) menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Copy Property Name"), false, () => EditorGUIUtility.systemCopyBuffer = capturedProperties[0].name); + menu.AddItem(L10n.TextContent("Copy Property Name", null, null, null), false, () => EditorGUIUtility.systemCopyBuffer = capturedProperties[0].name); } if (menu.GetItemCount() == 0) @@ -842,4 +841,3 @@ static bool IsRegistered(MaterialProperty prop, MaterialSerializedProperty seria } } } // namespace UnityEngine.Rendering -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Menu.bindings.cs b/Editor/Mono/Menu.bindings.cs index a21293602c..e209f2cb52 100644 --- a/Editor/Mono/Menu.bindings.cs +++ b/Editor/Mono/Menu.bindings.cs @@ -35,6 +35,9 @@ public ScriptingMenuItem(string path, int priority = -1, bool isSeparator = fals public sealed partial class Menu { [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static event Action menuChanged; [NativeMethod("MenuController::SetChecked", true)] diff --git a/Editor/Mono/Modules/BeeBuildPostprocessor.cs b/Editor/Mono/Modules/BeeBuildPostprocessor.cs index 7dbd7848f3..cf4c36dbf7 100644 --- a/Editor/Mono/Modules/BeeBuildPostprocessor.cs +++ b/Editor/Mono/Modules/BeeBuildPostprocessor.cs @@ -281,6 +281,7 @@ LinkerConfig LinkerConfigFor(BuildPostProcessArgs args) { LinkXmlFiles = AssemblyStripper.GetLinkXmlFiles(args, linkerInputDirectory), EditorToLinkerData = AssemblyStripper.WriteEditorData(args, linkerInputDirectory), + ManagedCaptureConfigFile = AssemblyStripper.WriteManagedCaptureConfig(linkerInputDirectory), #pragma warning disable UAC2001 // Avoid Linq AssembliesToProcess = assembliesToProcess.ToArray(), #pragma warning restore UAC2001 diff --git a/Editor/Mono/Modules/DefaultBuildProfileExtension.cs b/Editor/Mono/Modules/DefaultBuildProfileExtension.cs index de6e950355..94102f9e51 100644 --- a/Editor/Mono/Modules/DefaultBuildProfileExtension.cs +++ b/Editor/Mono/Modules/DefaultBuildProfileExtension.cs @@ -15,20 +15,20 @@ namespace UnityEditor.Modules { internal abstract class DefaultBuildProfileExtension : IBuildProfileExtension { - static readonly GUIContent k_DevelopmentBuild = EditorGUIUtility.TrTextContent("Development Build"); - static readonly GUIContent k_AutoconnectProfiler = EditorGUIUtility.TrTextContent("Autoconnect Profiler", "When the build is started, an open Profiler Window will automatically connect to the Player and start profiling. The \"Build And Run\" option will also automatically open the Profiler Window."); - static readonly GUIContent k_AutoconnectProfilerDisabled = EditorGUIUtility.TrTextContent("Autoconnect Profiler", "Profiling is only enabled in a Development Player."); - static readonly GUIContent k_BuildWithDeepProfiler = EditorGUIUtility.TrTextContent("Deep Profiling Support", "Build Player with Deep Profiling Support. This might affect Player performance."); - static readonly GUIContent k_BuildWithDeepProfilerDisabled = EditorGUIUtility.TrTextContent("Deep Profiling Support", "Profiling is only enabled in a Development Player."); - static readonly GUIContent k_BuildWithCodeCoverage = EditorGUIUtility.TrTextContent("Code Coverage Support", "Build Player with Code Coverage Support. This might affect Player performance."); - static readonly GUIContent k_BuildWithCodeCoverageDisabled = EditorGUIUtility.TrTextContent("Code Coverage Support", "Code Coverage is only enabled in a Development Player."); - static readonly GUIContent k_AllowDebugging = EditorGUIUtility.TrTextContent("Script Debugging", "Enable this setting to allow your script code to be debugged."); - static readonly GUIContent k_WaitForManagedDebugger = EditorGUIUtility.TrTextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution. Can also use volume Up or Down button to confirm on Android."); - static readonly GUIContent k_ManagedDebuggerFixedPort = EditorGUIUtility.TrTextContent("Managed Debugger Fixed Port", "Use the specified port to attach to the managed debugger. If 0, the port will be automatically selected."); - static readonly GUIContent k_CompressionMethod = EditorGUIUtility.TrTextContent("Compression Method", "Compression applied to Player data (scenes and resources).\nDefault - none or default platform compression.\nLZ4 - fast compression suitable for Development Builds.\nLZ4HC - higher compression rate variance of LZ4, causes longer build times. Works best for Release Builds."); - static readonly GUIContent k_ExplicitNullChecks = EditorGUIUtility.TrTextContent("Explicit Null Checks"); - static readonly GUIContent k_ExplicitDivideByZeroChecks = EditorGUIUtility.TrTextContent("Divide By Zero Checks"); - static readonly GUIContent k_ExplicitArrayBoundsChecks = EditorGUIUtility.TrTextContent("Array Bounds Checks"); + static readonly GUIContent k_DevelopmentBuild = L10n.TextContent("Development Build", null, null, null); + static readonly GUIContent k_AutoconnectProfiler = L10n.TextContent("Autoconnect Profiler", "When the build is started, an open Profiler Window will automatically connect to the Player and start profiling. The \"Build And Run\" option will also automatically open the Profiler Window.", null, null); + static readonly GUIContent k_AutoconnectProfilerDisabled = L10n.TextContent("Autoconnect Profiler", "Profiling is only enabled in a Development Player.", null, null); + static readonly GUIContent k_BuildWithDeepProfiler = L10n.TextContent("Deep Profiling Support", "Build Player with Deep Profiling Support. This might affect Player performance.", null, null); + static readonly GUIContent k_BuildWithDeepProfilerDisabled = L10n.TextContent("Deep Profiling Support", "Profiling is only enabled in a Development Player.", null, null); + static readonly GUIContent k_BuildWithCodeCoverage = L10n.TextContent("Code Coverage Support", "Build Player with Code Coverage Support. This might affect Player performance.", null, null); + static readonly GUIContent k_BuildWithCodeCoverageDisabled = L10n.TextContent("Code Coverage Support", "Code Coverage is only enabled in a Development Player.", null, null); + static readonly GUIContent k_AllowDebugging = L10n.TextContent("Script Debugging", "Enable this setting to allow your script code to be debugged.", null, null); + static readonly GUIContent k_WaitForManagedDebugger = L10n.TextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution. Can also use volume Up or Down button to confirm on Android.", null, null); + static readonly GUIContent k_ManagedDebuggerFixedPort = L10n.TextContent("Managed Debugger Fixed Port", "Use the specified port to attach to the managed debugger. If 0, the port will be automatically selected.", null, null); + static readonly GUIContent k_CompressionMethod = L10n.TextContent("Compression Method", "Compression applied to Player data (scenes and resources).\nDefault - none or default platform compression.\nLZ4 - fast compression suitable for Development Builds.\nLZ4HC - higher compression rate variance of LZ4, causes longer build times. Works best for Release Builds.", null, null); + static readonly GUIContent k_ExplicitNullChecks = L10n.TextContent("Explicit Null Checks", null, null, null); + static readonly GUIContent k_ExplicitDivideByZeroChecks = L10n.TextContent("Divide By Zero Checks", null, null, null); + static readonly GUIContent k_ExplicitArrayBoundsChecks = L10n.TextContent("Array Bounds Checks", null, null, null); static readonly Compression[] k_CompressionTypes = { Compression.None, @@ -37,11 +37,11 @@ internal abstract class DefaultBuildProfileExtension : IBuildProfileExtension }; static readonly GUIContent[] k_CompressionStrings = { - EditorGUIUtility.TrTextContent("Default"), - EditorGUIUtility.TrTextContent("LZ4"), - EditorGUIUtility.TrTextContent("LZ4HC"), + L10n.TextContent("Default", null, null, null), + L10n.TextContent("LZ4", null, null, null), + L10n.TextContent("LZ4HC", null, null, null), }; - static readonly GUIContent k_InstallInBuildFolder = EditorGUIUtility.TrTextContent("Install into source code 'build' folder", "Install into source checkout 'build' folder, for debugging with source code"); + static readonly GUIContent k_InstallInBuildFolder = L10n.TextContent("Install into source code 'build' folder", "Install into source checkout 'build' folder, for debugging with source code", null, null); // Development build infobox static readonly string developmentBuildInfoBoxText = string.Format(L10n.Tr("Starting in Unity 6.6, part of the Development Build setting has been split out into the Managed Code Variant player setting. Click here for more information.", null), kDevelopmentBuildInfoBoxUrl); diff --git a/Editor/Mono/Modules/DefaultBuildWindowExtension.cs b/Editor/Mono/Modules/DefaultBuildWindowExtension.cs index e4a1a1a867..9c9e3edd60 100644 --- a/Editor/Mono/Modules/DefaultBuildWindowExtension.cs +++ b/Editor/Mono/Modules/DefaultBuildWindowExtension.cs @@ -11,9 +11,9 @@ internal class DefaultBuildWindowExtension : IBuildWindowExtension { internal class Styles { - public GUIContent runLastBuild = EditorGUIUtility.TrTextContent("Run Last Build", "Run the most recent build"); - public static readonly GUIContent patch = EditorGUIUtility.TrTextContent("Patch", "Compiles only the scripts and patches the previous build with the updated code."); - public static readonly GUIContent patchAndRun = EditorGUIUtility.TrTextContent("Patch And Run", "Compiles only the scripts, patches the previous build with the updated code, then runs the build."); + public GUIContent runLastBuild = L10n.TextContent("Run Last Build", "Run the most recent build", null, null); + public static readonly GUIContent patch = L10n.TextContent("Patch", "Compiles only the scripts and patches the previous build with the updated code.", null, null); + public static readonly GUIContent patchAndRun = L10n.TextContent("Patch And Run", "Compiles only the scripts, patches the previous build with the updated code, then runs the build.", null, null); } [NoAutoStaticsCleanup] // lazy GUIContent Styles cache; content survives reload, re-inits on first access diff --git a/Editor/Mono/Modules/DefaultPlayerSettingsEditorExtension.cs b/Editor/Mono/Modules/DefaultPlayerSettingsEditorExtension.cs index d78dd109c4..ed7aacf9fa 100644 --- a/Editor/Mono/Modules/DefaultPlayerSettingsEditorExtension.cs +++ b/Editor/Mono/Modules/DefaultPlayerSettingsEditorExtension.cs @@ -125,7 +125,7 @@ public virtual bool SupportsFrameTimingStatistics() public virtual void SerializedObjectUpdated() {} protected SerializedProperty m_MTRendering; - private static readonly GUIContent m_MTRenderingTooltip = EditorGUIUtility.TrTextContent("Multithreaded Rendering*"); + private static readonly GUIContent m_MTRenderingTooltip = L10n.TextContent("Multithreaded Rendering*", null, null, null); protected virtual GUIContent MultithreadedRenderingGUITooltip() { diff --git a/Editor/Mono/Modules/DefaultTextureImportSettingsExtension.cs b/Editor/Mono/Modules/DefaultTextureImportSettingsExtension.cs index a2a8a89e98..c01c027510 100644 --- a/Editor/Mono/Modules/DefaultTextureImportSettingsExtension.cs +++ b/Editor/Mono/Modules/DefaultTextureImportSettingsExtension.cs @@ -20,31 +20,31 @@ internal class DefaultTextureImportSettingsExtension : ITextureImportSettingsExt { static readonly string[] kMaxTextureSizeStrings = { "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192", "16384" }; static readonly int[] kMaxTextureSizeValues = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384 }; - static readonly GUIContent maxSize = EditorGUIUtility.TrTextContent("Max Size", "Textures larger than this will be scaled down."); + static readonly GUIContent maxSize = L10n.TextContent("Max Size", "Textures larger than this will be scaled down.", null, null); static readonly string kMaxSizeOverrideString = L10n.Tr("Max texture size is overriden to {0} in Build Settings window.", null); static readonly string[] kResizeAlgorithmStrings = { "Mitchell", "Bilinear" }; static readonly int[] kResizeAlgorithmValues = { (int)TextureResizeAlgorithm.Mitchell, (int)TextureResizeAlgorithm.Bilinear }; - static readonly GUIContent kResizeAlgorithm = EditorGUIUtility.TrTextContent("Resize Algorithm", "Select algorithm to apply for textures when scaled down."); - static readonly GUIContent kTextureFormat = EditorGUIUtility.TrTextContent("Format"); - static readonly GUIContent kTextureCompression = EditorGUIUtility.TrTextContent("Compression", "How will this texture be compressed?"); - static readonly GUIContent kUseAlphaSplitLabel = EditorGUIUtility.TrTextContent("Split Alpha Channel", "Alpha for this texture will be preserved by splitting the alpha channel to another texture, and both resulting textures will be compressed using ETC1."); - static readonly GUIContent kCrunchedCompression = EditorGUIUtility.TrTextContent("Use Crunch Compression", "Texture is crunch-compressed to save space on disk when applicable."); - static readonly GUIContent kCompressionQuality = EditorGUIUtility.TrTextContent("Compressor Quality"); - static readonly GUIContent kCompressionQualitySlider = EditorGUIUtility.TrTextContent("Compressor Quality", "Use the slider to adjust compression quality from 0 (Fastest) to 100 (Best)"); + static readonly GUIContent kResizeAlgorithm = L10n.TextContent("Resize Algorithm", "Select algorithm to apply for textures when scaled down.", null, null); + static readonly GUIContent kTextureFormat = L10n.TextContent("Format", null, null, null); + static readonly GUIContent kTextureCompression = L10n.TextContent("Compression", "How will this texture be compressed?", null, null); + static readonly GUIContent kUseAlphaSplitLabel = L10n.TextContent("Split Alpha Channel", "Alpha for this texture will be preserved by splitting the alpha channel to another texture, and both resulting textures will be compressed using ETC1.", null, null); + static readonly GUIContent kCrunchedCompression = L10n.TextContent("Use Crunch Compression", "Texture is crunch-compressed to save space on disk when applicable.", null, null); + static readonly GUIContent kCompressionQuality = L10n.TextContent("Compressor Quality", null, null, null); + static readonly GUIContent kCompressionQualitySlider = L10n.TextContent("Compressor Quality", "Use the slider to adjust compression quality from 0 (Fastest) to 100 (Best)", null, null); static readonly GUIContent[] kMobileCompressionQualityOptions = { - EditorGUIUtility.TrTextContent("Fast"), - EditorGUIUtility.TrTextContent("Normal"), - EditorGUIUtility.TrTextContent("Best") + L10n.TextContent("Fast", null, null, null), + L10n.TextContent("Normal", null, null, null), + L10n.TextContent("Best", null, null, null) }; static readonly GUIContent[] kTextureCompressionOptions = { - EditorGUIUtility.TrTextContent("None", "Texture is not compressed."), - EditorGUIUtility.TrTextContent("Low Quality", "Texture compressed with low quality but high performance, high compression format."), - EditorGUIUtility.TrTextContent("Normal Quality", "Texture is compressed with a standard format."), - EditorGUIUtility.TrTextContent("High Quality", "Texture compressed with a high quality format."), + L10n.TextContent("None", "Texture is not compressed.", null, null), + L10n.TextContent("Low Quality", "Texture compressed with low quality but high performance, high compression format.", null, null), + L10n.TextContent("Normal Quality", "Texture is compressed with a standard format.", null, null), + L10n.TextContent("High Quality", "Texture compressed with a high quality format.", null, null), }; static readonly int[] kTextureCompressionValues = { diff --git a/Editor/Mono/Modules/ModuleManager.cs b/Editor/Mono/Modules/ModuleManager.cs index 352b4a1323..d0a575e10d 100644 --- a/Editor/Mono/Modules/ModuleManager.cs +++ b/Editor/Mono/Modules/ModuleManager.cs @@ -23,10 +23,16 @@ internal static partial class ModuleManager [NonSerialized] [AutoStaticsCleanupOnCodeReload] + // The platformSupportModules property calls RegisterPlatformSupportModules() whenever this is null, + // so the module set is rediscovered on the next access. + [IgnoreForUAL0015("Rediscovered by RegisterPlatformSupportModules() on the next access when null")] static Dictionary s_PlatformModules; [NonSerialized] [AutoStaticsCleanupOnCodeReload] + // The platformSupportModulesByGuid property calls RegisterPlatformSupportModules() whenever this is + // null, so the GUID index is rediscovered on the next access. + [IgnoreForUAL0015("Rediscovered by RegisterPlatformSupportModules() on the next access when null")] static Dictionary s_PlatformModulesByGuid; [NonSerialized] diff --git a/Editor/Mono/Modules/PlatformSDK/ConfigurableDerivedBuildTargetExtensions.cs b/Editor/Mono/Modules/PlatformSDK/ConfigurableDerivedBuildTargetExtensions.cs index 4c9f8e550c..27c12e9717 100644 --- a/Editor/Mono/Modules/PlatformSDK/ConfigurableDerivedBuildTargetExtensions.cs +++ b/Editor/Mono/Modules/PlatformSDK/ConfigurableDerivedBuildTargetExtensions.cs @@ -77,7 +77,7 @@ public string GetProfileInfoMessage() => m_BaseBuildProfileExtension.GetProfileInfoMessage(); public PreconfiguredSettingsVariant[] GetPreconfiguredSettingsVariants() => - m_SDKPlatformProvider.preconfiguredSettingsVariants; + BuildTargetDiscovery.BuildPlatformPreconfiguredSettingsVariants(m_SDKPlatformProvider.guid); public void OnBuildProfileCreated(BuildProfile buildProfile, int preconfiguredSettingsVariant) => m_SDKPlatformProvider.onDerivedPlatformBuildProfileCreated?.Invoke(buildProfile, preconfiguredSettingsVariant, m_BaseBuildProfileExtension.OnBuildProfileCreated); diff --git a/Editor/Mono/Modules/PlatformSDK/ConfigurableSDKPlatformExtension.cs b/Editor/Mono/Modules/PlatformSDK/ConfigurableSDKPlatformExtension.cs index 77aa18548e..28d0e5bf55 100644 --- a/Editor/Mono/Modules/PlatformSDK/ConfigurableSDKPlatformExtension.cs +++ b/Editor/Mono/Modules/PlatformSDK/ConfigurableSDKPlatformExtension.cs @@ -18,7 +18,6 @@ class ConfigurableSDKPlatformExtension : ISDKPlatformExtension public bool shouldShowBuildActions => sdkPlatformProvider.shouldShowBuildActions; public Type[] requiredComponents => sdkPlatformProvider.requiredComponents; public Type[] customFooterActions => sdkPlatformProvider.customFooterActions; - public PreconfiguredSettingsVariant[] preconfiguredSettingsVariants => sdkPlatformProvider.preconfiguredSettingsVariants; public void OnMultiTargetBuildProfileCreated(BuildProfile buildProfile, int preconfiguredSettingsVariant) { diff --git a/Editor/Mono/Modules/PlatformSDK/ISDKPlatformExtension.cs b/Editor/Mono/Modules/PlatformSDK/ISDKPlatformExtension.cs index 4cfd13da7c..ed3bd4554e 100644 --- a/Editor/Mono/Modules/PlatformSDK/ISDKPlatformExtension.cs +++ b/Editor/Mono/Modules/PlatformSDK/ISDKPlatformExtension.cs @@ -20,7 +20,6 @@ internal interface ISDKPlatformExtension bool shouldShowBuildActions { get; } Type[] requiredComponents { get; } Type[] customFooterActions { get; } - PreconfiguredSettingsVariant[] preconfiguredSettingsVariants { get; } void OnMultiTargetBuildProfileCreated(BuildProfile buildProfile, int preconfiguredSettingsVariant); } diff --git a/Editor/Mono/Modules/PlatformSDK/SDKPlatformProvider.cs b/Editor/Mono/Modules/PlatformSDK/SDKPlatformProvider.cs index 345bb9dd30..e5b161e971 100644 --- a/Editor/Mono/Modules/PlatformSDK/SDKPlatformProvider.cs +++ b/Editor/Mono/Modules/PlatformSDK/SDKPlatformProvider.cs @@ -3,7 +3,6 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; -using System.Collections.Generic; using UnityEditor.Build.Profile; using UnityEngine; @@ -30,7 +29,6 @@ class SDKPlatformProvider public bool shouldShowBuildActions { get; private set; } = true; public Type[] requiredComponents { get; private set; } = []; public Type[] customFooterActions { get; private set; } = []; - public PreconfiguredSettingsVariant[] preconfiguredSettingsVariants { get; private set; } = []; public Action onMultiTargetPlatformBuildProfileCreated { get; private set; } public Action> onDerivedPlatformBuildProfileCreated { get; private set; } @@ -44,7 +42,6 @@ class SDKPlatformProvider const string k_ShouldShowBuildActions = "shouldShowBuildActions"; const string k_RequiredComponents = "requiredComponents"; const string k_FooterActions = "customFooterActions"; - const string k_PreconfiguredSettingsVariants = "preconfiguredSettingsVariants"; const string k_OnMultiTargetPlatformBuildProfileCreated = "OnMultiTargetPlatformBuildProfileCreated"; const string k_OnDerivedPlatformBuildProfileCreated = "OnDerivedPlatformBuildProfileCreated"; @@ -55,9 +52,6 @@ class SDKPlatformProvider static readonly string k_UnrecognizedVersionError = L10n.Tr("unrecognized version {0}.", null); static readonly string k_RequiredPropertyError = L10n.Tr("required property '{0}' is missing.", null); static readonly string k_PropertyTypeError = L10n.Tr("property '{0}' must be of type {1}.", null); - static readonly string k_DuplicatePreconfiguredSettingsVariantsError = L10n.Tr( - "{0} declares preconfigured settings variants while SDK platform '{1}' also declares them in its manifest. " + - "The manifest variants are used; remove the '{2}' property from the provider.", null); SDKPlatformProvider(IPlatformProvider provider, SDKPlatformType platformType) { @@ -91,26 +85,6 @@ void FetchProviderProperties(IPlatformProvider provider) requiredComponents = GetProp(k_RequiredComponents, Array.Empty()); customFooterActions = GetProp(k_FooterActions, Array.Empty()); - preconfiguredSettingsVariants = BuildTargetDiscovery.BuildPlatformPreconfiguredSettingsVariants(guid); - var extractedVariants = GetProp(k_PreconfiguredSettingsVariants, Array.Empty()); - if (preconfiguredSettingsVariants.Length > 0) - { - if (extractedVariants.Length > 0) - Debug.LogError(string.Format(k_DuplicatePreconfiguredSettingsVariantsError, providerType.FullName, guid, k_PreconfiguredSettingsVariants)); - } - else - { - var variantList = new List(); - foreach (var variant in extractedVariants) - { - if (variant == null) - continue; - var newVariant = new PreconfiguredSettingsVariant(variant.displayName, variant.selectedInitially, variant.description, variant.tooltip, variant.platformGuid); - variantList.Add(newVariant); - } - preconfiguredSettingsVariants = variantList.ToArray(); - } - T GetProp(string propName, T defaultValue) { var prop = providerType.GetProperty(propName); diff --git a/Editor/Mono/Modules/PlatformSDK/SDKPublicAPI.cs b/Editor/Mono/Modules/PlatformSDK/SDKPublicAPI.cs index 5c055af702..174d380aee 100644 --- a/Editor/Mono/Modules/PlatformSDK/SDKPublicAPI.cs +++ b/Editor/Mono/Modules/PlatformSDK/SDKPublicAPI.cs @@ -14,24 +14,3 @@ public interface IPlatformProvider /// int version { get; } } - -/// -/// Class representing a preconfigured settings variant for a Derived platform SDK platform. -/// -public class SDKPreconfiguredSettingsVariant -{ - public string displayName { get; } - public string description { get; } - public string tooltip { get; } - public bool selectedInitially { get; } - public UnityEngine.GUID platformGuid { get; } - - public SDKPreconfiguredSettingsVariant(string displayName, string description, string tooltip, bool selectedInitially = false, UnityEngine.GUID platformGuid = default) - { - this.displayName = displayName; - this.description = description; - this.tooltip = tooltip; - this.selectedInitially = selectedInitially; - this.platformGuid = platformGuid; - } -} diff --git a/Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs b/Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs index da417ac3b7..eb87f7ee83 100644 --- a/Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs +++ b/Editor/Mono/Networking/PlayerConnection/AttachToPlayerGUI.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Kernel not yet converted using System; using System.Collections.Generic; using UnityEditor.Hardware; @@ -46,7 +45,7 @@ internal static IConnectionState GetConnectionState(EditorWindow parentWindow, A static class Styles { public static readonly GUIStyle defaultDropdown = "MiniPullDown"; - public static readonly GUIContent dropdownButton = UnityEditor.EditorGUIUtility.TrTextContent("", "Target Selection: Choose the target to connect to."); + public static readonly GUIContent dropdownButton = UnityEditor.L10n.TextContent("", "Target Selection: Choose the target to connect to.", null, null); } public static partial class PlayerConnectionGUI @@ -99,11 +98,11 @@ internal class GeneralConnectionState : IConnectionStateInternal { internal static class Content { - public static readonly GUIContent Playmode = UnityEditor.EditorGUIUtility.TrTextContent("Play Mode"); - public static readonly GUIContent Editmode = UnityEditor.EditorGUIUtility.TrTextContent("Edit Mode"); - public static readonly GUIContent EnterIPText = UnityEditor.EditorGUIUtility.TrTextContent(""); - public static readonly GUIContent AutoconnectedPlayer = UnityEditor.EditorGUIUtility.TrTextContent("(Autoconnected Player)"); - public static readonly GUIContent ConnectingToPlayerMessage = UnityEditor.EditorGUIUtility.TrTextContent("Connecting to player... (this can take a while)"); + public static readonly GUIContent Playmode = UnityEditor.L10n.TextContent("Play Mode", null, null, null); + public static readonly GUIContent Editmode = UnityEditor.L10n.TextContent("Edit Mode", null, null, null); + public static readonly GUIContent EnterIPText = UnityEditor.L10n.TextContent("", null, null, null); + public static readonly GUIContent AutoconnectedPlayer = UnityEditor.L10n.TextContent("(Autoconnected Player)", null, null, null); + public static readonly GUIContent ConnectingToPlayerMessage = UnityEditor.L10n.TextContent("Connecting to player... (this can take a while)", null, null, null); public static readonly string LocalHostProhibited = L10n.Tr(" (Localhost prohibited)", null); public static readonly string VersionMismatch = L10n.Tr(" (Version mismatch)", null); @@ -425,7 +424,7 @@ internal class AttachToPlayerPlayerIPWindow : EditorWindow { static class Content { - public static readonly GUIContent ConnectButtonContent = UnityEditor.EditorGUIUtility.TrTextContent("Connect"); + public static readonly GUIContent ConnectButtonContent = UnityEditor.L10n.TextContent("Connect", null, null, null); public static readonly string EnterPlayerIPWindowName = L10n.Tr("Enter Player IP", null); } private const string k_TextFieldControlId = "IPWindow"; @@ -485,4 +484,3 @@ void OnGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs b/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs index ed95c7b643..c2659b07a3 100644 --- a/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs +++ b/Editor/Mono/Networking/PlayerConnection/ConnectionDropDown.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Kernel not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -610,8 +609,13 @@ internal partial class ConnectionTreeViewWindow : PopupWindowContent private ConnectionDropDownMultiColumnHeader multiColumnHeader; private IConnectionStateInternal state; [AutoStaticsCleanupOnCodeReload] + // Column layout for the connection dropdown, which a code reload closes; the next open finds + // this null and rebuilds it with CreateDefaultMultiColumnHeaderState. + [IgnoreForUAL0015("Column layout rebuilt by CreateDefaultMultiColumnHeaderState on the next open")] private static MultiColumnHeaderState multiColumnHeaderState; [AutoStaticsCleanupOnCodeReload] + // Rebuilt together with the column state above when the dropdown is next opened. + [IgnoreForUAL0015("Tree view state rebuilt alongside the column layout on the next open")] private static TreeViewState treeViewState; private List connectionItems; [AutoStaticsCleanupOnCodeReload] @@ -633,18 +637,18 @@ public ConnectionTreeViewWindow(IConnectionStateInternal internalState, Rect rec treeViewState = new TreeViewState(); multiColumnHeaderState = CreateDefaultMultiColumnHeaderState(100); #pragma warning restore UAL0015 - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // the header and tree view live on this popup content instance, which only exists while the connection dropdown is open — a code reload closes the dropdown, and the next open finds the cleared statics and rebuilds the state together with the views that read it multiColumnHeader = new ConnectionDropDownMultiColumnHeader(multiColumnHeaderState); m_connectionTreeView = new ConnectionTreeView(treeViewState, multiColumnHeader, ClosePopUp) { dropDownItems = connectionItems }; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 SetMinColumnWidths(); return; } - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // the header and tree view live on this popup content instance, which only exists while the connection dropdown is open — a code reload closes the dropdown, and the next open finds the cleared statics and rebuilds the state together with the views that read it multiColumnHeader = new ConnectionDropDownMultiColumnHeader(multiColumnHeaderState); m_connectionTreeView = new ConnectionTreeView(treeViewState, multiColumnHeader, ClosePopUp) { dropDownItems = connectionItems }; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 } static class Content @@ -938,4 +942,3 @@ public void SetLoggingOptions(ConsoleWindow.ConsoleAttachToPlayerState state) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ObjectListArea.cs b/Editor/Mono/ObjectListArea.cs index e1e288652e..c5bb659fd4 100644 --- a/Editor/Mono/ObjectListArea.cs +++ b/Editor/Mono/ObjectListArea.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ProjectBrowser not yet converted using System; using Unity.Scripting.LifecycleManagement; using UnityEngine; @@ -73,7 +72,7 @@ static class Styles public static readonly GUIStyle subAssetExpandButtonMedium = new GUIStyle("ProjectBrowserSubAssetExpandBtnMedium"); public static readonly GUIStyle subAssetExpandButtonSmall = new GUIStyle("ProjectBrowserSubAssetExpandBtnSmall"); - public static readonly GUIContent maxmumItemCountInfo = EditorGUIUtility.TrTextContent("NOTE: Maximum item count is reached, not all items are shown. Narrow your search."); + public static readonly GUIContent maxmumItemCountInfo = L10n.TextContent("NOTE: Maximum item count is reached, not all items are shown. Narrow your search.", null, null, null); } // State persisted across assembly reloads @@ -1474,4 +1473,3 @@ Vector2 CalculatePingPosition() } } } // namespace UnityEditor -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ObjectSelector.cs b/Editor/Mono/ObjectSelector.cs index 2e7860d590..9a4e785859 100644 --- a/Editor/Mono/ObjectSelector.cs +++ b/Editor/Mono/ObjectSelector.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ProjectBrowser not yet converted using System; using Unity.Scripting.LifecycleManagement; using System.Collections.Generic; @@ -42,10 +41,10 @@ static class Styles public static readonly GUIStyle previewBackground = "PopupCurveSwatchBackground"; // TODO: Make dedicated style public static readonly GUIStyle previewTextureBackground = "ObjectPickerPreviewBackground"; // TODO: Make dedicated style - public static readonly GUIContent assetsTabLabel = EditorGUIUtility.TrTextContent("Assets"); - public static readonly GUIContent sceneTabLabel = EditorGUIUtility.TrTextContent("Scene"); + public static readonly GUIContent assetsTabLabel = L10n.TextContent("Assets", null, null, null); + public static readonly GUIContent sceneTabLabel = L10n.TextContent("Scene", null, null, null); - public static readonly GUIContent packagesVisibilityContent = EditorGUIUtility.TrIconContent("SceneViewVisibility", "Number of hidden packages, click to toggle packages visibility"); + public static readonly GUIContent packagesVisibilityContent = L10n.IconContent("SceneViewVisibility", "Number of hidden packages, click to toggle packages visibility", null); public const string rootName = "unity-object-selector"; public const string headerName = rootName + "__header"; @@ -243,6 +242,9 @@ internal static void DestroySharedSelector() // get an existing ObjectSelector or create one [AutoStaticsCleanupOnCodeReload] + // Shared window cache: the get accessor rediscovers an existing ObjectSelector with + // FindObjectsOfTypeAll and otherwise creates one, so it comes back on the next access. + [IgnoreForUAL0015("Shared window cache rediscovered or recreated on demand by the get accessor")] static ObjectSelector s_SharedObjectSelector = null; public static ObjectSelector get { @@ -760,7 +762,7 @@ void SharedShow(UnityObject obj, RequiredTypeList typeList, UnityObject objectBe var shouldRepositionWindow = m_Parent != null; ShowWithMode(ShowMode.AuxWindow); - titleContent = EditorGUIUtility.TrTextContent(typeList.GenerateTitleContent()); + titleContent = L10n.TextContent(typeList.GenerateTitleContent(), null, null, null); // Deal with window size if (shouldRepositionWindow) @@ -1448,4 +1450,3 @@ static void FindShortcut(ShortcutArguments args) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/DynamicPanelOverlayContainer.cs b/Editor/Mono/Overlays/DynamicPanelOverlayContainer.cs index ab5a3ceed7..0db5930282 100644 --- a/Editor/Mono/Overlays/DynamicPanelOverlayContainer.cs +++ b/Editor/Mono/Overlays/DynamicPanelOverlayContainer.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using Unity.Collections; @@ -1063,4 +1062,3 @@ internal void ApplySaveData(ContainerSaveData save) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/MainToolbar.cs b/Editor/Mono/Overlays/MainToolbar.cs index ac9a322e8e..9be1f2b278 100644 --- a/Editor/Mono/Overlays/MainToolbar.cs +++ b/Editor/Mono/Overlays/MainToolbar.cs @@ -8,6 +8,7 @@ using UnityEngine; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; +using UnityEditor.ShortcutManagement; namespace UnityEditor.Toolbars { @@ -87,6 +88,24 @@ public static void Refresh(string path) overlay.RebuildContent(); } + public enum PickerMode + { + All, + ToolbarElements, + MenuItems, + } + + public static void OpenMainToolbarPicker(string filter) => OpenMainToolbarPicker(PickerMode.All, filter); + + public static void OpenMainToolbarPicker(PickerMode mode = PickerMode.All, string filter = null) => + MainToolbarWindow.RaisePickerRequested(mode, filter ?? string.Empty); + + [Shortcut("Main Toolbar/Open Toolbar Elements Picker")] + internal static void OpenToolbarElementsPickerShortcut() => OpenMainToolbarPicker(PickerMode.ToolbarElements); + + [Shortcut("Main Toolbar/Open Menu Items Picker")] + internal static void OpenMenuItemsPickerShortcut() => OpenMainToolbarPicker(PickerMode.MenuItems); + internal static void ShowAll(string path) { SetDisplayedAll(path, true); @@ -97,18 +116,43 @@ internal static void HideAll(string path) SetDisplayedAll(path, false); } - static void SetDisplayedAll(string startsWith, bool displayed) + // Skips overlays GetSortedAvailableOverlays treats as unavailable; pinned menu items have no createElementMethod but still count. + static IEnumerable EnumerateAvailableOverlaysUnder(string path) { if (!windowExists) - return; + yield break; foreach (var overlay in window.overlayCanvas.overlays) { - if (overlay.id.StartsWith(startsWith, StringComparison.Ordinal)) + if (!overlay.id.StartsWith(path, StringComparison.Ordinal)) + continue; + if (overlay is MainToolbarOverlay mto && !mto.IsAvailable()) + continue; + yield return overlay; + } + } + + // Enables every element under the path if any of them is currently hidden, otherwise disables them all. + internal static void ToggleAll(string path) + { + var anyHidden = false; + foreach (var overlay in EnumerateAvailableOverlaysUnder(path)) + { + if (!overlay.displayed) { - overlay.displayed = displayed; + anyHidden = true; + break; } } + + SetDisplayedAll(path, anyHidden); + } + + static void SetDisplayedAll(string startsWith, bool displayed) + { + // Same set ToggleAll counts, so the decision and the write can't disagree. + foreach (var overlay in EnumerateAvailableOverlaysUnder(startsWith)) + overlay.displayed = displayed; } internal static bool TryGetOverlay(string path, out Overlay overlay) @@ -123,6 +167,9 @@ internal static bool TryGetOverlay(string path, out Overlay overlay) } [AutoStaticsCleanupOnCodeReload] + // GetAllElementDefinitions re-creates or clears this and refills it from TypeCache every time the + // element definitions are collected. + [IgnoreForUAL0015("Availability-method map rebuilt from TypeCache by GetAllElementDefinitions")] static Dictionary s_PathToAvailabilityMethods; internal static List GetAllElementDefinitions() { @@ -196,6 +243,100 @@ internal static List GetAllElementDefinitions() return m_Definitions; } + internal static List<(Overlay overlay, MainToolbarElementAttribute attrib, bool isUnityOnly)> GetSortedAvailableOverlays() + { + var result = new List<(Overlay overlay, MainToolbarElementAttribute attrib, bool isUnityOnly)>(); + if (!windowExists) + return result; + + var overlays = new List<(Overlay overlay, MainToolbarElementAttribute attrib)>(); + var unityOnlyOverlays = new HashSet(); + + foreach (var overlay in window.overlayCanvas.overlays) + { + // Same guard as EnumerateAvailableOverlaysUnder: not every entry on this canvas is a MainToolbarOverlay. + if (overlay is not MainToolbarOverlay mto || mto.createElementMethod == null) + continue; // Dynamically-created overlay (e.g. a pinned menu item); not part of this list. + + if (!mto.IsAvailable()) + continue; + + overlays.Add((overlay, mto.createElementMethod.GetCustomAttribute())); + if (mto.createElementMethod.GetCustomAttribute() != null) + unityOnlyOverlays.Add(overlay); + } + + overlays.Sort((a, b) => + { + if (unityOnlyOverlays.Contains(a.overlay) && !unityOnlyOverlays.Contains(b.overlay)) + return -1; + if (unityOnlyOverlays.Contains(b.overlay) && !unityOnlyOverlays.Contains(a.overlay)) + return 1; + + var cmp = a.attrib.menuPriority.CompareTo(b.attrib.menuPriority); + if (cmp != 0) + return cmp; + + cmp = string.Compare(a.attrib.path, b.attrib.path, StringComparison.OrdinalIgnoreCase); + if (cmp != 0) + return cmp; + + return ((int)a.attrib.defaultDockPosition * 100 + a.attrib.defaultDockIndex) + .CompareTo((int)b.attrib.defaultDockPosition * 100 + b.attrib.defaultDockIndex); + }); + + foreach (var pair in overlays) + result.Add((pair.overlay, pair.attrib, unityOnlyOverlays.Contains(pair.overlay))); + + return result; + } + + // Cached so every FetchItems call doesn't re-fetch and re-sort the overlay list; invalidated by MainToolbarPicker at Open()/OnDisable(). + [AutoStaticsCleanupOnCodeReload] + static List<(Overlay overlay, MainToolbarElementAttribute attrib, bool isUnityOnly)> s_PickerOverlayCache; + + internal static List<(Overlay overlay, MainToolbarElementAttribute attrib, bool isUnityOnly)> GetSortedAvailableOverlaysCached() + => s_PickerOverlayCache ??= GetSortedAvailableOverlays(); + + // Maps every path here, and each of its ancestor category prefixes, to its index above; lets StableIdComparer sort by menu order instead of alphabetically. + [AutoStaticsCleanupOnCodeReload] + static Dictionary s_PickerElementSortRanks; + + internal static bool TryGetElementSortRank(string path, out int rank) + { + s_PickerElementSortRanks ??= BuildElementSortRanks(); + return s_PickerElementSortRanks.TryGetValue(path, out rank); + } + + static Dictionary BuildElementSortRanks() + { + var ranks = new Dictionary(); + var overlays = GetSortedAvailableOverlaysCached(); + for (var i = 0; i < overlays.Count; ++i) + { + var path = overlays[i].attrib.path; + ranks.TryAdd(path, i); + + // Every ancestor category gets the rank of its earliest child, the first time it's seen. + var separatorIndex = path.LastIndexOf('/'); + while (separatorIndex >= 0) + { + path = path.Substring(0, separatorIndex); + ranks.TryAdd(path, i); + separatorIndex = path.LastIndexOf('/'); + } + } + return ranks; + } + + internal static void InvalidatePickerOverlayCache() + { + s_PickerOverlayCache = null; + s_PickerElementSortRanks = null; + } + + internal static bool IsMenuItemPinned(string menuPath) => OverlayCanvasesData.instance.ContainsPinnedMenuItem(menuPath); + internal static void ResetToUnityDefaultLayout() { window.overlayCanvas.ApplyPreset(new UnityOnlyToolbarPreset()); @@ -207,10 +348,14 @@ internal static void ResetToUnityDefaultLayout() internal const string menuItemOverlayIdPrefix = "Menu Items/"; + // MenuItemExists also matches submenu containers; ExtractSubmenus is empty only for a leaf, the only kind that's executable. + internal static bool IsExecutableMenuItem(string menuPath) => + Menu.MenuItemExists(menuPath) && Menu.ExtractSubmenus(menuPath).Length == 0; + // Returns null when menuPath no longer resolves to a real menu item, so no overlay is created at all. internal static MainToolbarOverlay CreateMenuItemOverlay(string menuPath) { - if (!Menu.MenuItemExists(menuPath)) + if (!IsExecutableMenuItem(menuPath)) return null; var defaultOverlayAttrib = new OverlayAttribute(); @@ -233,6 +378,10 @@ static string LastPathSegment(string path) internal static void PinMenuItem(string menuPath) { + // Must run before AddPinnedMenuItem, which persists to preferences immediately. + if (!IsExecutableMenuItem(menuPath)) + return; + if (!OverlayCanvasesData.instance.AddPinnedMenuItem(menuPath)) return; // already pinned - silent no-op diff --git a/Editor/Mono/Overlays/MainToolbarAnalytics.cs b/Editor/Mono/Overlays/MainToolbarAnalytics.cs index b4a23eda61..588e746e5a 100644 --- a/Editor/Mono/Overlays/MainToolbarAnalytics.cs +++ b/Editor/Mono/Overlays/MainToolbarAnalytics.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using UnityEditor.Overlays; @@ -399,4 +398,3 @@ void SendElementOrderChanged(MainToolbarOverlay overlay) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/MainToolbarElement.cs b/Editor/Mono/Overlays/MainToolbarElement.cs index 0400abb544..7579d05149 100644 --- a/Editor/Mono/Overlays/MainToolbarElement.cs +++ b/Editor/Mono/Overlays/MainToolbarElement.cs @@ -3,6 +3,7 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; +using UnityEngine; using UnityEngine.UIElements; namespace UnityEditor.Toolbars diff --git a/Editor/Mono/Overlays/MainToolbarOverlayContainer.cs b/Editor/Mono/Overlays/MainToolbarOverlayContainer.cs index 009fe27117..ba3985c9e2 100644 --- a/Editor/Mono/Overlays/MainToolbarOverlayContainer.cs +++ b/Editor/Mono/Overlays/MainToolbarOverlayContainer.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using UnityEngine; @@ -145,4 +144,3 @@ void UpdateSectionsWidth() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/Overlay.cs b/Editor/Mono/Overlays/Overlay.cs index 9746648c4d..9155b3364c 100644 --- a/Editor/Mono/Overlays/Overlay.cs +++ b/Editor/Mono/Overlays/Overlay.cs @@ -162,6 +162,8 @@ public string id internal string ussName => m_RootVisualElementName; [AutoStaticsCleanupOnCodeReload] + // Lazily reloaded with EditorGUIUtility.Load on the next access after cleanup nulls it. + [IgnoreForUAL0015("Lazy VisualTreeAsset cache, reloaded on demand after cleanup nulls it")] static VisualTreeAsset s_TreeAsset; event Action displayNameChanged; VisualElement m_ContentRoot; diff --git a/Editor/Mono/Overlays/OverlayCanvas.cs b/Editor/Mono/Overlays/OverlayCanvas.cs index dfea38bf3d..0e9ef78870 100644 --- a/Editor/Mono/Overlays/OverlayCanvas.cs +++ b/Editor/Mono/Overlays/OverlayCanvas.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using System.ComponentModel; @@ -302,6 +301,8 @@ public sealed partial class OverlayCanvas : ISerializationCallbackReceiver const string k_SceneContainersName = "overlay-scene-containers"; const string k_AnchoredContainerName = "AnchoredContainers"; [AutoStaticsCleanupOnCodeReload] + // Lazily reloaded with EditorGUIUtility.Load on the next use after cleanup nulls it. + [IgnoreForUAL0015("Lazy VisualTreeAsset cache, reloaded on demand after cleanup nulls it")] static VisualTreeAsset s_DropZoneTreeAsset; static SaveData defaultSaveData => new SaveData() @@ -1534,4 +1535,3 @@ internal DynamicPanelContainerData GetDynamicPanelOverlayContainerData(string co } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayDragger.cs b/Editor/Mono/Overlays/OverlayDragger.cs index 89205a04fe..0e3db7aab3 100644 --- a/Editor/Mono/Overlays/OverlayDragger.cs +++ b/Editor/Mono/Overlays/OverlayDragger.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using System.Collections.Generic; using UnityEngine; @@ -393,4 +392,3 @@ void OnDragEnd() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayMenuItem.cs b/Editor/Mono/Overlays/OverlayMenuItem.cs index af713b1fc6..a45d6ec7a6 100644 --- a/Editor/Mono/Overlays/OverlayMenuItem.cs +++ b/Editor/Mono/Overlays/OverlayMenuItem.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System.Collections.Generic; using UnityEngine.UIElements; @@ -197,4 +196,3 @@ void OnMouseEnter(MouseOverEvent evt) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayPopup.cs b/Editor/Mono/Overlays/OverlayPopup.cs index b407ee9604..352981d342 100644 --- a/Editor/Mono/Overlays/OverlayPopup.cs +++ b/Editor/Mono/Overlays/OverlayPopup.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using UnityEngine; using UnityEngine.UIElements; @@ -221,4 +220,3 @@ public static OverlayPopup CreateAtCanvasCenter(OverlayCanvas canvas, Overlay ov } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayPopupWindow.cs b/Editor/Mono/Overlays/OverlayPopupWindow.cs index fffc403fb2..389355b683 100644 --- a/Editor/Mono/Overlays/OverlayPopupWindow.cs +++ b/Editor/Mono/Overlays/OverlayPopupWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System.ComponentModel; using System.Linq; using UnityEngine; @@ -93,4 +92,3 @@ protected virtual void OnEnable() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayResizer.cs b/Editor/Mono/Overlays/OverlayResizer.cs index 8cee442d57..94880e5dec 100644 --- a/Editor/Mono/Overlays/OverlayResizer.cs +++ b/Editor/Mono/Overlays/OverlayResizer.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using UnityEngine; using UnityEngine.UIElements; @@ -384,4 +383,3 @@ void UpdateResizerVisibility() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Overlays/OverlayUtilities.cs b/Editor/Mono/Overlays/OverlayUtilities.cs index fce906e5a9..bb12aecee3 100644 --- a/Editor/Mono/Overlays/OverlayUtilities.cs +++ b/Editor/Mono/Overlays/OverlayUtilities.cs @@ -41,8 +41,14 @@ internal class OverlayEditorWindowAssociation } [AutoStaticsCleanupOnCodeReload] + // The overlays getter rebuilds the associations from TypeCache whenever this is null, so the array + // cleared on reload is recollected on the next access. + [IgnoreForUAL0015("Overlay/window association array rebuilt from TypeCache by the overlays getter")] static OverlayEditorWindowAssociation[] s_Overlays; [AutoStaticsCleanupOnCodeReload] + // Per-window-type memo: a miss re-derives the overlay list and adds it back, so the map cleared on + // reload (it must not keep old Type keys alive) refills on demand. + [IgnoreForUAL0015("Per-window-type overlay memo, re-derived on the next miss")] static readonly Dictionary> s_OverlaysTypeAssociations = new Dictionary>(); internal const string nullWindowTypeErrorMsg = "{0} editor window type cannot be null."; // used by tests diff --git a/Editor/Mono/PerformanceTools/FrameDebugger.cs b/Editor/Mono/PerformanceTools/FrameDebugger.cs index 469787be5c..86d90d504a 100644 --- a/Editor/Mono/PerformanceTools/FrameDebugger.cs +++ b/Editor/Mono/PerformanceTools/FrameDebugger.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: GraphicsDebuggingTools not yet converted using System; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -96,7 +95,7 @@ private static void OnCodeUnloading() private bool IsEnablingFrameDebugger => m_EnablingWaitCounter < k_NeedToRepaintFrames; private bool HasEventHashChanged => FrameDebuggerUtility.eventsHash != m_FrameEventsHash; - private readonly Lazy m_HelpButtonContent = new(() => EditorGUIUtility.TrIconContent("_Help", "Open Manual (in a web browser)")); + private readonly Lazy m_HelpButtonContent = new(() => L10n.IconContent("_Help", "Open Manual (in a web browser)", null)); [ShortcutManagement.Shortcut("Analysis/FrameDebugger/Enable")] @@ -110,7 +109,7 @@ public static void OpenWindowAndToggleEnabled() public static FrameDebuggerWindow OpenWindow() { var wnd = GetWindow(typeof(FrameDebuggerWindow)) as FrameDebuggerWindow; - wnd.titleContent = EditorGUIUtility.TrTextContent("Frame Debugger"); + wnd.titleContent = L10n.TextContent("Frame Debugger", null, null, null); wnd.minSize = new Vector2(1000f, 500f); return wnd; } @@ -543,4 +542,3 @@ internal void RepaintOnLimitChange() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PerformanceTools/FrameDebuggerStyles.cs b/Editor/Mono/PerformanceTools/FrameDebuggerStyles.cs index 4d817b18d9..2044c090a0 100644 --- a/Editor/Mono/PerformanceTools/FrameDebuggerStyles.cs +++ b/Editor/Mono/PerformanceTools/FrameDebuggerStyles.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: GraphicsDebuggingTools not yet converted using UnityEditor; using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -72,11 +71,11 @@ internal struct Tree // Top Toolbar internal struct TopToolbar { - internal static readonly GUIContent s_RecordButtonEnable = EditorGUIUtility.TrTextContent(L10n.Tr("Enable", null)); - internal static readonly GUIContent s_RecordButtonDisable = EditorGUIUtility.TrTextContent(L10n.Tr("Disable", null)); - internal static readonly GUIContent s_PrevFrame = EditorGUIUtility.TrIconContent("Profiler.PrevFrame", "Go back one frame"); - internal static readonly GUIContent s_NextFrame = EditorGUIUtility.TrIconContent("Profiler.NextFrame", "Go one frame forwards"); - internal static readonly GUIContent s_LevelsHeader = EditorGUIUtility.TrTextContent("Levels", "Render target display black/white intensity levels"); + internal static readonly GUIContent s_RecordButtonEnable = L10n.TextContent("Enable", null, null, null); + internal static readonly GUIContent s_RecordButtonDisable = L10n.TextContent("Disable", null, null, null); + internal static readonly GUIContent s_PrevFrame = L10n.IconContent("Profiler.PrevFrame", "Go back one frame", null); + internal static readonly GUIContent s_NextFrame = L10n.IconContent("Profiler.NextFrame", "Go one frame forwards", null); + internal static readonly GUIContent s_LevelsHeader = L10n.TextContent("Levels", "Render target display black/white intensity levels", null, null); } // Event Toolbar in the Event Details window @@ -110,28 +109,28 @@ internal struct EventToolbar fixedHeight = k_ToolbarHeight }; - internal static readonly GUIContent s_DepthLabel = EditorGUIUtility.TrTextContent("Depth", "Show depth buffer"); - internal static readonly GUIContent s_StencilLabel = EditorGUIUtility.TrTextContent("Stencil", "Show stencil buffer"); + internal static readonly GUIContent s_DepthLabel = L10n.TextContent("Depth", "Show depth buffer", null, null); + internal static readonly GUIContent s_StencilLabel = L10n.TextContent("Stencil", "Show stencil buffer", null, null); internal static readonly GUIContent[] s_ChannelLabels = new[] { - EditorGUIUtility.TrTextContent("R", "Shows the selected channel from the Render Target"), - EditorGUIUtility.TrTextContent("G", "Shows the selected channel from the Render Target"), - EditorGUIUtility.TrTextContent("B", "Shows the selected channel from the Render Target"), - EditorGUIUtility.TrTextContent("A", "Shows the selected channel from the Render Target"), + L10n.TextContent("R", "Shows the selected channel from the Render Target", null, null), + L10n.TextContent("G", "Shows the selected channel from the Render Target", null, null), + L10n.TextContent("B", "Shows the selected channel from the Render Target", null, null), + L10n.TextContent("A", "Shows the selected channel from the Render Target", null, null), }; - internal static readonly GUIContent s_LevelsHeader = EditorGUIUtility.TrTextContent("Levels", "Render target display black/white intensity levels"); + internal static readonly GUIContent s_LevelsHeader = L10n.TextContent("Levels", "Render target display black/white intensity levels", null, null); internal static readonly GUIContent[] s_MRTLabels = new[] { - EditorGUIUtility.TrTextContent("RT 0", "Show render target #0"), - EditorGUIUtility.TrTextContent("RT 1", "Show render target #1"), - EditorGUIUtility.TrTextContent("RT 2", "Show render target #2"), - EditorGUIUtility.TrTextContent("RT 3", "Show render target #3"), - EditorGUIUtility.TrTextContent("RT 4", "Show render target #4"), - EditorGUIUtility.TrTextContent("RT 5", "Show render target #5"), - EditorGUIUtility.TrTextContent("RT 6", "Show render target #6"), - EditorGUIUtility.TrTextContent("RT 7", "Show render target #7") + L10n.TextContent("RT 0", "Show render target #0", null, null), + L10n.TextContent("RT 1", "Show render target #1", null, null), + L10n.TextContent("RT 2", "Show render target #2", null, null), + L10n.TextContent("RT 3", "Show render target #3", null, null), + L10n.TextContent("RT 4", "Show render target #4", null, null), + L10n.TextContent("RT 5", "Show render target #5", null, null), + L10n.TextContent("RT 6", "Show render target #6", null, null), + L10n.TextContent("RT 7", "Show render target #7", null, null) }; } @@ -267,43 +266,43 @@ internal static float TwoColumnLabelWidth internal const string k_ErrorInvalidPlayerGUID = "Player GUID is invalid."; internal const string k_WarningPlayerNotSendingData = "No response from player. \nTry: Focus the player window, verify it's a Development Build, and check it uses MultiThreaded, LegacyJobified, or NativeGraphicsJobs threading mode."; - internal static readonly GUIContent s_RenderTargetText = EditorGUIUtility.TrTextContent("RenderTarget"); - internal static readonly GUIContent s_CopyEventText = EditorGUIUtility.TrTextContent("Copy Event Info"); - internal static readonly GUIContent s_CopyPropertyText = EditorGUIUtility.TrTextContent("Copy Property"); + internal static readonly GUIContent s_RenderTargetText = L10n.TextContent("RenderTarget", null, null, null); + internal static readonly GUIContent s_CopyEventText = L10n.TextContent("Copy Event Info", null, null, null); + internal static readonly GUIContent s_CopyPropertyText = L10n.TextContent("Copy Property", null, null, null); internal static readonly GUIContent[] s_FoldoutCopyText = { - EditorGUIUtility.TrTextContent("Copy Output"), - EditorGUIUtility.TrTextContent("Copy All Details"), - EditorGUIUtility.TrTextContent("Copy All Keyword Properties"), - EditorGUIUtility.TrTextContent("Copy All Texture Properties"), - EditorGUIUtility.TrTextContent("Copy All Integer Properties"), - EditorGUIUtility.TrTextContent("Copy All Float Properties"), - EditorGUIUtility.TrTextContent("Copy All Vector Properties"), - EditorGUIUtility.TrTextContent("Copy All Matrix Properties"), - EditorGUIUtility.TrTextContent("Copy All Buffer Properties"), - EditorGUIUtility.TrTextContent("Copy All Constant Buffer Properties") + L10n.TextContent("Copy Output", null, null, null), + L10n.TextContent("Copy All Details", null, null, null), + L10n.TextContent("Copy All Keyword Properties", null, null, null), + L10n.TextContent("Copy All Texture Properties", null, null, null), + L10n.TextContent("Copy All Integer Properties", null, null, null), + L10n.TextContent("Copy All Float Properties", null, null, null), + L10n.TextContent("Copy All Vector Properties", null, null, null), + L10n.TextContent("Copy All Matrix Properties", null, null, null), + L10n.TextContent("Copy All Buffer Properties", null, null, null), + L10n.TextContent("Copy All Constant Buffer Properties", null, null, null) }; - internal static readonly GUIContent s_RealShaderText = EditorGUIUtility.TrTextContent("Used Shader", "The shader used in this draw call."); - internal static readonly GUIContent s_OriginalShaderText = EditorGUIUtility.TrTextContent("Original Shader", "The shader originally set to be used in this draw call."); - internal static readonly GUIContent s_RayTracingShaderText = EditorGUIUtility.TrTextContent("Ray Tracing Shader", ""); - internal static readonly GUIContent s_RayTracingGenerationShaderText = EditorGUIUtility.TrTextContent("Ray Generation Shader", ""); - internal static readonly GUIContent s_ComputeShaderText = EditorGUIUtility.TrTextContent("Compute Shader", ""); - internal static readonly GUIContent s_ShadingRateImageText = EditorGUIUtility.TrTextContent("Shading Rate Image"); - internal static readonly GUIContent s_BatchCauseText = EditorGUIUtility.TrTextContent("Batch cause"); - internal static readonly GUIContent s_PassLightModeText = EditorGUIUtility.TrTextContent("Pass\nLightMode"); - internal static readonly GUIContent s_ArrayPopupButtonText = EditorGUIUtility.TrTextContent("..."); - internal static readonly GUIContent s_FoldoutOutputText = EditorGUIUtility.TrTextContent("Output"); - internal static readonly GUIContent s_FoldoutMeshText = EditorGUIUtility.TrTextContent("Meshes"); - internal static readonly GUIContent s_FoldoutMeshNotSupportedText = EditorGUIUtility.TrTextContent("Meshes - Not supported"); - internal static readonly GUIContent s_FoldoutEventDetailsText = EditorGUIUtility.TrTextContent("Details"); - internal static readonly GUIContent s_FoldoutTexturesText = EditorGUIUtility.TrTextContent("Textures"); - internal static readonly GUIContent s_FoldoutKeywordsText = EditorGUIUtility.TrTextContent("Keywords"); - internal static readonly GUIContent s_FoldoutFloatsText = EditorGUIUtility.TrTextContent("Floats"); - internal static readonly GUIContent s_FoldoutIntsText = EditorGUIUtility.TrTextContent("Ints"); - internal static readonly GUIContent s_FoldoutVectorsText = EditorGUIUtility.TrTextContent("Vectors"); - internal static readonly GUIContent s_FoldoutMatricesText = EditorGUIUtility.TrTextContent("Matrices"); - internal static readonly GUIContent s_FoldoutBuffersText = EditorGUIUtility.TrTextContent("Buffers"); - internal static readonly GUIContent s_FoldoutCBufferText = EditorGUIUtility.TrTextContent("Constant Buffers"); + internal static readonly GUIContent s_RealShaderText = L10n.TextContent("Used Shader", "The shader used in this draw call.", null, null); + internal static readonly GUIContent s_OriginalShaderText = L10n.TextContent("Original Shader", "The shader originally set to be used in this draw call.", null, null); + internal static readonly GUIContent s_RayTracingShaderText = L10n.TextContent("Ray Tracing Shader", "", null, null); + internal static readonly GUIContent s_RayTracingGenerationShaderText = L10n.TextContent("Ray Generation Shader", "", null, null); + internal static readonly GUIContent s_ComputeShaderText = L10n.TextContent("Compute Shader", "", null, null); + internal static readonly GUIContent s_ShadingRateImageText = L10n.TextContent("Shading Rate Image", null, null, null); + internal static readonly GUIContent s_BatchCauseText = L10n.TextContent("Batch cause", null, null, null); + internal static readonly GUIContent s_PassLightModeText = L10n.TextContent("Pass\nLightMode", null, null, null); + internal static readonly GUIContent s_ArrayPopupButtonText = L10n.TextContent("...", null, null, null); + internal static readonly GUIContent s_FoldoutOutputText = L10n.TextContent("Output", null, null, null); + internal static readonly GUIContent s_FoldoutMeshText = L10n.TextContent("Meshes", null, null, null); + internal static readonly GUIContent s_FoldoutMeshNotSupportedText = L10n.TextContent("Meshes - Not supported", null, null, null); + internal static readonly GUIContent s_FoldoutEventDetailsText = L10n.TextContent("Details", null, null, null); + internal static readonly GUIContent s_FoldoutTexturesText = L10n.TextContent("Textures", null, null, null); + internal static readonly GUIContent s_FoldoutKeywordsText = L10n.TextContent("Keywords", null, null, null); + internal static readonly GUIContent s_FoldoutFloatsText = L10n.TextContent("Floats", null, null, null); + internal static readonly GUIContent s_FoldoutIntsText = L10n.TextContent("Ints", null, null, null); + internal static readonly GUIContent s_FoldoutVectorsText = L10n.TextContent("Vectors", null, null, null); + internal static readonly GUIContent s_FoldoutMatricesText = L10n.TextContent("Matrices", null, null, null); + internal static readonly GUIContent s_FoldoutBuffersText = L10n.TextContent("Buffers", null, null, null); + internal static readonly GUIContent s_FoldoutCBufferText = L10n.TextContent("Constant Buffers", null, null, null); internal struct DetailsSectionInfo { internal GUIContent header; @@ -322,42 +321,42 @@ internal DetailsSectionInfo(GUIContent header, string prefsKey, bool defaultOpen internal static readonly DetailsSectionInfo[] s_DetailsSections = new DetailsSectionInfo[] { new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Event Info"), + L10n.TextContent("Event Info", null, null, null), "FrameDebuggerDetailsEventInfo", false ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Render Target"), + L10n.TextContent("Render Target", null, null, null), "FrameDebuggerDetailsRenderTarget", true ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Blending"), + L10n.TextContent("Blending", null, null, null), "FrameDebuggerDetailsBlending", false ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Depth & Culling"), + L10n.TextContent("Depth & Culling", null, null, null), "FrameDebuggerDetailsDepthCulling", false ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Stencil"), + L10n.TextContent("Stencil", null, null, null), "FrameDebuggerDetailsStencil", false ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Variable Rate Shading"), + L10n.TextContent("Variable Rate Shading", null, null, null), "FrameDebuggerDetailsVariableRateShading", false ), new DetailsSectionInfo( - EditorGUIUtility.TrTextContent("Shader"), + L10n.TextContent("Shader", null, null, null), "FrameDebuggerDetailsShader", false ), }; - internal static readonly GUIContent s_NotAvailableText = EditorGUIUtility.TrTextContent(k_NotAvailable); + internal static readonly GUIContent s_NotAvailableText = L10n.TextContent(k_NotAvailable, null, null, null); [NoAutoStaticsCleanup] // programmatic Texture2D persists across incremental code reload; lifecycle managed by FrameDebuggerStyles.OnDisable internal static Texture2D s_RenderTargetMeshBackgroundTexture = null; internal static readonly string[] s_BatchBreakCauses = FrameDebuggerUtility.GetBatchBreakCauseStrings(); @@ -401,4 +400,3 @@ internal static void OnDisable() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PlatformSupport/PlatformIconField.cs b/Editor/Mono/PlatformSupport/PlatformIconField.cs index 668d1757d4..0cf408298a 100644 --- a/Editor/Mono/PlatformSupport/PlatformIconField.cs +++ b/Editor/Mono/PlatformSupport/PlatformIconField.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: PlayerSettingsWindow not yet converted using UnityEngine; using UnityEditor; using System; @@ -323,4 +322,3 @@ internal override void DrawAt(bool showValidationHelpBox = true) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PlatformSupport/ProvisioningProfileGUI.cs b/Editor/Mono/PlatformSupport/ProvisioningProfileGUI.cs index d55080382d..9d3ca9b2d7 100644 --- a/Editor/Mono/PlatformSupport/ProvisioningProfileGUI.cs +++ b/Editor/Mono/PlatformSupport/ProvisioningProfileGUI.cs @@ -20,7 +20,7 @@ internal static void ShowProvisioningProfileUIWithProperty(GUIContent titleWithT GUILayout.Label(titleWithToolTip, EditorStyles.label); Rect controlRect = EditorGUILayout.GetControlRect(false, 0); - GUIContent labelID = EditorGUIUtility.TrTextContent("Profile ID:"); + GUIContent labelID = L10n.TextContent("Profile ID:", null, null, null); EditorGUI.BeginProperty(controlRect, labelID, profileIDProp); if (GUILayout.Button("Browse", EditorStyles.miniButton)) @@ -48,7 +48,7 @@ internal static void ShowProvisioningProfileUIWithProperty(GUIContent titleWithT profile.UUID = EditorGUILayout.TextField(labelID, profile.UUID); EditorGUI.EndProperty(); - GUIContent labelType = EditorGUIUtility.TrTextContent("Profile Type:"); + GUIContent labelType = L10n.TextContent("Profile Type:", null, null, null); EditorGUI.BeginProperty(controlRect, labelType, profileTypeProp); profile.type = (ProvisioningProfileType)EditorGUILayout.EnumPopup(labelType, profile.type); @@ -86,8 +86,8 @@ internal static void ShowProvisioningProfileUIWithCallback(GUIContent titleWithT EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; - GUIContent labelID = EditorGUIUtility.TrTextContent("Profile ID:"); - GUIContent labelType = EditorGUIUtility.TrTextContent("Profile Type:"); + GUIContent labelID = L10n.TextContent("Profile ID:", null, null, null); + GUIContent labelType = L10n.TextContent("Profile Type:", null, null, null); profile.UUID = EditorGUILayout.TextField(labelID, profile.UUID); profile.type = (ProvisioningProfileType)EditorGUILayout.EnumPopup(labelType, profile.type); diff --git a/Editor/Mono/PlatformSupport/ReorderableTextureList.cs b/Editor/Mono/PlatformSupport/ReorderableTextureList.cs index 00834bab7b..1f09c608d9 100644 --- a/Editor/Mono/PlatformSupport/ReorderableTextureList.cs +++ b/Editor/Mono/PlatformSupport/ReorderableTextureList.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: PlayerSettingsWindow not yet converted using UnityEngine; using UnityEditor; using System; @@ -158,4 +157,3 @@ public void DoLayoutList() } } } // namespace UnityEditor.AppleTV -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PlayModeTintResolver.cs b/Editor/Mono/PlayModeTintResolver.cs index c29ab1dac1..25b1e4c8d0 100644 --- a/Editor/Mono/PlayModeTintResolver.cs +++ b/Editor/Mono/PlayModeTintResolver.cs @@ -10,7 +10,6 @@ namespace UnityEditor { - [InitializeOnLoad] static partial class PlayModeTintResolver { const string k_PlayModeTintPrefKey = "Playmode tint"; @@ -35,13 +34,24 @@ private set [AutoStaticsCleanupOnCodeReload] public static event Action activePlayModeTintChanged; - static PlayModeTintResolver() + // Both events are cleared on code reload, so these subscriptions have to be re-established on + // every load; a static constructor would only run once per domain, and the play-mode tint would + // stop tracking play-mode and preference changes after the first reload. + [OnCodeLoaded] + static void Initialize() { s_ActiveTint = ComputeTint(); EditorApplication.playModeStateChanged += OnPlayModeStateChanged; EditorPrefs.onValueWasUpdated += OnEditorPrefChanged; } + [OnCodeUnloading] + static void Uninitialize() + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + EditorPrefs.onValueWasUpdated -= OnEditorPrefChanged; + } + static void OnPlayModeStateChanged(PlayModeStateChange state) { Color newTint; diff --git a/Editor/Mono/PlayModeView/PlayModeView.cs b/Editor/Mono/PlayModeView/PlayModeView.cs index 8b75653441..cdf6f9f326 100644 --- a/Editor/Mono/PlayModeView/PlayModeView.cs +++ b/Editor/Mono/PlayModeView/PlayModeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: PlayModeFramework not yet converted using System; using System.Collections.Generic; using System.IO; @@ -31,12 +30,21 @@ internal static void RepaintAll() internal abstract partial class PlayModeView : EditorWindow, ISerializationCallbackReceiver, IGameViewRenderInfo { [AutoStaticsCleanupOnCodeReload] + // Live-window registry: every PlayModeView registers itself from its own constructor, so the list + // cleared on reload refills as the views are recreated. + [IgnoreForUAL0015("Live-window registry refilled by each PlayModeView constructor")] static readonly List s_PlayModeViews = new List(); [AutoStaticsCleanupOnCodeReload] + // Tracks which play mode view was focused last: OnFocus sets it again, and the getter falls back to + // the first registered play mode view while it is null. + [IgnoreForUAL0015("Last-focused tracker, re-set by OnFocus with a first-view fallback while null")] private static PlayModeView s_LastFocused; [AutoStaticsCleanupOnCodeReload] + // Set for the duration of a single game-view render and cleared when it ends, so null is the + // correct resting value; the next render sets it again. + [IgnoreForUAL0015("Set and cleared around each game-view render, so null is the resting value")] static PlayModeView s_RenderingView; private readonly string m_ViewsCache = Path.GetFullPath(Directory.GetCurrentDirectory() + "/Library/PlayModeViewStates/"); @@ -607,11 +615,13 @@ internal static IGameViewRenderInfo GetLastInteractedGameView(int displayIndex) displayIndex = GetValidTargetDisplay(displayIndex); EnsureLastInteractedListSize(displayIndex); +#pragma warning disable UAL0018 // the candidate is read from the cleaned registry and written straight back into that same registry, so no copy escapes it; it is validity-checked (including destroyed-window fake-null) first, and after a reload empties the registry the next call re-discovers the view from the live play mode views var candidate = s_LastInteractedByDisplay[displayIndex]; if (!IsValidLastInteractedCandidate(candidate, displayIndex)) candidate = FindAnyPlayModeViewForDisplay(displayIndex); s_LastInteractedByDisplay[displayIndex] = candidate; +#pragma warning restore UAL0018 return candidate; } @@ -726,4 +736,3 @@ protected virtual float GetGameViewDpiForPhysicalSize() float IGameViewRenderInfo.dpi => GetGameViewDpiForPhysicalSize(); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PlayerSettings.bindings.cs b/Editor/Mono/PlayerSettings.bindings.cs index d54a7ac71b..a54181b56f 100644 --- a/Editor/Mono/PlayerSettings.bindings.cs +++ b/Editor/Mono/PlayerSettings.bindings.cs @@ -430,6 +430,9 @@ private PlayerSettings() { } // Lazily (re)created in GetSerializedObject(); reset to null on reload so it rebuilds on next access // (the disposable SerializedObject has no field initializer for the generator to reassign after dispose). [AutoStaticsCleanupOnCodeReload(CleanupStrategy = CleanupStrategy.ResetToDefaultValue)] + // GetSerializedObject rebuilds it from the native player settings object whenever it is null or points + // at a different target, so the next property access recreates it. + [IgnoreForUAL0015("Rebuilt from the native player settings object by GetSerializedObject when null")] private static SerializedObject _serializedObject; [FreeFunction("GetPlayerSettingsPtr")] @@ -908,6 +911,9 @@ public static void SetDynamicBatchingForPlatform(BuildTarget platform, bool enab [FreeFunction("GetTargetPlatformGraphicsAPIAvailability")] internal static extern UnityEngine.Rendering.GraphicsDeviceType[] GetSupportedGraphicsAPIs(BuildTarget platform); + [FreeFunction("GetTargetPlatformUGKCapableGraphicsAPIs")] + internal static extern UnityEngine.Rendering.GraphicsDeviceType[] GetUGKCapableGraphicsAPIs(BuildTarget platform); + [NativeMethod("GetPlatformGraphicsAPIs")] public static extern UnityEngine.Rendering.GraphicsDeviceType[] GetGraphicsAPIs(BuildTarget platform); @@ -2127,20 +2133,31 @@ internal void SetUseDefaultGraphicsAPIs_Internal(BuildTarget platform, bool auto [StaticAccessor("PlayerSettingsBindings", StaticAccessorType.DoubleColon)] private static extern void SetUseDefaultGraphicsAPIsImpl_Internal(PlayerSettings instance, BuildTarget platform, bool automatic); - [NativeMethod("GetPlatformGraphicsAPIs")] - internal extern UnityEngine.Rendering.GraphicsDeviceType[] GetGraphicsAPIs_Internal(BuildTarget platform); + [NativeMethod("GetPlatformGraphicsAPIsWithUGKVariants")] + internal extern UnityEngine.Rendering.GraphicsDeviceType[] GetGraphicsAPIsWithUGKVariants_Internal(BuildTarget platform); + + [NativeMethod("GetPlatformGraphicsAPIUGKFlags")] + internal extern int[] GetGraphicsAPIUGKFlags_Internal(BuildTarget platform); [StaticAccessor("PlayerSettingsBindings", StaticAccessorType.DoubleColon)] - private static extern void SetGraphicsAPIsImpl_Internal(PlayerSettings instance, BuildTarget platform, UnityEngine.Rendering.GraphicsDeviceType[] apis); + private static extern void SetGraphicsAPIsImpl_Internal(PlayerSettings instance, BuildTarget platform, UnityEngine.Rendering.GraphicsDeviceType[] apis, int[] ugkFlags); - internal void SetGraphicsAPIs_Internal(BuildTarget platform, UnityEngine.Rendering.GraphicsDeviceType[] apis, bool shouldSync) + internal void SetGraphicsAPIs_Internal(BuildTarget platform, UnityEngine.Rendering.GraphicsDeviceType[] apis, int[] ugkFlags, bool shouldSync) { - SetGraphicsAPIsImpl_Internal(this, platform, apis); + SetGraphicsAPIsImpl_Internal(this, platform, apis, ugkFlags); // we do cache api list in player settings editor, so if we update from script we should forcibly update cache if (shouldSync) PlayerSettingsEditor.SyncEditors(platform); } + [NativeMethod("GetPlatformGraphicsAPIs")] + internal extern UnityEngine.Rendering.GraphicsDeviceType[] GetGraphicsAPIs_Internal(BuildTarget platform); + + internal void SetGraphicsAPIs_Internal(BuildTarget platform, UnityEngine.Rendering.GraphicsDeviceType[] apis, bool shouldSync) + { + SetGraphicsAPIs_Internal(platform, apis, null, shouldSync); + } + [NativeMethod("GetColorGamuts")] internal extern ColorGamut[] GetColorGamuts_Internal(); diff --git a/Editor/Mono/PlayerSettingsAndroid.bindings.cs b/Editor/Mono/PlayerSettingsAndroid.bindings.cs index 894ad29111..f2d42159f1 100644 --- a/Editor/Mono/PlayerSettingsAndroid.bindings.cs +++ b/Editor/Mono/PlayerSettingsAndroid.bindings.cs @@ -1194,6 +1194,15 @@ public static extern bool optimizedFramePacing set; } + // Unity Render Service, Vulkan API only: use android virtual display instead of offscreen swapchain + internal static extern bool renderServiceUseVirtualDisplay + { + [NativeMethod("GetAndroidRenderServiceUseVirtualDisplay")] + get; + [NativeMethod("SetAndroidRenderServiceUseVirtualDisplay")] + set; + } + public static TextureCompressionFormat[] textureCompressionFormats { get diff --git a/Editor/Mono/PlayerSettingsSwitch.bindings.cs b/Editor/Mono/PlayerSettingsSwitch.bindings.cs index 16610095d5..6a0bfdfd08 100644 --- a/Editor/Mono/PlayerSettingsSwitch.bindings.cs +++ b/Editor/Mono/PlayerSettingsSwitch.bindings.cs @@ -54,6 +54,30 @@ public enum SupportedNpadStyle JoyRight = (1 << SupportedNpadStyleBits.JoyRight), } + public enum StorageMode + { + Legacy = 0, + Configurable = 1, + } + + public enum StorageType + { + CacheStorage = 0, + IndexedCacheStorage = 1, + TemporaryStorage = 2, + RamDisk = 3, + } + + public struct StorageMountDeclaration + { + public string mountName; + public StorageType storageType; + public int index; + public long size; + public long journalSize; + public int memoryPoolSizeMB; + } + // Socket Memory Pool Size [NativeProperty("switchSocketMemoryPoolSize", TargetType.Field)] extern public static int socketMemoryPoolSize { get; set; } @@ -366,6 +390,117 @@ public static string[] compilerFlags //To specify how much space should be allocated for the ram disk [NativeProperty("switchRamDiskSpaceSize", TargetType.Field)] extern public static int switchRamDiskSpaceSize { get; set; } + + [NativeProperty("switchStorageMode", TargetType.Field)] + extern public static StorageMode storageMode { get; set; } + + // The Mount List: the storages the application declares. + // + // The getter assembles the declarations from one array per field instead of + // receiving StorageMountDeclaration[] from native code directly. Returning an + // array of a struct makes the bindings look the element type up by name, and the + // name generated for a struct nested two levels deep + // ("PlayerSettings.Switch/StorageMountDeclaration") does not resolve: the lookup + // (Modules/Scripting/Source/Scripting/CommonScriptingClasses.cpp, OptionalType) + // splits nested names on '/' only, so the first part is searched for as a type of + // its own. The lookup then returns null and creating the array crashes the Editor. + // Arrays of string and of primitives need no such lookup, so the fields are passed + // one array each and joined back together here. + // + // The setter is unaffected: it receives an array that already exists on the + // managed side, which needs no type lookup. + public static StorageMountDeclaration[] storageMounts + { + get + { + string[] mountNames = storageMountNames; + int[] storageTypes = storageMountStorageTypes; + int[] indices = storageMountIndices; + long[] sizes = storageMountSizes; + long[] journalSizes = storageMountJournalSizes; + int[] memoryPoolSizes = storageMountMemoryPoolSizes; + + var declarations = new StorageMountDeclaration[mountNames.Length]; + for (int i = 0; i < declarations.Length; i++) + { + declarations[i] = new StorageMountDeclaration + { + mountName = mountNames[i], + storageType = (StorageType)storageTypes[i], + index = indices[i], + size = sizes[i], + journalSize = journalSizes[i], + memoryPoolSizeMB = memoryPoolSizes[i], + }; + } + return declarations; + } + set { storageMountsInternal = ClampStorageMounts(value); } + } + + const int k_RamDiskMemoryPoolSizeMaxMB = 1024; + + static StorageMountDeclaration[] ClampStorageMounts(StorageMountDeclaration[] mounts) + { + if (mounts == null) + return null; + + var clamped = new StorageMountDeclaration[mounts.Length]; + for (int i = 0; i < clamped.Length; i++) + { + clamped[i] = mounts[i]; + clamped[i].index = Math.Max(0, clamped[i].index); + clamped[i].size = Math.Max(0L, clamped[i].size); + clamped[i].journalSize = Math.Max(0L, clamped[i].journalSize); + clamped[i].memoryPoolSizeMB = Math.Clamp(clamped[i].memoryPoolSizeMB, 0, k_RamDiskMemoryPoolSizeMaxMB); + } + return clamped; + } + + [NativeProperty("switchStorageMounts", TargetType.Function)] + extern private static StorageMountDeclaration[] storageMountsInternal { set; } + + extern private static string[] storageMountNames + { + [NativeMethod("GetSwitchStorageMountNames")] + get; + } + + extern private static int[] storageMountStorageTypes + { + [NativeMethod("GetSwitchStorageMountStorageTypes")] + get; + } + + extern private static int[] storageMountIndices + { + [NativeMethod("GetSwitchStorageMountIndices")] + get; + } + + extern private static long[] storageMountSizes + { + [NativeMethod("GetSwitchStorageMountSizes")] + get; + } + + extern private static long[] storageMountJournalSizes + { + [NativeMethod("GetSwitchStorageMountJournalSizes")] + get; + } + + extern private static int[] storageMountMemoryPoolSizes + { + [NativeMethod("GetSwitchStorageMountMemoryPoolSizes")] + get; + } + + [NativeProperty("switchPersistentDataPathMountName", TargetType.Function)] + extern public static string persistentDataPathMountName { get; set; } + + [NativeProperty("switchTemporaryCachePathMountName", TargetType.Function)] + extern public static string temporaryCachePathMountName { get; set; } } } } diff --git a/Editor/Mono/PostprocessScene.cs b/Editor/Mono/PostprocessScene.cs index 8c6225fc2c..15f92cb65f 100644 --- a/Editor/Mono/PostprocessScene.cs +++ b/Editor/Mono/PostprocessScene.cs @@ -3,18 +3,28 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using UnityEngine; -using UnityEditor.Build; +using UnityEditor.Build.Content; namespace UnityEditor { - internal class UnityBuildPostprocessor : IProcessSceneWithReport + internal class UnityBuildPostprocessor : AssetPostprocessor { - public int callbackOrder { get { return 0; } } + // Has to be keep in sync with "EditorOnlyPlayerSettings::kAssetDependencyKey_BuildPipelineStaticBatching" + const string kAssetDependencyKey_BuildPipelineStaticBatching = "BP/StaticBatching"; - public void OnProcessScene(UnityEngine.SceneManagement.Scene scene, Build.Reporting.BuildReport report) + public override uint GetVersion() { - int staticBatching, dynamicBatching; - PlayerSettings.GetBatchingForPlatform(EditorUserBuildSettings.activeBuildTarget, out staticBatching, out dynamicBatching); + return 1; + } + + public void OnProcessScene(UnityEngine.SceneManagement.Scene scene, SceneImportContext sceneContext) + { + context.DependsOnCustomDependency(kAssetDependencyKey_BuildPipelineStaticBatching); + + // This is explicitly using EditorUserBuildSettings.activeBuildTarget instead of context.selectedBuildTarget + // Because we do not want the postprocessor to depend on the buildtarget. + // Depending on kAssetDependencyKey_BuildPipelineStaticBatching satisfies the implicit platform change dependency. + PlayerSettings.GetBatchingForPlatform(EditorUserBuildSettings.activeBuildTarget, out var staticBatching, out _); if (staticBatching != 0) { using (StaticBatchingUtility.s_CombineMarker.Auto()) diff --git a/Editor/Mono/Prefabs/PrefabFamilyPopup.cs b/Editor/Mono/Prefabs/PrefabFamilyPopup.cs index 14a0c844e8..e10b3fd16c 100644 --- a/Editor/Mono/Prefabs/PrefabFamilyPopup.cs +++ b/Editor/Mono/Prefabs/PrefabFamilyPopup.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System.Collections.Generic; using UnityEngine; using Object = UnityEngine.Object; @@ -56,6 +55,7 @@ struct AncestorItem const float k_Padding = 3f; const float k_OffsetX = 6f; const float k_SplitWidth = 1f; + const string k_Ellipsis = "\u2026"; readonly float k_MinNameWidth; readonly float k_TitleWidth = k_OffsetX + 50f; readonly float k_OverridesWidth = k_SplitWidth + EditorStyles.miniLabel.CalcSize(Styles.overridesLabel).x + 2 * k_Padding; @@ -86,14 +86,14 @@ public static class Colors public static class Styles { - public static readonly GUIContent rootLabel = EditorGUIUtility.TrTextContent("Root", "The root of the Prefab Variant hierarchy"); - public static readonly GUIContent selectedLabel = EditorGUIUtility.TrTextContent("Current", "The currently selected Prefab"); - public static readonly GUIContent titlePrefixLabel = EditorGUIUtility.TrTextContent("Variant Family of"); - public static readonly GUIContent ancestorLabel = EditorGUIUtility.TrTextContent("Ancestors"); - public static readonly GUIContent overridesLabel = EditorGUIUtility.TrTextContent("Overrides"); - public static readonly GUIContent childrenLabel = EditorGUIUtility.TrTextContent("Children"); - public static readonly GUIContent noResultsLabel = EditorGUIUtility.TrTextContent("No results"); - public static readonly GUIContent noChildrenLabel = EditorGUIUtility.TrTextContent("This Prefab doesn't have any children.\nPrefab Variants created from this Prefab\nwill be listed here."); + public static readonly GUIContent rootLabel = L10n.TextContent("Root", "The root of the Prefab Variant hierarchy", null, null); + public static readonly GUIContent selectedLabel = L10n.TextContent("Current", "The currently selected Prefab", null, null); + public static readonly GUIContent titlePrefixLabel = L10n.TextContent("Variant Family of", null, null, null); + public static readonly GUIContent ancestorLabel = L10n.TextContent("Ancestors", null, null, null); + public static readonly GUIContent overridesLabel = L10n.TextContent("Overrides", null, null, null); + public static readonly GUIContent childrenLabel = L10n.TextContent("Children", null, null, null); + public static readonly GUIContent noResultsLabel = L10n.TextContent("No results", null, null, null); + public static readonly GUIContent noChildrenLabel = L10n.TextContent("This Prefab doesn't have any children.\nPrefab Variants created from this Prefab\nwill be listed here.", null, null, null); public static readonly GUIStyle searchBackground = new GUIStyle("ProjectBrowserIconAreaBg"); public static readonly GUIStyle centered = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleCenter }; public static readonly GUIStyle boldRightAligned = new GUIStyle(EditorStyles.boldLabel) @@ -214,6 +214,11 @@ void Init() float scrollBarWidthOffset = numRows >= k_MaxTableRows ? k_ScrollbarWidth : 0; m_MaxNameWidth = k_MaxWindowWidth - (k_TitleWidth + k_SplitWidth + k_OverridesWidth) - scrollBarWidthOffset; + // Cap the required name width to what can actually be rendered. Names beyond this are + // truncated with an ellipsis in DoObjectLabel() rather than widening the scrollable + // content past what's drawn, which used to leave dead space at the end of the scrollbar. + m_NamesWidth = Mathf.Min(m_NamesWidth, m_MaxNameWidth); + float prevWidth = m_WindowWidth; if (m_NamesWidth <= k_MinNameWidth) m_WindowWidth = k_MinWindowWidth; @@ -318,7 +323,8 @@ void DrawHeader() float labelSize = Styles.boldRightAligned.CalcSize(Styles.titlePrefixLabel).x; Rect labelRect = new Rect(k_OffsetX, headerRect.y + k_Padding, labelSize, EditorGUIUtility.singleLineHeight); - Rect contentRect = new Rect(labelRect.x + labelRect.width + k_Padding, labelRect.y, m_WindowWidth, labelRect.height); + float contentX = labelRect.x + labelRect.width + k_Padding; + Rect contentRect = new Rect(contentX, labelRect.y, m_WindowWidth - contentX - k_OffsetX, labelRect.height); GUI.Label(labelRect, Styles.titlePrefixLabel, Styles.boldRightAligned); DoObjectLabel(contentRect, AssetDatabase.GetAssetPath(m_Target), EditorStyles.boldLabel); @@ -359,6 +365,7 @@ float DrawVariantHierarchy() { // Draw scrollable table entryRect.x = k_TitleWidth; + entryRect.width = m_NamesWidth; for (int i = 0; i < m_AncestorItems.Length; i++) { entryRect.y = k_HeaderHeight + (i + 1) * k_EntryHeight; @@ -591,8 +598,54 @@ void DoObjectLabel(Rect rect, string assetPath, GUIStyle style) var icon = AssetDatabase.GetCachedIcon(assetPath); var name = System.IO.Path.GetFileNameWithoutExtension(assetPath); + + // Truncate long names ourselves rather than relying on the style's own clipping: IMGUI + // lays out an image+text label by shrinking the *icon* until the full, untruncated text + // fits - down to nothing in the worst case (the imageScale clamp in + // GUIStyle::CalcContentRects, kImageLeft, in Modules/IMGUI/GUIStyle.cpp). So an over-wide + // name here costs us the icon instead of gaining an ellipsis. Measure against the width + // that is actually left for text once padding, the icon and the ellipsis are accounted + // for; GetNumCharactersThatFitWithinWidth() only measures raw glyph advances and knows + // about none of them. + Rect contentRect = style.padding.Remove(rect); + float textWidth = contentRect.width - GetRenderedIconWidth(icon, contentRect) - style.contentSpacing; + + int maxChars = style.GetNumCharactersThatFitWithinWidth(name, Mathf.Max(0f, textWidth)); + if (maxChars >= 0 && name.Length > maxChars) + { + // CalcSize() reports content + padding, so subtract the padding back out. + float ellipsisWidth = style.CalcSize(EditorGUIUtility.TempContent(k_Ellipsis)).x - style.padding.horizontal; + maxChars = style.GetNumCharactersThatFitWithinWidth(name, Mathf.Max(0f, textWidth - ellipsisWidth)); + name = name.Substring(0, Mathf.Max(1, maxChars)) + k_Ellipsis; + } + GUI.Label(rect, EditorGUIUtility.TempContent(name, icon), style); } + + // The width GUIStyle hands to the icon of an image+text label: the icon is scaled down to fit + // the content rect and that width is then removed from the bounds the text is generated into + // (GUIStyle::DrawContent, kImageLeft, in Modules/IMGUI/GUIStyle.cpp). Reserving exactly this + // keeps the text short enough that CalcContentRects never shrinks the icon a second time. + static float GetRenderedIconWidth(Texture icon, Rect contentRect) + { + if (icon == null) + return 0f; + + // EditorGUIUtility.SetIconSize() pins the icon size and bypasses the scaling entirely. + var fixedIconSize = EditorGUIUtility.GetIconSize(); + if (fixedIconSize.x > 0f && fixedIconSize.y > 0f) + return fixedIconSize.x; + + // GUIStyle measures icons in points, not pixels, so undo the HiDPI scale first. + float pixelsPerPoint = icon is Texture2D texture2D ? texture2D.pixelsPerPoint : 1f; + float iconWidth = icon.width / pixelsPerPoint; + float iconHeight = icon.height / pixelsPerPoint; + if (iconWidth <= 0f || iconHeight <= 0f) + return 0f; + + float scale = Mathf.Clamp01(Mathf.Min(contentRect.width / iconWidth, contentRect.height / iconHeight)); + return Mathf.Round(iconWidth * scale); + } } [Serializable] @@ -749,4 +802,3 @@ public bool MoveNext() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Prefabs/PrefabImporterEditor.cs b/Editor/Mono/Prefabs/PrefabImporterEditor.cs index 56c85f80ba..cff8fe8b65 100644 --- a/Editor/Mono/Prefabs/PrefabImporterEditor.cs +++ b/Editor/Mono/Prefabs/PrefabImporterEditor.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System.Collections.Generic; using UnityEditor.AssetImporters; using UnityEditor.SceneManagement; @@ -18,11 +17,11 @@ internal class PrefabImporterEditor : AssetImporterEditor { static class Styles { - public static readonly GUIContent missingScriptsHelpText = EditorGUIUtility.TrTextContent("Prefab has missing scripts. Open Prefab to fix the issue."); - public static readonly GUIContent missingSerializeReferenceHelpText = EditorGUIUtility.TrTextContent("Prefab has missing SerializeReference Types. Open Prefab to fix the issue. Changing the Prefab directly will cause those types to be lost."); - public static readonly GUIContent multiSelectionMissingScriptsHelpText = EditorGUIUtility.TrTextContent("Some of the selected Prefabs have missing scripts and needs to be fixed before editing them. Click to Open Prefab to fix the issue."); - public static readonly GUIContent savingFailedHelpText = EditorGUIUtility.TrTextContent("Saving has failed. Check the Console window to get more insight into what needs to be fixed on the Prefab Asset.\n\nOpen Prefab to fix the issue."); - public static readonly GUIContent variantOfText = EditorGUIUtility.TrTextContent("Variant Parent"); + public static readonly GUIContent missingScriptsHelpText = L10n.TextContent("Prefab has missing scripts. Open Prefab to fix the issue.", null, null, null); + public static readonly GUIContent missingSerializeReferenceHelpText = L10n.TextContent("Prefab has missing SerializeReference Types. Open Prefab to fix the issue. Changing the Prefab directly will cause those types to be lost.", null, null, null); + public static readonly GUIContent multiSelectionMissingScriptsHelpText = L10n.TextContent("Some of the selected Prefabs have missing scripts and needs to be fixed before editing them. Click to Open Prefab to fix the issue.", null, null, null); + public static readonly GUIContent savingFailedHelpText = L10n.TextContent("Saving has failed. Check the Console window to get more insight into what needs to be fixed on the Prefab Asset.\n\nOpen Prefab to fix the issue.", null, null, null); + public static readonly GUIContent variantOfText = L10n.TextContent("Variant Parent", null, null, null); public static readonly string localizedTitleMultiplePrefabs = L10n.Tr("Prefab Assets", null); public static readonly string localizedTitleSinglePrefab = L10n.Tr("Prefab Asset", null); public static readonly GUIStyle openButtonStyle = "AC Button"; @@ -446,4 +445,3 @@ public override void OnInspectorGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Prefabs/PrefabInstanceChangedListener.cs b/Editor/Mono/Prefabs/PrefabInstanceChangedListener.cs index bdf7c43b63..36038a18e2 100644 --- a/Editor/Mono/Prefabs/PrefabInstanceChangedListener.cs +++ b/Editor/Mono/Prefabs/PrefabInstanceChangedListener.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using UnityEngine; using Unity.Scripting.LifecycleManagement; @@ -121,4 +120,3 @@ private static void OnGameObjectChanged(GameObject go) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesTreeView.cs b/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesTreeView.cs index df946cc033..cfd625f1ff 100644 --- a/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesTreeView.cs +++ b/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesTreeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using UnityEngine; using System.Collections.Generic; @@ -625,13 +624,13 @@ static class Styles public const string headerButtonClass = "unity-prefab-compare__header-buttons"; public static readonly GUIStyle headerGroupStyle = new GUIStyle(); - public static readonly GUIContent sourceContent = EditorGUIUtility.TrTextContent("Prefab Source"); - public static readonly GUIContent instanceContent = EditorGUIUtility.TrTextContent("Override"); - public static readonly GUIContent removedContent = EditorGUIUtility.TrTextContent("Removed"); - public static readonly GUIContent addedContent = EditorGUIUtility.TrTextContent("Added"); - public static readonly GUIContent noModificationsContent = EditorGUIUtility.TrTextContent("No Overrides"); - public static readonly GUIContent applyContent = EditorGUIUtility.TrTextContent("Apply", "Apply overrides on this object."); - public static readonly GUIContent revertContent = EditorGUIUtility.TrTextContent("Revert", "Revert overrides on this object."); + public static readonly GUIContent sourceContent = L10n.TextContent("Prefab Source", null, null, null); + public static readonly GUIContent instanceContent = L10n.TextContent("Override", null, null, null); + public static readonly GUIContent removedContent = L10n.TextContent("Removed", null, null, null); + public static readonly GUIContent addedContent = L10n.TextContent("Added", null, null, null); + public static readonly GUIContent noModificationsContent = L10n.TextContent("No Overrides", null, null, null); + public static readonly GUIContent applyContent = L10n.TextContent("Apply", "Apply overrides on this object.", null, null); + public static readonly GUIContent revertContent = L10n.TextContent("Revert", "Revert overrides on this object.", null, null); static Styles() { @@ -894,4 +893,3 @@ static void DrawObjectHeader(Editor editor, EditorGUIUtility.ComparisonViewMode } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesWindow.cs b/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesWindow.cs index 631bf89041..b6f8e91911 100644 --- a/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesWindow.cs +++ b/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -54,33 +53,33 @@ internal class PrefabOverridesWindow : PopupWindowContent bool m_UnusedOverridesExist; static class Styles { - public static readonly GUIContent revertAllContent = EditorGUIUtility.TrTextContent("Revert All", "Revert all overrides."); - public static readonly GUIContent revertSelectedContent = EditorGUIUtility.TrTextContent("Revert Selected", "Revert selected overrides."); - public static readonly GUIContent applyAllContent = EditorGUIUtility.TrTextContent("Apply All", "Apply all overrides to Prefab source '{0}'."); - public static readonly GUIContent applySelectedContent = EditorGUIUtility.TrTextContent("Apply Selected", "Apply selected overrides to Prefab source '{0}'."); - public static readonly GUIContent applyAllToBaseContent = EditorGUIUtility.TrTextContent("Apply All to Prefab Variant parent", "Apply all overrides to Prefab Variant parent '{0}'."); - public static readonly GUIContent applySelectedToBaseContent = EditorGUIUtility.TrTextContent("Apply Selected to Prefab Variant parent", "Apply selected overrides to Prefab Variant parent '{0}'."); - public static readonly GUIContent titleLabelDefault = EditorGUIUtility.TrTextContent("Review, Revert or Apply Overrides"); - public static readonly GUIContent titleLabelNoApply = EditorGUIUtility.TrTextContent("Review or Revert Overrides"); - public static readonly GUIContent noOverridesText = EditorGUIUtility.TrTextContent("No overrides"); - public static readonly GUIContent instanceLabel = EditorGUIUtility.TrTextContent("on"); - public static readonly GUIContent contextLabel = EditorGUIUtility.TrTextContent("in"); + public static readonly GUIContent revertAllContent = L10n.TextContent("Revert All", "Revert all overrides.", null, null); + public static readonly GUIContent revertSelectedContent = L10n.TextContent("Revert Selected", "Revert selected overrides.", null, null); + public static readonly GUIContent applyAllContent = L10n.TextContent("Apply All", "Apply all overrides to Prefab source '{0}'.", null, null); + public static readonly GUIContent applySelectedContent = L10n.TextContent("Apply Selected", "Apply selected overrides to Prefab source '{0}'.", null, null); + public static readonly GUIContent applyAllToBaseContent = L10n.TextContent("Apply All to Prefab Variant parent", "Apply all overrides to Prefab Variant parent '{0}'.", null, null); + public static readonly GUIContent applySelectedToBaseContent = L10n.TextContent("Apply Selected to Prefab Variant parent", "Apply selected overrides to Prefab Variant parent '{0}'.", null, null); + public static readonly GUIContent titleLabelDefault = L10n.TextContent("Review, Revert or Apply Overrides", null, null, null); + public static readonly GUIContent titleLabelNoApply = L10n.TextContent("Review or Revert Overrides", null, null, null); + public static readonly GUIContent noOverridesText = L10n.TextContent("No overrides", null, null, null); + public static readonly GUIContent instanceLabel = L10n.TextContent("on", null, null, null); + public static readonly GUIContent contextLabel = L10n.TextContent("in", null, null, null); public static readonly GUIContent removeUnusedOverridesButtonContent = EditorGUIUtility.TrTextContentWithIcon("Unused overrides", EditorGUIUtility.LoadIcon("Clear")); public static readonly string nonApplicableTooltipApply = L10n.Tr("There are no overrides that can be applied to Prefab source '{0}'.", null); public static readonly string nonApplicableTooltipRevert = L10n.Tr("There are no overrides that can be reverted.", null); - public static readonly GUIContent infoMultiple = EditorGUIUtility.TrTextContent("Multiple Prefabs selected. Cannot show overrides."); - public static readonly GUIContent infoMultipleNoApply = EditorGUIUtility.TrTextContent("Multiple Prefabs selected. Cannot show overrides.\nApplying is not possible for one or more Prefabs. Select individual Prefabs for details."); + public static readonly GUIContent infoMultiple = L10n.TextContent("Multiple Prefabs selected. Cannot show overrides.", null, null, null); + public static readonly GUIContent infoMultipleNoApply = L10n.TextContent("Multiple Prefabs selected. Cannot show overrides.\nApplying is not possible for one or more Prefabs. Select individual Prefabs for details.", null, null, null); // Messages related to the overrides list. - public static readonly GUIContent infoModel = EditorGUIUtility.TrTextContent("Applying to a Model Prefab is not possible."); + public static readonly GUIContent infoModel = L10n.TextContent("Applying to a Model Prefab is not possible.", null, null, null); // Messages related to reasons for inability to apply. - public static readonly GUIContent warningInvalidAsset = EditorGUIUtility.TrTextContent("The Prefab file contains an invalid script. Applying is not possible. Enter Prefab Mode and either remove the script component or recover the script."); - public static readonly GUIContent warningHasManagedReferencesWithMissingTypes = EditorGUIUtility.TrTextContent("The Prefab file contains missing SerializeReference types. Applying is not possible. Enter Prefab Mode to see more details."); - public static readonly GUIContent warningInvalidInstance = EditorGUIUtility.TrTextContent("The Prefab instance contains an invalid script. Applying is not possible. Remove or recover the script."); - public static readonly GUIContent warningImmutable = EditorGUIUtility.TrTextContent("The Prefab file is immutable. Applying is not possible."); + public static readonly GUIContent warningInvalidAsset = L10n.TextContent("The Prefab file contains an invalid script. Applying is not possible. Enter Prefab Mode and either remove the script component or recover the script.", null, null, null); + public static readonly GUIContent warningHasManagedReferencesWithMissingTypes = L10n.TextContent("The Prefab file contains missing SerializeReference types. Applying is not possible. Enter Prefab Mode to see more details.", null, null, null); + public static readonly GUIContent warningInvalidInstance = L10n.TextContent("The Prefab instance contains an invalid script. Applying is not possible. Remove or recover the script.", null, null, null); + public static readonly GUIContent warningImmutable = L10n.TextContent("The Prefab file is immutable. Applying is not possible.", null, null, null); public static readonly GUIStyle boldRightAligned; public static readonly GUIStyle rightAligned; @@ -678,19 +677,19 @@ static class Styles public static readonly GUIStyle bodyStyle = new GUIStyle(EditorStyles.label); public static readonly GUIStyle logHintStyle = new GUIStyle(EditorStyles.label); public static readonly GUIStyle headerGroupStyle = new GUIStyle(); - public static readonly GUIContent headerContentBaseSingular = EditorGUIUtility.TrTextContent("unused override"); - public static readonly GUIContent headerContentBasePlural = EditorGUIUtility.TrTextContent("unused overrides"); - public static readonly GUIContent editorLogHint = EditorGUIUtility.TrTextContent("Details will be written to the Editor log."); - public static readonly GUIContent buttonContent = EditorGUIUtility.TrTextContent("Remove"); - public static readonly GUIContent headerContent = EditorGUIUtility.TrTextContent("{0} unused overrides"); - public static readonly GUIContent unusedRemovedComponentsContentSingular = EditorGUIUtility.TrTextContent("{0} has 1 unused removed component"); - public static readonly GUIContent unusedRemovedComponentsContentPlural = EditorGUIUtility.TrTextContent("{0} has {1} unused removed components"); - public static readonly GUIContent unusedRemovedGameObjectsContentSingular = EditorGUIUtility.TrTextContent("{0} has 1 unused removed GameObject"); - public static readonly GUIContent unusedRemovedGameObjectsContentPlural = EditorGUIUtility.TrTextContent("{0} has {1} unused removed GameObjects"); - public static readonly GUIContent headerContentSingular = EditorGUIUtility.TrTextContent("1 unused override"); - public static readonly GUIContent extraOverridesContent = EditorGUIUtility.TrTextContent("and {0} others"); - public static readonly GUIContent extraInstancesContent = EditorGUIUtility.TrTextContent("on {0} instances"); - public static readonly GUIContent pathOnInstanceContent = EditorGUIUtility.TrTextContent("on"); + public static readonly GUIContent headerContentBaseSingular = L10n.TextContent("unused override", null, null, null); + public static readonly GUIContent headerContentBasePlural = L10n.TextContent("unused overrides", null, null, null); + public static readonly GUIContent editorLogHint = L10n.TextContent("Details will be written to the Editor log.", null, null, null); + public static readonly GUIContent buttonContent = L10n.TextContent("Remove", null, null, null); + public static readonly GUIContent headerContent = L10n.TextContent("{0} unused overrides", null, null, null); + public static readonly GUIContent unusedRemovedComponentsContentSingular = L10n.TextContent("{0} has 1 unused removed component", null, null, null); + public static readonly GUIContent unusedRemovedComponentsContentPlural = L10n.TextContent("{0} has {1} unused removed components", null, null, null); + public static readonly GUIContent unusedRemovedGameObjectsContentSingular = L10n.TextContent("{0} has 1 unused removed GameObject", null, null, null); + public static readonly GUIContent unusedRemovedGameObjectsContentPlural = L10n.TextContent("{0} has {1} unused removed GameObjects", null, null, null); + public static readonly GUIContent headerContentSingular = L10n.TextContent("1 unused override", null, null, null); + public static readonly GUIContent extraOverridesContent = L10n.TextContent("and {0} others", null, null, null); + public static readonly GUIContent extraInstancesContent = L10n.TextContent("on {0} instances", null, null, null); + public static readonly GUIContent pathOnInstanceContent = L10n.TextContent("on", null, null, null); static Styles() { @@ -948,4 +947,3 @@ float GetTextHeight(string text, GUIStyle style) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Prefabs/PrefabReplaceUtility.cs b/Editor/Mono/Prefabs/PrefabReplaceUtility.cs index 3ca5a16198..721a291e37 100644 --- a/Editor/Mono/Prefabs/PrefabReplaceUtility.cs +++ b/Editor/Mono/Prefabs/PrefabReplaceUtility.cs @@ -196,10 +196,10 @@ internal static bool GetDragVisualModeAndShowMenuWithReplaceMenuItemsWhenNeeded( if (addAsChildMenuItem) { menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Add as Child"), false, MenuActionForInstantiateDraggedPrefabAsChild, (droppedUponGameObject, prefabAsset)); + menu.AddItem(L10n.TextContent("Add as Child", null, null, null), false, MenuActionForInstantiateDraggedPrefabAsChild, (droppedUponGameObject, prefabAsset)); } menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Cancel"), false, () => {/*nop*/ }); + menu.AddItem(L10n.TextContent("Cancel", null, null, null), false, () => {/*nop*/ }); menu.ShowAsContext(); } return true; diff --git a/Editor/Mono/Prefabs/PrefabUtility.cs b/Editor/Mono/Prefabs/PrefabUtility.cs index a3323f1c53..6600f9b980 100644 --- a/Editor/Mono/Prefabs/PrefabUtility.cs +++ b/Editor/Mono/Prefabs/PrefabUtility.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using System.Collections.Generic; using System.IO; @@ -3559,8 +3558,8 @@ internal static InstanceOverridesInfo GetPrefabInstanceOverridesInfo(GameObject internal static bool DoRemovePrefabInstanceUnusedOverridesDialog(InstanceOverridesInfo[] instanceOverridesInfos) { - string titleCheckForUnusedOverrides = EditorGUIUtility.TrTextContent("Remove Unused Overrides").text; - string msgNoOverridesWereFound = EditorGUIUtility.TrTextContent("No unused overrides were found.").text; + string titleCheckForUnusedOverrides = L10n.TextContent("Remove Unused Overrides", null, null, null).text; + string msgNoOverridesWereFound = L10n.TextContent("No unused overrides were found.", null, null, null).text; string title = titleCheckForUnusedOverrides; string message = string.Empty; @@ -3573,14 +3572,14 @@ internal static bool DoRemovePrefabInstanceUnusedOverridesDialog(InstanceOverrid return false; } - string titleRemoveUnusedOverrides = EditorGUIUtility.TrTextContent("Remove unused overrides?").text; - string msgDetailsWrittenToTheLog = EditorGUIUtility.TrTextContent("Details will be written to the Editor log.").text; - string msgUsedOverridesCount = EditorGUIUtility.TrTextContent("Used overrides count").text; + string titleRemoveUnusedOverrides = L10n.TextContent("Remove unused overrides?", null, null, null).text; + string msgDetailsWrittenToTheLog = L10n.TextContent("Details will be written to the Editor log.", null, null, null).text; + string msgUsedOverridesCount = L10n.TextContent("Used overrides count", null, null, null).text; - string msgAskRemoveMultipleOverridesFromMultipleInstances = EditorGUIUtility.TrTextContent("Do you want to remove {0} unused overrides from {1} Prefab instances?").text; - string msgAskRemoveSingleOverrideFromMultipleInstances = EditorGUIUtility.TrTextContent("Do you want to remove 1 unused override from {0} Prefab instances?").text; - string msgAskRemoveMultipleOverridesFromSingleInstance = EditorGUIUtility.TrTextContent("Do you want to remove {0} unused overrides from '{1}'?").text; - string msgAskRemoveSingleOverrideFromSingleInstance = EditorGUIUtility.TrTextContent("Do you want to remove 1 unused override from '{0}'?").text; + string msgAskRemoveMultipleOverridesFromMultipleInstances = L10n.TextContent("Do you want to remove {0} unused overrides from {1} Prefab instances?", null, null, null).text; + string msgAskRemoveSingleOverrideFromMultipleInstances = L10n.TextContent("Do you want to remove 1 unused override from {0} Prefab instances?", null, null, null).text; + string msgAskRemoveMultipleOverridesFromSingleInstance = L10n.TextContent("Do you want to remove {0} unused overrides from '{1}'?", null, null, null).text; + string msgAskRemoveSingleOverrideFromSingleInstance = L10n.TextContent("Do you want to remove 1 unused override from '{0}'?", null, null, null).text; PrefabUtility.InstanceOverridesInfo currInstanceWithUnusedMods = instanceOverridesInfos[0]; int affectedInstanceCount = 0; @@ -3982,4 +3981,3 @@ public void Dispose() internal static bool HasPrefabExtension(string assetPath) => assetPath.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PreferencesWindow/AssetPipelinePreferences.cs b/Editor/Mono/PreferencesWindow/AssetPipelinePreferences.cs index 56ea70f450..969d3ddb9f 100644 --- a/Editor/Mono/PreferencesWindow/AssetPipelinePreferences.cs +++ b/Editor/Mono/PreferencesWindow/AssetPipelinePreferences.cs @@ -21,13 +21,13 @@ internal class AssetPipelinePreferences : PreferencesProvider { class Properties { - public static readonly GUIContent autoRefresh = EditorGUIUtility.TrTextContent("Auto Refresh", "Automatically import changed assets."); - public static readonly GUIContent desiredImportWorkerCountPctOfLogicalCPUs = EditorGUIUtility.TrTextContent("Import Worker Count %", "Desired asset import worker count for new projects in percentage of available logical CPU cores."); + public static readonly GUIContent autoRefresh = L10n.TextContent("Auto Refresh", "Automatically import changed assets.", null, null); + public static readonly GUIContent desiredImportWorkerCountPctOfLogicalCPUs = L10n.TextContent("Import Worker Count %", "Desired asset import worker count for new projects in percentage of available logical CPU cores.", null, null); public static readonly GUIContent desiredImportWorkerCountPctOfLogicalCPUsLearnMore = new GUIContent("Learn more...", "Go to import worker documentation."); - public static readonly GUIContent directoryMonitoring = EditorGUIUtility.TrTextContent("Directory Monitoring", "Monitor directories instead of scanning all project files to detect asset changes."); - public static readonly GUIContent compressAssetsOnImport = EditorGUIUtility.TrTextContent("Compress Textures on Import", "Disable to skip texture compression during import process (textures will be imported into uncompressed formats, and compressed when making a build). This preference is per project and local to a single user, to prevent cross project pollution."); - public static readonly GUIContent verifySavingAssets = EditorGUIUtility.TrTextContent("Verify Saving Assets", "Show confirmation dialog whenever Unity saves any assets."); - public static readonly GUIContent enterSafeModeDialog = EditorGUIUtility.TrTextContent("Show Enter Safe Mode Dialog", "Show confirmation dialog when Unity would enter Safe Mode due to script compilation errors."); + public static readonly GUIContent directoryMonitoring = L10n.TextContent("Directory Monitoring", "Monitor directories instead of scanning all project files to detect asset changes.", null, null); + public static readonly GUIContent compressAssetsOnImport = L10n.TextContent("Compress Textures on Import", "Disable to skip texture compression during import process (textures will be imported into uncompressed formats, and compressed when making a build). This preference is per project and local to a single user, to prevent cross project pollution.", null, null); + public static readonly GUIContent verifySavingAssets = L10n.TextContent("Verify Saving Assets", "Show confirmation dialog whenever Unity saves any assets.", null, null); + public static readonly GUIContent enterSafeModeDialog = L10n.TextContent("Show Enter Safe Mode Dialog", "Show confirmation dialog when Unity would enter Safe Mode due to script compilation errors.", null, null); public static readonly GUIContent cacheServer = new GUIContent("Unity Accelerator (Cache Server)"); public static readonly GUIContent cacheServerDefaultMode = new GUIContent("Default Mode", "Specifies if Accelerator should be enabled or disabled by default. This can be overridden per project in editor settings."); diff --git a/Editor/Mono/PreferencesWindow/CollectionsPreferences.cs b/Editor/Mono/PreferencesWindow/CollectionsPreferences.cs index 43b4a17a7c..5ce5c9d0ac 100644 --- a/Editor/Mono/PreferencesWindow/CollectionsPreferences.cs +++ b/Editor/Mono/PreferencesWindow/CollectionsPreferences.cs @@ -23,12 +23,12 @@ internal class JobsMenuProvider: SettingsProvider class JobsProperties { - public static readonly GUIContent jobSystem = EditorGUIUtility.TrTextContent("Job System"); - public static readonly GUIContent useJobThreads = EditorGUIUtility.TrTextContent("Use Job Threads"); - public static readonly GUIContent enableJobsDebugger = EditorGUIUtility.TrTextContent("Enable Jobs Debugger"); - public static readonly GUIContent leakDetectionLevel = EditorGUIUtility.TrTextContent("Leak Detection Level"); - public static readonly GUIContent graphicsThreadingMode = EditorGUIUtility.TrTextContent("Graphics Threading Mode"); - public static readonly GUIContent allowGraphicsJobsInEditor = EditorGUIUtility.TrTextContent("Allow Graphics Jobs in Editor"); + public static readonly GUIContent jobSystem = L10n.TextContent("Job System", null, null, null); + public static readonly GUIContent useJobThreads = L10n.TextContent("Use Job Threads", null, null, null); + public static readonly GUIContent enableJobsDebugger = L10n.TextContent("Enable Jobs Debugger", null, null, null); + public static readonly GUIContent leakDetectionLevel = L10n.TextContent("Leak Detection Level", null, null, null); + public static readonly GUIContent graphicsThreadingMode = L10n.TextContent("Graphics Threading Mode", null, null, null); + public static readonly GUIContent allowGraphicsJobsInEditor = L10n.TextContent("Allow Graphics Jobs in Editor", null, null, null); } [SettingsProvider] diff --git a/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs b/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs index 322f0114a0..189daa6bb0 100644 --- a/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs +++ b/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs @@ -38,7 +38,7 @@ static class Constants class Styles { - public static readonly GUIContent browse = EditorGUIUtility.TrTextContent("Browse..."); + public static readonly GUIContent browse = L10n.TextContent("Browse...", null, null, null); public static readonly GUIStyle clearBindingButton = new GUIStyle(GUI.skin.button); static Styles() @@ -49,64 +49,64 @@ static Styles() class GeneralPropertiesNonSearchable { - public static readonly GUIContent packageManagerLogLevelOverridden = EditorGUIUtility.TrTextContent("Package Manager Log Level currently overridden by -enablePackageManagerTraces command-line argument."); - public static readonly GUIContent changingThisSettingRequiresRestart = EditorGUIUtility.TrTextContent("Changing this setting requires a restart to take effect."); + public static readonly GUIContent packageManagerLogLevelOverridden = L10n.TextContent("Package Manager Log Level currently overridden by -enablePackageManagerTraces command-line argument.", null, null, null); + public static readonly GUIContent changingThisSettingRequiresRestart = L10n.TextContent("Changing this setting requires a restart to take effect.", null, null, null); } class GICachePropertiesNonSearchable { - public static readonly GUIContent cantChangeCacheSettings = EditorGUIUtility.TrTextContent("Cache settings can't be changed while lightmapping is being computed."); - public static readonly GUIContent pleaseWait = EditorGUIUtility.TrTextContent("Please wait..."); + public static readonly GUIContent cantChangeCacheSettings = L10n.TextContent("Cache settings can't be changed while lightmapping is being computed.", null, null, null); + public static readonly GUIContent pleaseWait = L10n.TextContent("Please wait...", null, null, null); } class UIScalingPropertiesNonSearchable { - public static readonly GUIContent changingThisSettingRequiresRestart = EditorGUIUtility.TrTextContent("Changing this setting requires a restart to take effect."); + public static readonly GUIContent changingThisSettingRequiresRestart = L10n.TextContent("Changing this setting requires a restart to take effect.", null, null, null); } class GeneralProperties { - public static readonly GUIContent loadPreviousProjectOnStartup = EditorGUIUtility.TrTextContent("Load Previous Project on Startup"); - public static readonly GUIContent disableEditorAnalytics = EditorGUIUtility.TrTextContent("Disable Editor Analytics"); - public static readonly GUIContent autoSaveScenesBeforeBuilding = EditorGUIUtility.TrTextContent("Auto-save scenes before building"); - public static readonly GUIContent scriptChangesDuringPlay = EditorGUIUtility.TrTextContent("Script Changes While Playing"); - public static readonly GUIContent editorFont = EditorGUIUtility.TrTextContent("Editor Font"); - public static readonly GUIContent editorTextRenderingMode = EditorGUIUtility.TrTextContent("Editor Default Text Rendering Mode"); - public static readonly GUIContent editorTextSharpness = EditorGUIUtility.TrTextContent("Editor Text Sharpness"); - public static readonly GUIContent editorTextGeneration = EditorGUIUtility.TrTextContent("Editor Text Generator Type"); - public static readonly GUIContent editorSkin = EditorGUIUtility.TrTextContent("Editor Theme","Choose between light and dark themes for the Editor.\nThe Editor theme cannot be changed while in Play mode."); - public static readonly GUIContent[] editorSkinOptions = { EditorGUIUtility.TrTextContent("Light"), EditorGUIUtility.TrTextContent("Dark") }; - public static readonly GUIContent hierarchyHeader = EditorGUIUtility.TrTextContent("Hierarchy window"); - public static readonly GUIContent renameNewObjects = EditorGUIUtility.TrTextContent("Rename new objects"); - public static readonly GUIContent defaultPrefabMode = EditorGUIUtility.TrTextContent("Default Prefab Mode", "This mode will be used when opening Prefab Mode from a Prefab instance in the Hierarchy."); - public static readonly GUIContent enableAlphaNumericSorting = EditorGUIUtility.TrTextContent("Enable Alphanumeric Sorting", "If enabled then you can choose between Transform sorting and Alphabetical sorting in the Hierarchy."); - public static readonly GUIContent syncSearchInSceneView = EditorGUIUtility.TrTextContent("Synchronize search in Scene View"); - public static readonly GUIContent queryBuilder = EditorGUIUtility.TrTextContent("Enable Query Builder", "When enabled, the search field will use auto-completion and group queries as pills. When disabled, the search field will be in plain text mode."); - public static readonly GUIContent alternatingRowBackground = EditorGUIUtility.TrTextContent("Enable Alternating Row Background", "When enabled, even and odd rows will have different background colors."); - public static readonly GUIContent nameColumnStretchable = EditorGUIUtility.TrTextContent("Auto stretch Name Column", "When enabled, the name column will automatically stretch to take as much space as possible."); - public static readonly GUIContent gameObjectIconMode = EditorGUIUtility.TrTextContent("GameObject Icons", "Controls how the new Hierarchy window replaces GameObject icons."); + public static readonly GUIContent loadPreviousProjectOnStartup = L10n.TextContent("Load Previous Project on Startup", null, null, null); + public static readonly GUIContent disableEditorAnalytics = L10n.TextContent("Disable Editor Analytics", null, null, null); + public static readonly GUIContent autoSaveScenesBeforeBuilding = L10n.TextContent("Auto-save scenes before building", null, null, null); + public static readonly GUIContent scriptChangesDuringPlay = L10n.TextContent("Script Changes While Playing", null, null, null); + public static readonly GUIContent editorFont = L10n.TextContent("Editor Font", null, null, null); + public static readonly GUIContent editorTextRenderingMode = L10n.TextContent("Editor Default Text Rendering Mode", null, null, null); + public static readonly GUIContent editorTextSharpness = L10n.TextContent("Editor Text Sharpness", null, null, null); + public static readonly GUIContent editorTextGeneration = L10n.TextContent("Editor Text Generator Type", null, null, null); + public static readonly GUIContent editorSkin = L10n.TextContent("Editor Theme","Choose between light and dark themes for the Editor.\nThe Editor theme cannot be changed while in Play mode.", null, null); + public static readonly GUIContent[] editorSkinOptions = { L10n.TextContent("Light", null, null, null), L10n.TextContent("Dark", null, null, null) }; + public static readonly GUIContent hierarchyHeader = L10n.TextContent("Hierarchy window", null, null, null); + public static readonly GUIContent renameNewObjects = L10n.TextContent("Rename new objects", null, null, null); + public static readonly GUIContent defaultPrefabMode = L10n.TextContent("Default Prefab Mode", "This mode will be used when opening Prefab Mode from a Prefab instance in the Hierarchy.", null, null); + public static readonly GUIContent enableAlphaNumericSorting = L10n.TextContent("Enable Alphanumeric Sorting", "If enabled then you can choose between Transform sorting and Alphabetical sorting in the Hierarchy.", null, null); + public static readonly GUIContent syncSearchInSceneView = L10n.TextContent("Synchronize search in Scene View", null, null, null); + public static readonly GUIContent queryBuilder = L10n.TextContent("Enable Query Builder", "When enabled, the search field will use auto-completion and group queries as pills. When disabled, the search field will be in plain text mode.", null, null); + public static readonly GUIContent alternatingRowBackground = L10n.TextContent("Enable Alternating Row Background", "When enabled, even and odd rows will have different background colors.", null, null); + public static readonly GUIContent nameColumnStretchable = L10n.TextContent("Auto stretch Name Column", "When enabled, the name column will automatically stretch to take as much space as possible.", null, null); + public static readonly GUIContent gameObjectIconMode = L10n.TextContent("GameObject Icons", "Controls how the new Hierarchy window replaces GameObject icons.", null, null); public static readonly GUIContent[] gameObjectIconModeOptions = { - EditorGUIUtility.TrTextContent("Use components and custom icons"), - EditorGUIUtility.TrTextContent("Use components only"), - EditorGUIUtility.TrTextContent("Do not change GameObject icons"), + L10n.TextContent("Use components and custom icons", null, null, null), + L10n.TextContent("Use components only", null, null, null), + L10n.TextContent("Do not change GameObject icons", null, null, null), }; - public static readonly GUIContent applicationFrameThrottling = EditorGUIUtility.TrTextContent("Frame Throttling (milliseconds)", "The number of milliseconds the Editor can idle between frames."); - public static readonly GUIContent inputMaxProcessTime = EditorGUIUtility.TrTextContent("Input Throttling (milliseconds)", "The maximum number of milliseconds the Editor will take to process user inputs."); - public static readonly GUIContent interactionMode = EditorGUIUtility.TrTextContent("Interaction Mode", "Specifies how long the Editor can idle before it updates."); - public static readonly GUIContent enterPlayModeSettingsFocusGameView = EditorGUIUtility.TrTextContent("Open Game View On Play", "Open a Game view window when you enter Play mode."); - public static readonly GUIContent enableExtendedDynamicHints = EditorGUIUtility.TrTextContent("Enable extended Dynamic Hints", "Check this to enable extended Dynamic Hints. If available, extended Dynamic Hints will display more information when a property, object or tool is hovered for enough time, or when a Dynamic Hint is displayed"); + public static readonly GUIContent applicationFrameThrottling = L10n.TextContent("Frame Throttling (milliseconds)", "The number of milliseconds the Editor can idle between frames.", null, null); + public static readonly GUIContent inputMaxProcessTime = L10n.TextContent("Input Throttling (milliseconds)", "The maximum number of milliseconds the Editor will take to process user inputs.", null, null); + public static readonly GUIContent interactionMode = L10n.TextContent("Interaction Mode", "Specifies how long the Editor can idle before it updates.", null, null); + public static readonly GUIContent enterPlayModeSettingsFocusGameView = L10n.TextContent("Open Game View On Play", "Open a Game view window when you enter Play mode.", null, null); + public static readonly GUIContent enableExtendedDynamicHints = L10n.TextContent("Enable extended Dynamic Hints", "Check this to enable extended Dynamic Hints. If available, extended Dynamic Hints will display more information when a property, object or tool is hovered for enough time, or when a Dynamic Hint is displayed", null, null); public static readonly GUIContent[] interactionModes = { - EditorGUIUtility.TrTextContent("Default", "The Editor can idle up to 4 ms per frame."), - EditorGUIUtility.TrTextContent("No Throttling", "The Editor does not idle. It runs as fast as possible."), - EditorGUIUtility.TrTextContent("Monitor Refresh Rate", "The Editor can idle up to whatever the monitor's refresh rate is, in milliseconds."), - EditorGUIUtility.TrTextContent("Custom", "You specify how many milliseconds per frame the Editor can idle."), + L10n.TextContent("Default", "The Editor can idle up to 4 ms per frame.", null, null), + L10n.TextContent("No Throttling", "The Editor does not idle. It runs as fast as possible.", null, null), + L10n.TextContent("Monitor Refresh Rate", "The Editor can idle up to whatever the monitor's refresh rate is, in milliseconds.", null, null), + L10n.TextContent("Custom", "You specify how many milliseconds per frame the Editor can idle.", null, null), }; - public static readonly GUIContent progressDialogDelay = EditorGUIUtility.TrTextContent("Busy Progress Delay", "Delay in seconds before 'Unity is busy' progress bar shows up."); - public static readonly GUIContent enableSnapping = EditorGUIUtility.TrTextContent("Graph Snapping", "If enabled, GraphElements in Graph Views (such as Shader Graph) align with one another when you move them. If disabled, GraphElements move freely."); + public static readonly GUIContent progressDialogDelay = L10n.TextContent("Busy Progress Delay", "Delay in seconds before 'Unity is busy' progress bar shows up.", null, null); + public static readonly GUIContent enableSnapping = L10n.TextContent("Graph Snapping", "If enabled, GraphElements in Graph Views (such as Shader Graph) align with one another when you move them. If disabled, GraphElements move freely.", null, null); - public static readonly GUIContent packageManagerLogLevel = EditorGUIUtility.TrTextContent("Package Manager Log Level", + public static readonly GUIContent packageManagerLogLevel = L10n.TextContent("Package Manager Log Level", "Determines the level of detail when the Package Manager writes information to log files.\n" + "\nFrom least detailed to most detailed:" + "\n* Error: unexpected errors and failures only." @@ -114,84 +114,84 @@ class GeneralProperties + "\n* Info: high-level informational messages." + "\n* Verbose: detailed informational messages." + "\n* Debug: high-level debugging messages." - + "\n* Silly: detailed debugging messages."); - public static readonly GUIContent logging = EditorGUIUtility.TrTextContent("Logging"); - public static readonly GUIContent enableLoggingFramework = EditorGUIUtility.TrTextContent("Enable logging framework", "Enable the new logging framework (introduced in Unity 6.6) for high-performance logging with enhanced customisation options. Requires Editor restart to take effect."); - public static readonly GUIContent enableJSONLogging = EditorGUIUtility.TrTextContent("Enable JSON logging", "Output JSON logs to Editor.jsonl in addition to the standard Editor.log. Requires the logging framework to be enabled. Requires Editor restart to take effect."); - public static readonly GUIContent enableExtendedLogging = EditorGUIUtility.TrTextContent("Timestamp Editor log entries", "Adds timestamp and thread Id to Editor.log messages."); - public static readonly GUIContent useGlobalEditorLog = EditorGUIUtility.TrTextContent("Use Global Editor Log", "If enabled, all Unity projects use the same global Editor log file located at the default path for the operating system. If disabled, each project uses its own separate Editor log located in the project folder. Changes to this setting require an Editor restart to take effect."); - public static readonly GUIContent enableShortcutHelperBar = EditorGUIUtility.TrTextContent("Enable Shortcut Helper Bar", "Enables the Shortcut Helper Bar in the status bar at the bottom of the main Unity Editor window."); - public static readonly GUIContent enablePlayModeTooltips = EditorGUIUtility.TrTextContent("Enable PlayMode Tooltips", "Enables tooltips in the editor while in play mode."); - public static readonly GUIContent resetAllDialogBoxes = EditorGUIUtility.TrTextContent("\"Don't ask me again\" checkboxes", "Dialog boxes that can be opted out by checking a \"Don't ask me again\" checkbox."); - public static readonly GUIContent hideDeprecationWarnings = EditorGUIUtility.TrTextContent("Hide deprecation warnings", "Hides warning boxes for deprecated components in the Inspector window."); - public static readonly GUIContent showSecondaryWindowsInTaskbar = EditorGUIUtility.TrTextContent("Show All Windows in Taskbar", + + "\n* Silly: detailed debugging messages.", null, null); + public static readonly GUIContent logging = L10n.TextContent("Logging", null, null, null); + public static readonly GUIContent enableLoggingFramework = L10n.TextContent("Enable logging framework", "Enable the new logging framework (introduced in Unity 6.6) for high-performance logging with enhanced customisation options. Requires Editor restart to take effect.", null, null); + public static readonly GUIContent enableJSONLogging = L10n.TextContent("Enable JSON logging", "Output JSON logs to Editor.jsonl in addition to the standard Editor.log. Requires the logging framework to be enabled. Requires Editor restart to take effect.", null, null); + public static readonly GUIContent enableExtendedLogging = L10n.TextContent("Timestamp Editor log entries", "Adds timestamp and thread Id to Editor.log messages.", null, null); + public static readonly GUIContent useGlobalEditorLog = L10n.TextContent("Use Global Editor Log", "If enabled, all Unity projects use the same global Editor log file located at the default path for the operating system. If disabled, each project uses its own separate Editor log located in the project folder. Changes to this setting require an Editor restart to take effect.", null, null); + public static readonly GUIContent enableShortcutHelperBar = L10n.TextContent("Enable Shortcut Helper Bar", "Enables the Shortcut Helper Bar in the status bar at the bottom of the main Unity Editor window.", null, null); + public static readonly GUIContent enablePlayModeTooltips = L10n.TextContent("Enable PlayMode Tooltips", "Enables tooltips in the editor while in play mode.", null, null); + public static readonly GUIContent resetAllDialogBoxes = L10n.TextContent("\"Don't ask me again\" checkboxes", "Dialog boxes that can be opted out by checking a \"Don't ask me again\" checkbox.", null, null); + public static readonly GUIContent hideDeprecationWarnings = L10n.TextContent("Hide deprecation warnings", "Hides warning boxes for deprecated components in the Inspector window.", null, null); + public static readonly GUIContent showSecondaryWindowsInTaskbar = L10n.TextContent("Show All Windows in Taskbar", @"Enabling this setting allows undocked windows to be minimized in the OS taskbar. -By default, Windows will combine these under a single taskbar item."); - public static readonly GUIContent useProjectPathInTitle = EditorGUIUtility.TrTextContent("Use Project Path in Window Title", "If enabled the Project's name is replaced in the main window title with the Project's path on disk."); +By default, Windows will combine these under a single taskbar item.", null, null); + public static readonly GUIContent useProjectPathInTitle = L10n.TextContent("Use Project Path in Window Title", "If enabled the Project's name is replaced in the main window title with the Project's path on disk.", null, null); } class ExternalProperties { - public static readonly GUIContent codeOptimizationOnStartup = EditorGUIUtility.TrTextContent("Code Optimization On Startup"); - public static readonly GUIContent revisionControlDiffMerge = EditorGUIUtility.TrTextContent("Revision Control Diff/Merge"); - public static readonly GUIContent externalScriptEditor = EditorGUIUtility.TrTextContent("External Script Editor"); - public static readonly GUIContent imageApplication = EditorGUIUtility.TrTextContent("Image application"); + public static readonly GUIContent codeOptimizationOnStartup = L10n.TextContent("Code Optimization On Startup", null, null, null); + public static readonly GUIContent revisionControlDiffMerge = L10n.TextContent("Revision Control Diff/Merge", null, null, null); + public static readonly GUIContent externalScriptEditor = L10n.TextContent("External Script Editor", null, null, null); + public static readonly GUIContent imageApplication = L10n.TextContent("Image application", null, null, null); } class UIScalingProperties { - public static readonly GUIContent editorContentScaling = EditorGUIUtility.TrTextContent("Editor icons and text scaling"); - public static readonly GUIContent defaultContentScaling = EditorGUIUtility.TrTextContent("Use default desktop setting"); - public static readonly GUIContent currentContentScaling = EditorGUIUtility.TrTextContent("Current scaling"); - public static readonly GUIContent customContentScaling = EditorGUIUtility.TrTextContent("Use custom scaling value"); + public static readonly GUIContent editorContentScaling = L10n.TextContent("Editor icons and text scaling", null, null, null); + public static readonly GUIContent defaultContentScaling = L10n.TextContent("Use default desktop setting", null, null, null); + public static readonly GUIContent currentContentScaling = L10n.TextContent("Current scaling", null, null, null); + public static readonly GUIContent customContentScaling = L10n.TextContent("Use custom scaling value", null, null, null); } class ColorsProperties { - public static readonly GUIContent userDefaults = EditorGUIUtility.TrTextContent("Reset All to Default"); + public static readonly GUIContent userDefaults = L10n.TextContent("Reset All to Default", null, null, null); public static readonly string lazyLoadingInfo = L10n.Tr("Some colors may not be available until you open their associated tool or window at least once.", null); } class GICacheProperties { - public static readonly GUIContent maxCacheSize = EditorGUIUtility.TrTextContent("Maximum Cache Size (GB)", "The size of the GI Cache folder will be kept below this maximum value when possible. A background job will periodically clean up the oldest unused files."); - public static readonly GUIContent customCacheLocation = EditorGUIUtility.TrTextContent("Custom cache location", "Specify the GI Cache folder location."); - public static readonly GUIContent cacheFolderLocation = EditorGUIUtility.TrTextContent("Cache Folder Location", "The GI Cache folder is shared between all projects."); - public static readonly GUIContent cacheCompression = EditorGUIUtility.TrTextContent("Cache compression", "Use fast realtime compression for the GI cache files to reduce the size of generated data. Disable it and clean the cache if you need access to the raw data generated by Enlighten."); - public static readonly GUIContent cleanCache = EditorGUIUtility.TrTextContent("Clean Cache"); - public static readonly GUIContent browseGICacheLocation = EditorGUIUtility.TrTextContent("Browse for GI Cache location"); - public static readonly GUIContent cacheSizeIs = EditorGUIUtility.TrTextContent("Cache size is"); + public static readonly GUIContent maxCacheSize = L10n.TextContent("Maximum Cache Size (GB)", "The size of the GI Cache folder will be kept below this maximum value when possible. A background job will periodically clean up the oldest unused files.", null, null); + public static readonly GUIContent customCacheLocation = L10n.TextContent("Custom cache location", "Specify the GI Cache folder location.", null, null); + public static readonly GUIContent cacheFolderLocation = L10n.TextContent("Cache Folder Location", "The GI Cache folder is shared between all projects.", null, null); + public static readonly GUIContent cacheCompression = L10n.TextContent("Cache compression", "Use fast realtime compression for the GI cache files to reduce the size of generated data. Disable it and clean the cache if you need access to the raw data generated by Enlighten.", null, null); + public static readonly GUIContent cleanCache = L10n.TextContent("Clean Cache", null, null, null); + public static readonly GUIContent browseGICacheLocation = L10n.TextContent("Browse for GI Cache location", null, null, null); + public static readonly GUIContent cacheSizeIs = L10n.TextContent("Cache size is", null, null, null); } class SceneViewProperties { - public static readonly GUIContent enableFilteringWhileSearching = EditorGUIUtility.TrTextContent("Enable filtering while searching", "If enabled, searching will cause non-matching items in the scene view to be greyed out"); - public static readonly GUIContent enableFilteringWhileLodGroupEditing = EditorGUIUtility.TrTextContent("Enable filtering while editing LOD groups", "If enabled, editing LOD groups will cause other objects in the scene view to be greyed out"); - public static readonly GUIContent useGridColor = EditorGUIUtility.TrTextContent("Use axis colors on main grid axes", "If enabled, the grid will show the axis colors on the main axes"); - public static readonly GUIContent handlesLineThickness = EditorGUIUtility.TrTextContent("Line Thickness", "Thickness of manipulator tool handle lines"); - public static readonly GUIContent placementMode = EditorGUIUtility.TrTextContent("3D Placement Mode", "Select where newly created 3D objects are placed in the scene."); - public static readonly GUIContent createObjectsAtWorldOrigin = EditorGUIUtility.TrTextContent("World Origin"); - public static readonly GUIContent createObjectsAtRaycastToScenePivot = EditorGUIUtility.TrTextContent("Scene Intersection"); - public static readonly GUIContent createObjectsAtScenePivot = EditorGUIUtility.TrTextContent("Scene Pivot"); - public static readonly GUIContent createObjectsAtPrefabPosition = EditorGUIUtility.TrTextContent("Use prefab asset position when dropping on the Hierarchy window", "If enabled, prefabs dropped on the Hierarchy window are placed in the scene at the position serialized in the prefab's root transform. If disabled, prefabs are placed based on the 3D Placement Mode"); - public static readonly GUIContent enableConstrainProportionsScalingForNewObjects = EditorGUIUtility.TrTextContent("Create Objects with Constrained Proportions scale on", "If enabled, scale in the transform component will be set to constrain proportions for new GameObjects by default"); - public static readonly GUIContent useInspectorExpandedStateContent = EditorGUIUtility.TrTextContent("Auto-hide gizmos", "Automatically hide gizmos of Components collapsed in the Inspector"); - public static readonly GUIContent ignoreAlwaysRefreshWhenNotFocused = EditorGUIUtility.TrTextContent("Refresh the Scene view only when the Editor is in focus.", "If enabled, ignore the \"Always Refresh\" flag on the Scene view when the Editor is not the foregrounded application."); + public static readonly GUIContent enableFilteringWhileSearching = L10n.TextContent("Enable filtering while searching", "If enabled, searching will cause non-matching items in the scene view to be greyed out", null, null); + public static readonly GUIContent enableFilteringWhileLodGroupEditing = L10n.TextContent("Enable filtering while editing LOD groups", "If enabled, editing LOD groups will cause other objects in the scene view to be greyed out", null, null); + public static readonly GUIContent useGridColor = L10n.TextContent("Use axis colors on main grid axes", "If enabled, the grid will show the axis colors on the main axes", null, null); + public static readonly GUIContent handlesLineThickness = L10n.TextContent("Line Thickness", "Thickness of manipulator tool handle lines", null, null); + public static readonly GUIContent placementMode = L10n.TextContent("3D Placement Mode", "Select where newly created 3D objects are placed in the scene.", null, null); + public static readonly GUIContent createObjectsAtWorldOrigin = L10n.TextContent("World Origin", null, null, null); + public static readonly GUIContent createObjectsAtRaycastToScenePivot = L10n.TextContent("Scene Intersection", null, null, null); + public static readonly GUIContent createObjectsAtScenePivot = L10n.TextContent("Scene Pivot", null, null, null); + public static readonly GUIContent createObjectsAtPrefabPosition = L10n.TextContent("Use prefab asset position when dropping on the Hierarchy window", "If enabled, prefabs dropped on the Hierarchy window are placed in the scene at the position serialized in the prefab's root transform. If disabled, prefabs are placed based on the 3D Placement Mode", null, null); + public static readonly GUIContent enableConstrainProportionsScalingForNewObjects = L10n.TextContent("Create Objects with Constrained Proportions scale on", "If enabled, scale in the transform component will be set to constrain proportions for new GameObjects by default", null, null); + public static readonly GUIContent useInspectorExpandedStateContent = L10n.TextContent("Auto-hide gizmos", "Automatically hide gizmos of Components collapsed in the Inspector", null, null); + public static readonly GUIContent ignoreAlwaysRefreshWhenNotFocused = L10n.TextContent("Refresh the Scene view only when the Editor is in focus.", "If enabled, ignore the \"Always Refresh\" flag on the Scene view when the Editor is not the foregrounded application.", null, null); } class LanguageProperties { - public static readonly GUIContent editorLanguageExperimental = EditorGUIUtility.TrTextContent("Editor Language (Experimental)"); - public static readonly GUIContent editorLanguage = EditorGUIUtility.TrTextContent("Editor language"); - public static readonly GUIContent localizeCompileMessages = EditorGUIUtility.TrTextContent("Localize compiler messages"); + public static readonly GUIContent editorLanguageExperimental = L10n.TextContent("Editor Language (Experimental)", null, null, null); + public static readonly GUIContent editorLanguage = L10n.TextContent("Editor language", null, null, null); + public static readonly GUIContent localizeCompileMessages = L10n.TextContent("Localize compiler messages", null, null, null); } class DeveloperModeProperties { - public static readonly GUIContent developerMode = EditorGUIUtility.TrTextContent("Developer Mode", "Enable or disable developer mode features."); - public static readonly GUIContent generateOnPostprocessAllAssets = EditorGUIUtility.TrTextContent("Generate OnPostprocessAllAssets Dependency Diagram", "Generates a graphviz diagram to show OnPostprocessAllAssets dependencies."); - public static readonly GUIContent showRepaintDots = EditorGUIUtility.TrTextContent("Show Repaint Dots", "Enable or disable the colored dots that flash when an EditorWindow repaints."); - public static readonly GUIContent redirectionServer = EditorGUIUtility.TrTextContent("Documentation Server", "Select the documentation redirection server."); + public static readonly GUIContent developerMode = L10n.TextContent("Developer Mode", "Enable or disable developer mode features.", null, null); + public static readonly GUIContent generateOnPostprocessAllAssets = L10n.TextContent("Generate OnPostprocessAllAssets Dependency Diagram", "Generates a graphviz diagram to show OnPostprocessAllAssets dependencies.", null, null); + public static readonly GUIContent showRepaintDots = L10n.TextContent("Show Repaint Dots", "Enable or disable the colored dots that flash when an EditorWindow repaints.", null, null); + public static readonly GUIContent redirectionServer = L10n.TextContent("Documentation Server", "Select the documentation redirection server.", null, null); } private List prefWinExtensions; @@ -329,6 +329,9 @@ internal static bool useProjectPathInTitle } [AutoStaticsCleanupOnCodeReload] + // Subscribers are inspector helpers that subscribe and unsubscribe with their own lifecycle, so + // the cleared invocation list refills as they are recreated. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] internal static Action hideDeprecationWarningsChanged; internal static bool hideDeprecationWarnings diff --git a/Editor/Mono/PresetLibraries/PopupWindowContentForNewLibrary.cs b/Editor/Mono/PresetLibraries/PopupWindowContentForNewLibrary.cs index db9abd21c0..442a24bc1c 100644 --- a/Editor/Mono/PresetLibraries/PopupWindowContentForNewLibrary.cs +++ b/Editor/Mono/PresetLibraries/PopupWindowContentForNewLibrary.cs @@ -20,10 +20,10 @@ class PopupWindowContentForNewLibrary : PopupWindowContent class Texts { - public GUIContent header = EditorGUIUtility.TrTextContent("Create New Library"); - public GUIContent name = EditorGUIUtility.TrTextContent("Name"); - public GUIContent location = EditorGUIUtility.TrTextContent("Location"); - public GUIContent[] fileLocations = new[] {EditorGUIUtility.TrTextContent("Preferences Folder"), EditorGUIUtility.TrTextContent("Project Folder")}; + public GUIContent header = L10n.TextContent("Create New Library", null, null, null); + public GUIContent name = L10n.TextContent("Name", null, null, null); + public GUIContent location = L10n.TextContent("Location", null, null, null); + public GUIContent[] fileLocations = new[] {L10n.TextContent("Preferences Folder", null, null, null), L10n.TextContent("Project Folder", null, null, null)}; public PresetFileLocation[] fileLocationOrder = new[] { PresetFileLocation.PreferencesFolder, PresetFileLocation.ProjectFolder }; // must match order of fileLocations above } [NoAutoStaticsCleanup] // Lazy Styles/Texts cache of GUIContent (whitelisted, asset-backed); safe to persist across code reload diff --git a/Editor/Mono/PresetLibraries/PresetLibraryEditor.cs b/Editor/Mono/PresetLibraries/PresetLibraryEditor.cs index 774a7a9444..0601d63733 100644 --- a/Editor/Mono/PresetLibraries/PresetLibraryEditor.cs +++ b/Editor/Mono/PresetLibraries/PresetLibraryEditor.cs @@ -77,10 +77,10 @@ class Styles public GUIStyle innerShadowBg = GetStyle("InnerShadowBg"); public GUIStyle optionsButton = GetStyle("PaneOptions"); public GUIStyle newPresetStyle = new GUIStyle(EditorStyles.boldLabel); - public GUIContent plusButtonText = EditorGUIUtility.TrTextContent("", "Add new preset"); - public GUIContent plusButtonTextNotCheckedOut = EditorGUIUtility.TrTextContent("", "To add presets you need to press the 'Check out' button below"); - public GUIContent header = EditorGUIUtility.TrTextContent("Presets"); - public GUIContent newPreset = EditorGUIUtility.TrTextContent("New"); + public GUIContent plusButtonText = L10n.TextContent("", "Add new preset", null, null); + public GUIContent plusButtonTextNotCheckedOut = L10n.TextContent("", "To add presets you need to press the 'Check out' button below", null, null); + public GUIContent header = L10n.TextContent("Presets", null, null, null); + public GUIContent newPreset = L10n.TextContent("New", null, null, null); // We need a fixed id as the generated one can change when we are in the middle of renaming a gradient (UUM-148458) public static readonly int settingsControlId = GUIUtility.GetPermanentControlID(); @@ -889,10 +889,10 @@ static internal void Show(bool isOpenForEdit, int presetIndex, object newPresetO s_Caller = caller; s_PresetIndex = presetIndex; - GUIContent replaceText = EditorGUIUtility.TrTextContent("Replace"); - GUIContent deleteText = EditorGUIUtility.TrTextContent("Delete"); - GUIContent renameText = EditorGUIUtility.TrTextContent("Rename"); - GUIContent moveToText = EditorGUIUtility.TrTextContent("Move To First"); + GUIContent replaceText = L10n.TextContent("Replace", null, null, null); + GUIContent deleteText = L10n.TextContent("Delete", null, null, null); + GUIContent renameText = L10n.TextContent("Rename", null, null, null); + GUIContent moveToText = L10n.TextContent("Move To First", null, null, null); GenericMenu menu = new GenericMenu(); if (isOpenForEdit) diff --git a/Editor/Mono/PresetLibraries/PresetLibraryEditorMenu.cs b/Editor/Mono/PresetLibraries/PresetLibraryEditorMenu.cs index c78aed3351..564e6f3e02 100644 --- a/Editor/Mono/PresetLibraries/PresetLibraryEditorMenu.cs +++ b/Editor/Mono/PresetLibraries/PresetLibraryEditorMenu.cs @@ -38,18 +38,18 @@ public static void Show(Rect activatorRect, PresetLibraryEditor owner) { viewModeData = new List { - new ViewModeData {text = EditorGUIUtility.TrTextContent("Grid"), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, - new ViewModeData {text = EditorGUIUtility.TrTextContent("List"), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List}, + new ViewModeData {text = L10n.TextContent("Grid", null, null, null), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, + new ViewModeData {text = L10n.TextContent("List", null, null, null), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List}, }; } else { viewModeData = new List { - new ViewModeData {text = EditorGUIUtility.TrTextContent("Small Grid"), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, - new ViewModeData {text = EditorGUIUtility.TrTextContent("Large Grid"), itemHeight = maxItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, - new ViewModeData {text = EditorGUIUtility.TrTextContent("Small List"), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List}, - new ViewModeData {text = EditorGUIUtility.TrTextContent("Large List"), itemHeight = maxItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List} + new ViewModeData {text = L10n.TextContent("Small Grid", null, null, null), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, + new ViewModeData {text = L10n.TextContent("Large Grid", null, null, null), itemHeight = maxItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.Grid}, + new ViewModeData {text = L10n.TextContent("Small List", null, null, null), itemHeight = minItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List}, + new ViewModeData {text = L10n.TextContent("Large List", null, null, null), itemHeight = maxItemHeight, viewmode = PresetLibraryEditorState.ItemViewMode.List} }; } @@ -81,14 +81,14 @@ public static void Show(Rect activatorRect, PresetLibraryEditor owner) menu.AddItem(new GUIContent(libName + projectFolderTag), currentLibWithExtension == libPath, LibraryModeChange, libPath); } menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Create New Library..."), false, CreateLibrary, 0); + menu.AddItem(L10n.TextContent("Create New Library...", null, null, null), false, CreateLibrary, 0); if (HasDefaultPresets()) { menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Add Factory Presets To Current Library"), false, AddDefaultPresetsToCurrentLibrary, 0); + menu.AddItem(L10n.TextContent("Add Factory Presets To Current Library", null, null, null), false, AddDefaultPresetsToCurrentLibrary, 0); } menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Reveal Current Library Location"), false, RevealCurrentLibrary, 0); + menu.AddItem(L10n.TextContent("Reveal Current Library Location", null, null, null), false, RevealCurrentLibrary, 0); menu.DropDown(activatorRect); } diff --git a/Editor/Mono/ProjectBrowser/CachedFilteredHierachy.cs b/Editor/Mono/ProjectBrowser/CachedFilteredHierachy.cs index 51653c2e3d..ccaea2edf0 100644 --- a/Editor/Mono/ProjectBrowser/CachedFilteredHierachy.cs +++ b/Editor/Mono/ProjectBrowser/CachedFilteredHierachy.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ProjectBrowser not yet converted using UnityEngine; using System.Collections.Generic; using System.Linq; @@ -741,4 +740,3 @@ public EntityId GetEntityIdIfImported() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ProjectBrowser/ProjectBrowser.cs b/Editor/Mono/ProjectBrowser/ProjectBrowser.cs index 6179215c66..dd0c766d61 100644 --- a/Editor/Mono/ProjectBrowser/ProjectBrowser.cs +++ b/Editor/Mono/ProjectBrowser/ProjectBrowser.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ProjectBrowser not yet converted using System; using UnityEditor.ProjectWindowCallback; using UnityEngine; @@ -118,18 +117,18 @@ class Styles public GUIStyle lockButton = "IN LockButton"; public GUIStyle separator = "ArrowNavigationRight"; - public GUIContent m_FilterByLabel = EditorGUIUtility.TrIconContent("FilterByLabel", "Search by Label"); - public GUIContent m_FilterByType = EditorGUIUtility.TrIconContent("FilterByType", "Search by Type"); - public GUIContent m_FilterByImportLogInactive = EditorGUIUtility.TrIconContent("ImportLogType_Inactive", "Search by Import Log Type"); - public GUIContent m_FilterByImportLogError = EditorGUIUtility.TrIconContent("ImportLogType_Error", "Search by Import Log Type"); - public GUIContent m_FilterByImportLogWarning = EditorGUIUtility.TrIconContent("ImportLogType_Warning", "Search by Import Log Type"); - public GUIContent m_CreateDropdownContent = EditorGUIUtility.TrIconContent("Toolbar Plus More", "Create new Asset"); - public GUIContent m_SaveFilterContent = EditorGUIUtility.TrIconContent("Favorite", "Save search"); + public GUIContent m_FilterByLabel = L10n.IconContent("FilterByLabel", "Search by Label", null); + public GUIContent m_FilterByType = L10n.IconContent("FilterByType", "Search by Type", null); + public GUIContent m_FilterByImportLogInactive = L10n.IconContent("ImportLogType_Inactive", "Search by Import Log Type", null); + public GUIContent m_FilterByImportLogError = L10n.IconContent("ImportLogType_Error", "Search by Import Log Type", null); + public GUIContent m_FilterByImportLogWarning = L10n.IconContent("ImportLogType_Warning", "Search by Import Log Type", null); + public GUIContent m_CreateDropdownContent = L10n.IconContent("Toolbar Plus More", "Create new Asset", null); + public GUIContent m_SaveFilterContent = L10n.IconContent("Favorite", "Save search", null); public GUIContent m_PackageContentDefault = new GUIContent("", ""); - public GUIContent m_PackagesContentNotVisible = EditorGUIUtility.TrIconContent("PBrowserPackagesNotVisible", "Number of hidden packages, click to display packages."); - public GUIContent m_PackagesContentVisible = EditorGUIUtility.TrIconContent("PBrowserPackagesVisible", "Number of displayed packages, click to hide packages."); - public GUIContent m_EmptyFolderText = EditorGUIUtility.TrTextContent("This folder is empty"); - public GUIContent m_SearchIn = EditorGUIUtility.TrTextContent("Search:"); + public GUIContent m_PackagesContentNotVisible = L10n.IconContent("PBrowserPackagesNotVisible", "Number of hidden packages, click to display packages.", null); + public GUIContent m_PackagesContentVisible = L10n.IconContent("PBrowserPackagesVisible", "Number of displayed packages, click to hide packages.", null); + public GUIContent m_EmptyFolderText = L10n.TextContent("This folder is empty", null, null, null); + public GUIContent m_SearchIn = L10n.TextContent("Search:", null, null, null); public Styles() { @@ -261,11 +260,11 @@ bool useTreeViewSelectionInsteadOfMainSelection // Used by search menu bar [NonSerialized] - public GUIContent m_SearchAllAssets = EditorGUIUtility.TrTextContent("All"); + public GUIContent m_SearchAllAssets = L10n.TextContent("All", null, null, null); [NonSerialized] - public GUIContent m_SearchInPackagesOnly = EditorGUIUtility.TrTextContent("In Packages"); + public GUIContent m_SearchInPackagesOnly = L10n.TextContent("In Packages", null, null, null); [NonSerialized] - public GUIContent m_SearchInAssetsOnly = EditorGUIUtility.TrTextContent("In Assets"); + public GUIContent m_SearchInAssetsOnly = L10n.TextContent("In Assets", null, null, null); [NonSerialized] public GUIContent m_SearchInFolders = new GUIContent(""); // updated when needed @@ -276,10 +275,6 @@ bool useTreeViewSelectionInsteadOfMainSelection internal static float searchUpdateDelaySeconds => SearchUtils.debounceThresholdMs / 1000f; - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - ProjectBrowser() { } - #pragma warning restore UAL0015 - /* Keep for debugging void TestProjectItemOverlayCallback (string guid, Rect selectionRect) { @@ -2508,12 +2503,12 @@ public virtual void AddItemsToMenu(GenericMenu menu) { if (Application.platform == RuntimePlatform.OSXEditor) { - GUIContent showFoldersFirstText = EditorGUIUtility.TrTextContent("Keep folders on top"); // Matches macOS preference name + GUIContent showFoldersFirstText = L10n.TextContent("Keep folders on top", null, null, null); // Matches macOS preference name menu.AddItem(showFoldersFirstText, k_ShowFoldersFirst.value, ToggleShowFoldersFirst); } - GUIContent assetTreeText = EditorGUIUtility.TrTextContent("One Column Layout"); - GUIContent assetBrowserText = EditorGUIUtility.TrTextContent("Two Column Layout"); + GUIContent assetTreeText = L10n.TextContent("One Column Layout", null, null, null); + GUIContent assetBrowserText = L10n.TextContent("Two Column Layout", null, null, null); menu.AddItem(assetTreeText, m_ViewMode == ViewMode.OneColumn, SetOneColumn); if (position.width >= k_MinWidthTwoColumns) @@ -2525,8 +2520,8 @@ public virtual void AddItemsToMenu(GenericMenu menu) if (Unsupported.IsDeveloperMode()) { - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Open TreeView Test Window..."), false, OpenTreeViewTestWindow); - menu.AddItem(EditorGUIUtility.TrTextContent("DEVELOPER/Use TreeView Expansion Animation"), EditorPrefs.GetBool(TreeViewController.kExpansionAnimationPrefKey, false), ToggleExpansionAnimationPreference); + menu.AddItem(L10n.TextContent("DEVELOPER/Open TreeView Test Window...", null, null, null), false, OpenTreeViewTestWindow); + menu.AddItem(L10n.TextContent("DEVELOPER/Use TreeView Expansion Animation", null, null, null), EditorPrefs.GetBool(TreeViewController.kExpansionAnimationPrefKey, false), ToggleExpansionAnimationPreference); } } } @@ -2712,7 +2707,9 @@ void SearchField() m_SearchFieldText = m_lastSearchFilter; m_NextSearchOffDelegate?.Invoke(); +#pragma warning disable UAL0018 // the deregistration handle lives on this window, which is recreated on code reload together with the delayed call it cancels m_NextSearchOffDelegate = EditorApplication.CallDelayed(UpdateSearchDelayed, searchUpdateDelaySeconds); +#pragma warning restore UAL0018 } SearchService.SearchService.DrawOpenSearchButton(this, m_SearchFieldText); @@ -3386,7 +3383,7 @@ internal class SavedFiltersContextMenu static internal void Show(int filterId) { // Curve context menu - GUIContent delete = EditorGUIUtility.TrTextContent("Delete"); + GUIContent delete = L10n.TextContent("Delete", null, null, null); GenericMenu menu = new GenericMenu(); menu.AddItem(delete, false, new SavedFiltersContextMenu(filterId).Delete); @@ -3446,7 +3443,7 @@ static internal void Show(string folder, string currentSubFolder, Rect activator } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("No sub folders...")); + menu.AddDisabledItem(L10n.TextContent("No sub folders...", null, null, null)); } menu.DropDown(activatorRect); @@ -3469,4 +3466,3 @@ private void SelectSubFolder() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ProjectBrowser/SearchableEditorWindow.cs b/Editor/Mono/ProjectBrowser/SearchableEditorWindow.cs index 36b221b295..6d849d18e0 100644 --- a/Editor/Mono/ProjectBrowser/SearchableEditorWindow.cs +++ b/Editor/Mono/ProjectBrowser/SearchableEditorWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using UnityEngine; using System.Collections.Generic; using Object = UnityEngine.Object; @@ -15,10 +14,6 @@ namespace UnityEditor [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("CodeReloadSafety", "UAL0001:Unsealed Public Class", Justification = "Unsealed on purpose")] public partial class SearchableEditorWindow : EditorWindow, ISearchableContainer { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public SearchableEditorWindow() { } - #pragma warning restore UAL0015 - public enum SearchMode { All, Name, Type, Label, AssetBundleName } public enum SearchModeHierarchyWindow { All, Name, Type } @@ -392,7 +387,9 @@ internal void SearchFieldGUI(float maxWidth) m_SearchMode = (SearchMode)searchMode; m_SearchStringDebounced = searchFilter; m_DeregisterDebounceCall?.Invoke(); +#pragma warning disable UAL0018 // the deregistration handle lives on this window, which is recreated on code reload together with the debounced call it cancels m_DeregisterDebounceCall = EditorApplication.CallDelayed(SetSearchFilterDebounced, SearchUtils.debounceThresholdMs / 1000f); +#pragma warning restore UAL0018 } m_HasSearchFilterFocus = GUIUtility.keyboardControl == searchFieldControlId; @@ -417,4 +414,3 @@ internal void SearchFieldGUI(float maxWidth) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/ProjectTemplateWindow.cs b/Editor/Mono/ProjectTemplateWindow.cs index f17a431d93..b7ce86cb2f 100644 --- a/Editor/Mono/ProjectTemplateWindow.cs +++ b/Editor/Mono/ProjectTemplateWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Hub not yet converted using System; using System.IO; using System.Collections.Generic; @@ -29,7 +28,7 @@ internal static void SaveAsTemplate() void OnEnable() { - titleContent = EditorGUIUtility.TrTextContent("Save Template"); + titleContent = L10n.TextContent("Save Template", null, null, null); } string ReadJsonString(JSONValue json, string key) @@ -78,4 +77,3 @@ void OnGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PromptWindow/PromptWindow.cs b/Editor/Mono/PromptWindow/PromptWindow.cs index 52a673d310..b8c81a8d50 100644 --- a/Editor/Mono/PromptWindow/PromptWindow.cs +++ b/Editor/Mono/PromptWindow/PromptWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using System; using UnityEditor.Experimental; using UnityEngine; @@ -134,4 +133,3 @@ void OnTextFieldKeyDown(KeyDownEvent evt) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/PromptWindow/PromptWindowBase.cs b/Editor/Mono/PromptWindow/PromptWindowBase.cs index f8846d3e91..2106e46ebc 100644 --- a/Editor/Mono/PromptWindow/PromptWindowBase.cs +++ b/Editor/Mono/PromptWindow/PromptWindowBase.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneTooling not yet converted using UnityEngine; namespace UnityEditor @@ -31,4 +30,3 @@ void CenterWindow(EditorWindow owner) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/RemoveLegacyMenuItems.cs b/Editor/Mono/RemoveLegacyMenuItems.cs index c76ecc3ee1..30800dbd89 100644 --- a/Editor/Mono/RemoveLegacyMenuItems.cs +++ b/Editor/Mono/RemoveLegacyMenuItems.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SRPSettings not yet converted using UnityEngine; using UnityEngine.Rendering; @@ -35,4 +34,3 @@ static void RemoveBIRPMenuItems() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/RenderDoc/RenderDoc.bindings.cs b/Editor/Mono/RenderDoc/RenderDoc.bindings.cs index 0713480960..28416d99d5 100644 --- a/Editor/Mono/RenderDoc/RenderDoc.bindings.cs +++ b/Editor/Mono/RenderDoc/RenderDoc.bindings.cs @@ -42,7 +42,7 @@ public static void EndCaptureRenderDoc(EditorWindow window) internal static bool RenderDocCaptureButton(EditorWindow view, WindowAction self, Rect r) { if (s_RenderDocContent == null) - s_RenderDocContent = EditorGUIUtility.TrIconContent("FrameCapture", RenderDocUtil.openInRenderDocTooltip); + s_RenderDocContent = L10n.IconContent("FrameCapture", RenderDocUtil.openInRenderDocTooltip, null); Rect r2 = new Rect(r.xMax - r.width, r.y, r.width, r.height); return GUI.Button(r2, s_RenderDocContent, EditorStyles.iconButton); diff --git a/Editor/Mono/RenderDoc/RenderDocUtil.cs b/Editor/Mono/RenderDoc/RenderDocUtil.cs index 1172c9562a..10d6bbd6a7 100644 --- a/Editor/Mono/RenderDoc/RenderDocUtil.cs +++ b/Editor/Mono/RenderDoc/RenderDocUtil.cs @@ -14,7 +14,7 @@ internal class RenderDocUtil public const string captureStartEndRenderDocShortcutID = "Start-End Window Capture frame with RenderDoc"; public const string openInRenderDocTooltip = "Capture the current view and open in RenderDoc"; - public static GUIContent LoadRenderDocMenuItem => EditorGUIUtility.TrTextContent($"Load RenderDoc " + - $"{KeyCombination.SequenceToMenuString(ShortcutManager.instance.GetShortcutBinding(captureRenderDocShortcutID).keyCombinationSequence)}"); + public static GUIContent LoadRenderDocMenuItem => L10n.TextContent($"Load RenderDoc " + + $"{KeyCombination.SequenceToMenuString(ShortcutManager.instance.GetShortcutBinding(captureRenderDocShortcutID).keyCombinationSequence)}", null, null, null); } } diff --git a/Editor/Mono/RenderPipelineGraphicsSettingsContextMenu.cs b/Editor/Mono/RenderPipelineGraphicsSettingsContextMenu.cs index 13f7841715..743ba290a3 100644 --- a/Editor/Mono/RenderPipelineGraphicsSettingsContextMenu.cs +++ b/Editor/Mono/RenderPipelineGraphicsSettingsContextMenu.cs @@ -255,11 +255,11 @@ public void PopulateContextMenu(IRenderPipelineGraphicsSettings setting, Seriali } if (EditorApplication.isPlaying) - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(k_Label), false); + menu.AddDisabledItem(L10n.TextContent(k_Label, null, null, null), false); else { targets = new() { setting }; - menu.AddItem(EditorGUIUtility.TrTextContent(k_Label), false, (implementation) => Reset((ResetImplementation)implementation), this); + menu.AddItem(L10n.TextContent(k_Label, null, null, null), false, (implementation) => Reset((ResetImplementation)implementation), this); } } diff --git a/Editor/Mono/RenderPipelineResourcesEditorUtils.cs b/Editor/Mono/RenderPipelineResourcesEditorUtils.cs index 23770294d0..d4be9e811d 100644 --- a/Editor/Mono/RenderPipelineResourcesEditorUtils.cs +++ b/Editor/Mono/RenderPipelineResourcesEditorUtils.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SRPSettings not yet converted using System; using System.Reflection; using UnityEngine; @@ -241,4 +240,3 @@ void CheckTypeMismatch(string path, Type expectedType) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SavedEditorGUIState.cs b/Editor/Mono/SavedEditorGUIState.cs new file mode 100644 index 0000000000..77c8bb5575 --- /dev/null +++ b/Editor/Mono/SavedEditorGUIState.cs @@ -0,0 +1,173 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: IMGUIFramework not yet converted +using System.Collections.Generic; +using UnityEngine; + +namespace UnityEditor +{ + // Managed counterpart of SavedGUIState for the per-pass EditorGUI state that + // EditorGUIUtility.ResetGUIState wipes, so that an OnGUI pass dispatched while another + // pass is running does not corrupt the state of the pass it interrupts (UUM-148902). + internal struct SavedEditorGUIState + { + internal PropertyGUIData[] propertyStack; + internal bool[] enabledStack; + internal bool[] changedStack; + internal (bool insideList, int depth)[] isInsideListStack; + internal bool isInsideList; + internal bool showMixedValue; + internal int foldoutHeaderGroupActive; + internal int indentLevel; + internal object materialPropertyStack; + internal PropertyDrawer[] drawerStack; + internal PropertyHandlerCache propertyHandlerCache; + internal float labelWidth; + internal float fieldWidth; + internal float overriddenViewWidth; + internal bool boldDefaultFont; + internal float[] contextWidthStack; + internal bool hierarchyMode; + internal bool wideMode; + internal EditorGUIUtility.ComparisonViewMode comparisonViewMode; + internal float leftMarginCoord; + private bool captured; + + internal static SavedEditorGUIState Capture() + { + var state = new SavedEditorGUIState(); + EditorGUI.CaptureReentrantState(ref state); + EditorGUIUtility.CaptureReentrantState(ref state); + state.materialPropertyStack = MaterialProperty.CaptureReentrantStack(); + state.drawerStack = ScriptAttributeUtility.CaptureReentrantDrawerStack(); + state.captured = true; + + // The interrupting pass starts from the same clean slate ResetGUIState provides. + EditorGUIUtility.ResetPerPassState(); + return state; + } + + internal void Apply() + { + if (!captured) + return; + + EditorGUI.RestoreReentrantState(in this); + EditorGUIUtility.RestoreReentrantState(in this); + MaterialProperty.RestoreReentrantStack(materialPropertyStack); + ScriptAttributeUtility.RestoreReentrantDrawerStack(drawerStack); + } + + internal static void RestoreStack(Stack stack, T[] saved) + { + stack.Clear(); + for (int i = saved.Length - 1; i >= 0; i--) + stack.Push(saved[i]); + } + } + + public sealed partial class EditorGUI + { + internal static void CaptureReentrantState(ref SavedEditorGUIState state) + { + state.propertyStack = s_PropertyStack.ToArray(); + state.enabledStack = s_EnabledStack.ToArray(); + state.changedStack = s_ChangedStack.ToArray(); + state.isInsideListStack = s_IsInsideListStack.ToArray(); + state.isInsideList = GUI.isInsideList; + state.showMixedValue = showMixedValue; + state.foldoutHeaderGroupActive = s_FoldoutHeaderGroupActive; + state.indentLevel = ms_IndentLevel; + + // Not part of ResetPerPassState: EndProperty in the interrupting pass would leave the + // suspended multi-object property scope reading stale mixed-value state. + showMixedValue = false; + } + + internal static void RestoreReentrantState(in SavedEditorGUIState state) + { + SavedEditorGUIState.RestoreStack(s_PropertyStack, state.propertyStack); + SavedEditorGUIState.RestoreStack(s_EnabledStack, state.enabledStack); + SavedEditorGUIState.RestoreStack(s_ChangedStack, state.changedStack); + SavedEditorGUIState.RestoreStack(s_IsInsideListStack, state.isInsideListStack); + GUI.isInsideList = state.isInsideList; + showMixedValue = state.showMixedValue; + s_FoldoutHeaderGroupActive = state.foldoutHeaderGroupActive; + ms_IndentLevel = state.indentLevel; + } + } + + public sealed partial class EditorGUIUtility + { + internal static void CaptureReentrantState(ref SavedEditorGUIState state) + { + state.labelWidth = s_LabelWidth; + state.fieldWidth = s_FieldWidth; + state.overriddenViewWidth = s_OverriddenViewWidth; + state.boldDefaultFont = GetBoldDefaultFont(); + state.contextWidthStack = s_ContextWidthStack.ToArray(); + state.hierarchyMode = hierarchyMode; + state.wideMode = wideMode; + state.comparisonViewMode = comparisonViewMode; + state.leftMarginCoord = leftMarginCoord; + state.propertyHandlerCache = ScriptAttributeUtility.CaptureReentrantHandlerCache(); + + // ResetPerPassState only pops one lock; the interrupting pass must not inherit the rest. + s_ContextWidthStack.Clear(); + } + + internal static void RestoreReentrantState(in SavedEditorGUIState state) + { + s_LabelWidth = state.labelWidth; + s_FieldWidth = state.fieldWidth; + s_OverriddenViewWidth = state.overriddenViewWidth; + SetBoldDefaultFont(state.boldDefaultFont); + SavedEditorGUIState.RestoreStack(s_ContextWidthStack, state.contextWidthStack); + hierarchyMode = state.hierarchyMode; + wideMode = state.wideMode; + comparisonViewMode = state.comparisonViewMode; + leftMarginCoord = state.leftMarginCoord; + ScriptAttributeUtility.RestoreReentrantHandlerCache(state.propertyHandlerCache); + } + } + + public sealed partial class MaterialProperty + { + internal static object CaptureReentrantStack() + { + return s_PropertyStack.ToArray(); + } + + internal static void RestoreReentrantStack(object saved) + { + s_PropertyStack.Clear(); + s_PropertyStack.AddRange((PropertyData[])saved); + } + } + + internal partial class ScriptAttributeUtility + { + internal static PropertyDrawer[] CaptureReentrantDrawerStack() + { + return s_DrawerStack.ToArray(); + } + + internal static void RestoreReentrantDrawerStack(PropertyDrawer[] saved) + { + SavedEditorGUIState.RestoreStack(s_DrawerStack, saved); + } + + internal static PropertyHandlerCache CaptureReentrantHandlerCache() + { + return s_CurrentCache; + } + + internal static void RestoreReentrantHandlerCache(PropertyHandlerCache cache) + { + s_CurrentCache = cache; + } + } +} +#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SavedGUIState.bindings.cs b/Editor/Mono/SavedGUIState.bindings.cs index 431c534a81..2b0cadc06c 100644 --- a/Editor/Mono/SavedGUIState.bindings.cs +++ b/Editor/Mono/SavedGUIState.bindings.cs @@ -33,7 +33,13 @@ internal partial struct SavedGUIState private void CaptureManaged() { skin = GUI.skin; - layoutCache = GUILayoutUtility.current.State; + // The state's group stack aliases the live cache, which a re-entrant Layout pass clears in place; the backup must own a copy (UUM-148153). + var live = GUILayoutUtility.current.State; + var groups = live.layoutGroups.ToArray(); + var copiedGroups = new GenericStack(); + for (int i = groups.Length - 1; i >= 0; i--) + copiedGroups.Push(groups[i]); + layoutCache = new GUILayoutUtility.LayoutCacheState(live.id, live.topLevel, copiedGroups, live.windows); unbalancedGroupsCount = GUILayoutUtility.unbalancedgroupscount; entityId = GUIUtility.s_OriginalID; if (GUI.scrollViewStates.Count != 0) @@ -47,7 +53,8 @@ private void ApplyManaged() { GUILayoutUtility.current.CopyState(layoutCache); GUILayoutUtility.unbalancedgroupscount = unbalancedGroupsCount; - GUI.skin = skin; + if (skin != null) + GUI.DoSetSkin(skin); //setting GUI.skin directly doesn't work at a depth of 0 GUIUtility.s_OriginalID = entityId; if (scrollViewStates != null) GUI.scrollViewStates = scrollViewStates; @@ -76,19 +83,23 @@ internal void ApplyAndForget() // UUM-145914: managed-only backup used by the native re-entrancy path (GUIView::OnInputEvent). [AutoStaticsCleanupOnCodeReload] // cleared on reload so no captured layout state survives a domain reload - static readonly Stack s_ReentrantLayoutStates = new Stack(); + static readonly Stack<(SavedGUIState guiState, SavedEditorGUIState editorState)> s_ReentrantLayoutStates = new(); internal static void PushReentrantLayoutState() { SavedGUIState state = new SavedGUIState(); state.CaptureManaged(); - s_ReentrantLayoutStates.Push(state); + s_ReentrantLayoutStates.Push((state, SavedEditorGUIState.Capture())); } internal static void PopReentrantLayoutState() { if (s_ReentrantLayoutStates.Count > 0) - s_ReentrantLayoutStates.Pop().ApplyManaged(); + { + var (guiState, editorState) = s_ReentrantLayoutStates.Pop(); + editorState.Apply(); + guiState.ApplyManaged(); + } } } } diff --git a/Editor/Mono/SceneHierarchy.cs b/Editor/Mono/SceneHierarchy.cs index 00e585df7c..e4f3f4efa1 100644 --- a/Editor/Mono/SceneHierarchy.cs +++ b/Editor/Mono/SceneHierarchy.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneHierarchy not yet converted using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.Scripting; @@ -36,13 +35,13 @@ static class Styles const string kWarningSymbol = "console.warnicon.sml"; const string kWarningMessage = "The current sorting method is taking a lot of time. Consider using 'Transform Sort' in playmode for better performance."; - public static readonly GUIContent defaultSortingContent = EditorGUIUtility.TrIconContent(kCustomSorting); - public static readonly GUIContent createContent = EditorGUIUtility.TrIconContent("Toolbar Plus More", "Create new GameObject"); + public static readonly GUIContent defaultSortingContent = L10n.IconContent(kCustomSorting, null, null); + public static readonly GUIContent createContent = L10n.IconContent("Toolbar Plus More", "Create new GameObject", null); public static readonly GUIContent fetchWarning = new GUIContent("", EditorGUIUtility.FindTexture(kWarningSymbol), kWarningMessage); public static readonly GUIStyle lockButton = "IN LockButton"; - public static readonly GUIContent renamingEnabledContent = EditorGUIUtility.TrTextContent("Rename New Objects"); + public static readonly GUIContent renamingEnabledContent = L10n.TextContent("Rename New Objects", null, null, null); public static readonly GUIContent setOriginLabel = new GUIContent("Set as Default Parent"); public static readonly GUIContent clearOriginLabel = new GUIContent("Clear Default Parent"); } @@ -1102,26 +1101,26 @@ void CreateSubSceneGameObjectContextClick(GenericMenu menu, EntityId contextClic // For Sub Scenes GameObjects, have menu items for cut, paste and delete. // Not copy or duplicate, since multiple of the same Sub Scene is not supported anyway. - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemCut), false, ClipboardUtility.CutGO); + menu.AddItem(L10n.TextContent(kContextMenuItemCut, null, null, null), false, ClipboardUtility.CutGO); if (CutBoard.CanGameObjectsBePasted() || Unsupported.CanPasteGameObjectsFromPasteboard()) - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemPaste), false, PasteGO); + menu.AddItem(L10n.TextContent(kContextMenuItemPaste, null, null, null), false, PasteGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemPaste)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemPaste, null, null, null)); if (ClipboardUtility.CanPasteAsChild()) { - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemPasteAsChildKeepLocalTransform), false, () => ClipboardUtility.PasteGOAsChild(false)); - menu.AddItem(EditorGUIUtility.TrTextContent("Paste as Child (Keep World Transform)"), false, () => ClipboardUtility.PasteGOAsChild(true)); + menu.AddItem(L10n.TextContent(kContextMenuItemPasteAsChildKeepLocalTransform, null, null, null), false, () => ClipboardUtility.PasteGOAsChild(false)); + menu.AddItem(L10n.TextContent("Paste as Child (Keep World Transform)", null, null, null), false, () => ClipboardUtility.PasteGOAsChild(true)); } else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Paste Special")); + menu.AddDisabledItem(L10n.TextContent("Paste Special", null, null, null)); menu.AddSeparator(""); if (IsChildOfSelectionOrSelected(m_CustomParentForNewGameObjects)) - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Delete GameObject")); + menu.AddDisabledItem(L10n.TextContent("Delete GameObject", null, null, null)); else - menu.AddItem(EditorGUIUtility.TrTextContent("Delete GameObject"), false, DeleteGO); + menu.AddItem(L10n.TextContent("Delete GameObject", null, null, null), false, DeleteGO); } void PopulateGenericMenuWithPrefabMenuItems(GenericMenu menu, EntityId contextClickedItemID) @@ -1150,18 +1149,18 @@ void PopulateGenericMenuWithPrefabMenuItems(GenericMenu menu, EntityId contextCl { if (PrefabUtility.IsPartOfModelPrefab(prefabAsset)) { - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Open Model"), false, () => + menu.AddItem(L10n.TextContent("Prefab/Open Model", null, null, null), false, () => { AssetDatabase.OpenAsset(prefabAsset); }); } else { - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Open Asset in Context"), false, () => + menu.AddItem(L10n.TextContent("Prefab/Open Asset in Context", null, null, null), false, () => { PrefabStageUtility.OpenPrefab(assetPath, go, PrefabStage.Mode.InContext, StageNavigationManager.Analytics.ChangeType.EnterViaInstanceHierarchyContextMenu); }); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Open Asset in Isolation"), false, () => + menu.AddItem(L10n.TextContent("Prefab/Open Asset in Isolation", null, null, null), false, () => { PrefabStageUtility.OpenPrefab(assetPath, go, PrefabStage.Mode.InIsolation, StageNavigationManager.Analytics.ChangeType.EnterViaInstanceHierarchyContextMenu); }); @@ -1171,7 +1170,7 @@ void PopulateGenericMenuWithPrefabMenuItems(GenericMenu menu, EntityId contextCl if (!string.IsNullOrEmpty(assetPath)) { menu.AddSeparator("Prefab/"); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Select Asset"), false, () => + menu.AddItem(L10n.TextContent("Prefab/Select Asset", null, null, null), false, () => { Selection.activeObject = prefabAsset; EditorGUIUtility.PingObject(prefabAsset.GetEntityId()); @@ -1180,14 +1179,14 @@ void PopulateGenericMenuWithPrefabMenuItems(GenericMenu menu, EntityId contextCl if (isSelectPrefabRootAvailable) { - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Select Root"), false, SelectPrefabRoot); + menu.AddItem(L10n.TextContent("Prefab/Select Root", null, null, null), false, SelectPrefabRoot); } GameObject sourceRoot = PrefabUtility.GetSourceRootWhereGameObjectIsAddedAsOverride(go); if (sourceRoot != null) { var s = PrefabUtility.GetOriginalSourceRootWhereGameObjectIsAdded(go); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Go to Added GameObject in '" + sourceRoot.name + "'"), false, () => + menu.AddItem(L10n.TextContent("Prefab/Go to Added GameObject in '" + sourceRoot.name + "'", null, null, null), false, () => { PrefabStageUtility.OpenPrefab(AssetDatabase.GetAssetPath(sourceRoot), PrefabUtility.GetNearestPrefabInstanceRoot(go), PrefabStage.Mode.InIsolation); }); @@ -1210,10 +1209,10 @@ void PopulateGenericMenuWithPrefabMenuItems(GenericMenu menu, EntityId contextCl if (PrefabUtility.AnyOutermostPrefabRoots(Selection.gameObjects)) { menu.AddSeparator("Prefab/"); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Unpack"), false, () => PrefabUtility.UnpackPrefab(Selection.gameObjects)); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Unpack Completely"), false, () => PrefabUtility.UnpackPrefabCompletely(Selection.gameObjects)); + menu.AddItem(L10n.TextContent("Prefab/Unpack", null, null, null), false, () => PrefabUtility.UnpackPrefab(Selection.gameObjects)); + menu.AddItem(L10n.TextContent("Prefab/Unpack Completely", null, null, null), false, () => PrefabUtility.UnpackPrefabCompletely(Selection.gameObjects)); menu.AddSeparator("Prefab/"); - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Remove Unused Overrides..."), false, () => PrefabUtility.RemoveSelectedPrefabInstanceUnusedOverrides(Selection.gameObjects)); + menu.AddItem(L10n.TextContent("Prefab/Remove Unused Overrides...", null, null, null), false, () => PrefabUtility.RemoveSelectedPrefabInstanceUnusedOverrides(Selection.gameObjects)); } } @@ -1226,69 +1225,69 @@ void CreateGameObjectContextClick(GenericMenu menu, EntityId contextClickedItemI || !IsChildOfSelectionOrSelected(m_CustomParentForNewGameObjects.parent); if (itemIsSelected && allowCutCopyAndDuplicate) - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemCut), false, ClipboardUtility.CutGO); + menu.AddItem(L10n.TextContent(kContextMenuItemCut, null, null, null), false, ClipboardUtility.CutGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemCut)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemCut, null, null, null)); if (itemIsSelected && allowCutCopyAndDuplicate) - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemCopy), false, ClipboardUtility.CopyGO); + menu.AddItem(L10n.TextContent(kContextMenuItemCopy, null, null, null), false, ClipboardUtility.CopyGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemCopy)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemCopy, null, null, null)); if (CutBoard.CanGameObjectsBePasted() || Unsupported.CanPasteGameObjectsFromPasteboard()) - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemPaste), false, PasteGO); + menu.AddItem(L10n.TextContent(kContextMenuItemPaste, null, null, null), false, PasteGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemPaste)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemPaste, null, null, null)); if (ClipboardUtility.CanPasteAsChild()) { - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemPasteAsChildKeepLocalTransform), false, () => ClipboardUtility.PasteGOAsChild(false)); - menu.AddItem(EditorGUIUtility.TrTextContent("Paste Special/Paste as Child (Keep World Transform)"), false, () => ClipboardUtility.PasteGOAsChild(true)); + menu.AddItem(L10n.TextContent(kContextMenuItemPasteAsChildKeepLocalTransform, null, null, null), false, () => ClipboardUtility.PasteGOAsChild(false)); + menu.AddItem(L10n.TextContent("Paste Special/Paste as Child (Keep World Transform)", null, null, null), false, () => ClipboardUtility.PasteGOAsChild(true)); } else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Paste Special")); + menu.AddDisabledItem(L10n.TextContent("Paste Special", null, null, null)); if (itemIsSelected && !hasSearchFilter && m_TreeViewState.selectedIDs.Count == 1 && !GetIsNotEditable()) - menu.AddItem(EditorGUIUtility.TrTextContent("Rename"), false, RenameGO); + menu.AddItem(L10n.TextContent("Rename", null, null, null), false, RenameGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Rename")); + menu.AddDisabledItem(L10n.TextContent("Rename", null, null, null)); if (itemIsSelected && allowCutCopyAndDuplicate) - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemDuplicate), false, DuplicateGO); + menu.AddItem(L10n.TextContent(kContextMenuItemDuplicate, null, null, null), false, DuplicateGO); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemDuplicate)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemDuplicate, null, null, null)); if (m_CustomParentForNewGameObjects != null && IsChildOfSelectionOrSelected(m_CustomParentForNewGameObjects) || !itemIsSelected) - menu.AddDisabledItem(EditorGUIUtility.TrTextContent(kContextMenuItemDelete)); + menu.AddDisabledItem(L10n.TextContent(kContextMenuItemDelete, null, null, null)); else - menu.AddItem(EditorGUIUtility.TrTextContent(kContextMenuItemDelete), false, DeleteGO); + menu.AddItem(L10n.TextContent(kContextMenuItemDelete, null, null, null), false, DeleteGO); menu.AddSeparator(""); - menu.AddItem(EditorGUIUtility.TrTextContent("Select All"), false, SelectAll); + menu.AddItem(L10n.TextContent("Select All", null, null, null), false, SelectAll); if (itemIsSelected) { - menu.AddItem(EditorGUIUtility.TrTextContent("Deselect All"), false, DeselectAll); - menu.AddItem(EditorGUIUtility.TrTextContent("Invert Selection"), false, InvertSelection); + menu.AddItem(L10n.TextContent("Deselect All", null, null, null), false, DeselectAll); + menu.AddItem(L10n.TextContent("Invert Selection", null, null, null), false, InvertSelection); } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Deselect All")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Invert Selection")); + menu.AddDisabledItem(L10n.TextContent("Deselect All", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Invert Selection", null, null, null)); } if (IsSelectChildrenAvailable()) - menu.AddItem(EditorGUIUtility.TrTextContent("Select Children"), false, SelectChildren); + menu.AddItem(L10n.TextContent("Select Children", null, null, null), false, SelectChildren); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Select Children")); + menu.AddDisabledItem(L10n.TextContent("Select Children", null, null, null)); menu.AddSeparator(""); if (Selection.activeGameObject) { - menu.AddItem(EditorGUIUtility.TrTextContent("Find References in Scene"), false, FindReferenceInScene); + menu.AddItem(L10n.TextContent("Find References in Scene", null, null, null), false, FindReferenceInScene); } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Find References in Scene")); + menu.AddDisabledItem(L10n.TextContent("Find References in Scene", null, null, null)); } menu.AddSeparator(""); @@ -1427,7 +1426,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) // Set active if (scene.isLoaded) { - var content = EditorGUIUtility.TrTextContent("Set Active Scene"); + var content = L10n.TextContent("Set Active Scene", null, null, null); if (hasMultipleScenes && SceneManager.CanSetAsActiveScene(scene)) menu.AddItem(content, false, SetSceneActive, scene); else @@ -1440,19 +1439,19 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) { if (!EditorApplication.isPlaying || EditorSceneManager.IsAuthoringScene(scene)) { - menu.AddItem(EditorGUIUtility.TrTextContent("Save Scene"), false, SaveSelectedScenes, scene); + menu.AddItem(L10n.TextContent("Save Scene", null, null, null), false, SaveSelectedScenes, scene); if (!scene.isSubScene) - menu.AddItem(EditorGUIUtility.TrTextContent("Save Scene As"), false, SaveSceneAs, scene); + menu.AddItem(L10n.TextContent("Save Scene As", null, null, null), false, SaveSceneAs, scene); if (hasMultipleScenes) - menu.AddItem(EditorGUIUtility.TrTextContent("Save All"), false, SaveAllScenes, scene); + menu.AddItem(L10n.TextContent("Save All", null, null, null), false, SaveAllScenes, scene); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Save All")); + menu.AddDisabledItem(L10n.TextContent("Save All", null, null, null)); } else { - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Save Scene")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Save Scene As")); - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Save All")); + menu.AddDisabledItem(L10n.TextContent("Save Scene", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Save Scene As", null, null, null)); + menu.AddDisabledItem(L10n.TextContent("Save All", null, null, null)); } menu.AddSeparator(""); } @@ -1464,7 +1463,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) if (scene.isLoaded) { // Unload - var content = EditorGUIUtility.TrTextContent("Unload Scene"); + var content = L10n.TextContent("Unload Scene", null, null, null); bool canUnloadScenes = isUnloadOrRemoveValid && !EditorApplication.isPlaying && !string.IsNullOrEmpty(scene.path); if (canUnloadScenes) menu.AddItem(content, false, UnloadSelectedScenes, scene); @@ -1474,7 +1473,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) else { // Load - var content = EditorGUIUtility.TrTextContent("Load Scene"); + var content = L10n.TextContent("Load Scene", null, null, null); bool canLoadScenes = !EditorApplication.isPlaying; if (canLoadScenes) menu.AddItem(content, false, LoadSelectedScenes, scene); @@ -1483,7 +1482,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) } // Remove - var removeContent = EditorGUIUtility.TrTextContent("Remove Scene"); + var removeContent = L10n.TextContent("Remove Scene", null, null, null); bool selectedAllScenes = GetSelectedScenes().Count == EditorSceneManager.sceneCount; bool canRemoveScenes = isUnloadOrRemoveValid && !selectedAllScenes && !EditorApplication.isPlaying; if (canRemoveScenes) @@ -1495,7 +1494,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) // Discard changes if (scene.isLoaded) { - var content = EditorGUIUtility.TrTextContent("Discard changes"); + var content = L10n.TextContent("Discard changes", null, null, null); var selectedSceneHandles = GetSelectedScenes(); var modifiedScenes = GetModifiedScenes(selectedSceneHandles); bool canReload = modifiedScenes.Length > 0 && CanScenesBeReloaded(modifiedScenes); @@ -1508,7 +1507,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) // Ping Scene Asset menu.AddSeparator(""); - var selectAssetContent = EditorGUIUtility.TrTextContent("Find In Project"); + var selectAssetContent = L10n.TextContent("Find In Project", null, null, null); if (!string.IsNullOrEmpty(scene.path)) menu.AddItem(selectAssetContent, false, SelectSceneAsset, scene); else @@ -1516,7 +1515,7 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) if (!scene.isSubScene) { - var addSceneContent = EditorGUIUtility.TrTextContent("Add New Scene"); + var addSceneContent = L10n.TextContent("Add New Scene", null, null, null); if (!EditorApplication.isPlaying) menu.AddItem(addSceneContent, false, AddNewScene, scene); else @@ -1525,9 +1524,9 @@ internal void CreateSceneHeaderContextClick(GenericMenu menu, Scene scene) menu.AddSeparator(""); if(scene.isLoaded) - menu.AddItem(EditorGUIUtility.TrTextContent("Prefab/Remove Unused Overrides..."), false, PrefabUtility.RemoveAllPrefabInstancesUnusedOverridesFromSceneForMenuItem, scene); + menu.AddItem(L10n.TextContent("Prefab/Remove Unused Overrides...", null, null, null), false, PrefabUtility.RemoveAllPrefabInstancesUnusedOverridesFromSceneForMenuItem, scene); else - menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Prefab/Remove Unused Overrides...")); + menu.AddDisabledItem(L10n.TextContent("Prefab/Remove Unused Overrides...", null, null, null)); // Set the context of each MenuItem to the current selection, so the created gameobjects will be added as children // Sets includeCreateEmptyChild to false, since that item is superfluous here (the normal "Create Empty" is added as a child anyway) @@ -1909,8 +1908,8 @@ internal static void AddNewScene(object userData) Scene untitledScene = EditorSceneManager.GetSceneByPath(""); if (untitledScene.IsValid()) { - var title = EditorGUIUtility.TrTextContent("Save Untitled Scene").text; - var subTitle = EditorGUIUtility.TrTextContent("Existing Untitled scene needs to be saved before creating a new scene. Only one untitled scene is supported at a time.").text; + var title = L10n.TextContent("Save Untitled Scene", null, null, null).text; + var subTitle = L10n.TextContent("Existing Untitled scene needs to be saved before creating a new scene. Only one untitled scene is supported at a time.", null, null, null).text; if (EditorUtility.DisplayDialog(title, subTitle, "Save", "Cancel")) { if (!EditorSceneManager.SaveScene(untitledScene)) @@ -2079,7 +2078,7 @@ public void ExpandAll() public virtual void AddItemsToWindowMenu(GenericMenu menu) { - menu.AddItem(EditorGUIUtility.TrTextContent("Collapse All"), false, CollapseAll); + menu.AddItem(L10n.TextContent("Collapse All", null, null, null), false, CollapseAll); menu.AddSeparator(""); m_LockTracker.AddItemsToMenu(menu); @@ -2210,4 +2209,3 @@ public static void AddGameObjectNames(GameObject target, List list) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneHierarchySortingWindow.cs b/Editor/Mono/SceneHierarchySortingWindow.cs index e1f01ca02d..08b89ae81a 100644 --- a/Editor/Mono/SceneHierarchySortingWindow.cs +++ b/Editor/Mono/SceneHierarchySortingWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneHierarchy not yet converted using System; using System.Collections.Generic; using UnityEngine; @@ -12,10 +11,6 @@ namespace UnityEditor { internal partial class SceneHierarchySortingWindow : EditorWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public SceneHierarchySortingWindow() {} - #pragma warning restore UAL0015 - public delegate void OnSelectCallback(InputData element); private class Styles @@ -157,4 +152,3 @@ void DrawListElement(Rect rect, InputData data) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneHierarchyWindow.cs b/Editor/Mono/SceneHierarchyWindow.cs index c2d6afc51b..3871bfec41 100644 --- a/Editor/Mono/SceneHierarchyWindow.cs +++ b/Editor/Mono/SceneHierarchyWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneHierarchy not yet converted using System.Collections.Generic; using UnityEditor.SceneManagement; using UnityEngine; @@ -15,10 +14,6 @@ namespace UnityEditor [EditorWindowTitle(title = "Hierarchy", useTypeNameAsIconName = true)] internal partial class SceneHierarchyWindow : SearchableEditorWindow, IHasCustomMenu, IPropertySourceOpener, IFramableContainer, IHierarchyWindow { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced - public SceneHierarchyWindow() {} - #pragma warning restore UAL0015 - public static SceneHierarchyWindow lastInteractedHierarchyWindow => s_LastInteractedHierarchy; IHierarchyWindow IHierarchyWindow.LastInteractedHierarchyWindow => s_LastInteractedHierarchy; [AutoStaticsCleanupOnCodeReload] @@ -420,4 +415,3 @@ internal class AlphabeticalSorting : HierarchySorting public override GUIContent content { get { return m_Content; } } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneManagement/EditorSceneManager.cs b/Editor/Mono/SceneManagement/EditorSceneManager.cs index dd6e35b43d..f589232789 100644 --- a/Editor/Mono/SceneManagement/EditorSceneManager.cs +++ b/Editor/Mono/SceneManagement/EditorSceneManager.cs @@ -52,6 +52,9 @@ public static event SceneOpenedCallback sceneOpened remove => m_SceneOpenedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload(CleanupStrategy = CleanupStrategy.Clear)] + // Backing store for the sceneOpened event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_SceneOpenedEvent = new EventWithPerformanceTracker($"{nameof(EditorSceneManager)}.{nameof(sceneOpened)}"); public static event SceneClosingCallback sceneClosing @@ -68,6 +71,9 @@ public static event SceneClosedCallback sceneClosed remove => m_SceneClosedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload(CleanupStrategy = CleanupStrategy.Clear)] + // Backing store for the sceneClosed event: subscribers attach through their own lifecycle and + // re-subscribe after a code reload, so the cleared store refills itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_SceneClosedEvent = new EventWithPerformanceTracker($"{nameof(EditorSceneManager)}.{nameof(sceneClosed)}"); public static event SceneSavingCallback sceneSaving { @@ -82,6 +88,10 @@ public static event SceneSavedCallback sceneSaved remove => m_SceneSavedEvent.Remove(value); } [AutoStaticsCleanupOnCodeReload(CleanupStrategy = CleanupStrategy.Clear)] + // Backing store for the sceneSaved event: subscribers attach through their own lifecycle - scene + // visibility, the hierarchy handlers, the scene template service - so the cleared store refills + // itself. + [IgnoreForUAL0015("Event backing store whose subscribers re-register through their own lifecycle")] private static EventWithPerformanceTracker m_SceneSavedEvent = new EventWithPerformanceTracker($"{nameof(EditorSceneManager)}.{nameof(sceneSaved)}"); public static event SceneDirtiedCallback sceneDirtied { diff --git a/Editor/Mono/SceneManagement/StageManager/PrefabStage/PrefabStage.cs b/Editor/Mono/SceneManagement/StageManager/PrefabStage/PrefabStage.cs index fa4daf60fe..976fb2411c 100644 --- a/Editor/Mono/SceneManagement/StageManager/PrefabStage/PrefabStage.cs +++ b/Editor/Mono/SceneManagement/StageManager/PrefabStage/PrefabStage.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneManagement not yet converted using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -23,21 +22,21 @@ public sealed partial class PrefabStage : PreviewSceneStage { static class Styles { - public static readonly GUIContent autoSaveGUIContent = EditorGUIUtility.TrTextContent("Auto Save", "When Auto Save is enabled, every change you make is automatically saved to the Prefab Asset. Disable Auto Save if you experience long import times."); - public static readonly GUIContent saveButtonContent = EditorGUIUtility.TrTextContent("Save"); - public static readonly GUIContent checkoutButtonContent = EditorGUIUtility.TrTextContent("Check Out"); - public static readonly GUIContent autoSavingBadgeContent = EditorGUIUtility.TrTextContent("Auto Saving..."); - public static readonly GUIContent immutablePrefabContent = EditorGUIUtility.TrTextContent("Immutable Prefab"); + public static readonly GUIContent autoSaveGUIContent = L10n.TextContent("Auto Save", "When Auto Save is enabled, every change you make is automatically saved to the Prefab Asset. Disable Auto Save if you experience long import times.", null, null); + public static readonly GUIContent saveButtonContent = L10n.TextContent("Save", null, null, null); + public static readonly GUIContent checkoutButtonContent = L10n.TextContent("Check Out", null, null, null); + public static readonly GUIContent autoSavingBadgeContent = L10n.TextContent("Auto Saving...", null, null, null); + public static readonly GUIContent immutablePrefabContent = L10n.TextContent("Immutable Prefab", null, null, null); public static readonly GUIStyle saveToggle; public static readonly GUIStyle button; public static readonly GUIStyle savingBadge = "Badge"; public static readonly GUIStyle exposablePopup = "ExposablePopupMenu"; public static readonly GUIStyle exposablePopupItem = "ExposablePopupItem"; - public static readonly GUIContent contextLabel = EditorGUIUtility.TrTextContent("Context:"); - public static readonly GUIContent[] contextRenderModeTexts = new[] { EditorGUIUtility.TrTextContent("Normal"), EditorGUIUtility.TrTextContent("Gray"), EditorGUIUtility.TrTextContent("Hidden") }; + public static readonly GUIContent contextLabel = L10n.TextContent("Context:", null, null, null); + public static readonly GUIContent[] contextRenderModeTexts = new[] { L10n.TextContent("Normal", null, null, null), L10n.TextContent("Gray", null, null, null), L10n.TextContent("Hidden", null, null, null) }; public static readonly StageUtility.ContextRenderMode[] contextRenderModeOptions = new[] { StageUtility.ContextRenderMode.Normal, StageUtility.ContextRenderMode.GreyedOut, StageUtility.ContextRenderMode.Hidden }; - public static readonly GUIContent showOverridesLabel = EditorGUIUtility.TrTextContent("Show Overrides", "Visualize property overrides from the Prefab instance on the Prefab Asset. Overrides on the root Transform are always visualized."); - public static readonly GUIContent showOverridesLabelWithTooManyOverridesTooltip = EditorGUIUtility.TrTextContent("Show Overrides", "Show Overrides are disabled because there are too many overrides to visualize. Overrides on the root Transform are always visualized though."); + public static readonly GUIContent showOverridesLabel = L10n.TextContent("Show Overrides", "Visualize property overrides from the Prefab instance on the Prefab Asset. Overrides on the root Transform are always visualized.", null, null); + public static readonly GUIContent showOverridesLabelWithTooManyOverridesTooltip = L10n.TextContent("Show Overrides", "Show Overrides are disabled because there are too many overrides to visualize. Overrides on the root Transform are always visualized though.", null, null); static Styles() { @@ -57,8 +56,14 @@ public enum Mode } [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static event Action prefabStageOpened; [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static event Action prefabStageClosing; [AutoStaticsCleanupOnCodeReload] public static event Action prefabStageDirtied; @@ -2240,4 +2245,3 @@ static bool OnOpenAsset(EntityId entityId, int line) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneManagement/StageManager/Stage.cs b/Editor/Mono/SceneManagement/StageManager/Stage.cs index f628df47dd..885b26234d 100644 --- a/Editor/Mono/SceneManagement/StageManager/Stage.cs +++ b/Editor/Mono/SceneManagement/StageManager/Stage.cs @@ -98,8 +98,8 @@ internal virtual void BuildContextMenuForStageHeader(GenericMenu menu) { if (SupportsSaving()) { - var saveText = EditorGUIUtility.TrTextContent("Save"); - var discardText = EditorGUIUtility.TrTextContent("Discard changes"); + var saveText = L10n.TextContent("Save", null, null, null); + var discardText = L10n.TextContent("Discard changes", null, null, null); // Save if (hasUnsavedChanges) diff --git a/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs b/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs index 553f4a2462..69a055ac26 100644 --- a/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs +++ b/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using UnityEngine; using System.Linq; using UnityEngine.Rendering; @@ -17,50 +16,50 @@ public class DefaultLightingExplorerExtension : ILightingExplorerExtension { private static class Styles { - public static readonly GUIContent[] ProjectionStrings = { EditorGUIUtility.TrTextContent("Infinite"), EditorGUIUtility.TrTextContent("Box") }; + public static readonly GUIContent[] ProjectionStrings = { L10n.TextContent("Infinite", null, null, null), L10n.TextContent("Box", null, null, null) }; // The two arrays below needs to match public static readonly string[] EmissionOptions = { L10n.Tr("Realtime", null), L10n.Tr("Baked", null) }; public static readonly MaterialGlobalIlluminationFlags[] EmissionOptionsInternal = { MaterialGlobalIlluminationFlags.RealtimeIndirectEmission, MaterialGlobalIlluminationFlags.BakedEmission }; - public static readonly GUIContent Name = EditorGUIUtility.TrTextContent("Name"); - public static readonly GUIContent Enabled = EditorGUIUtility.TrTextContent("Enabled"); - public static readonly GUIContent Type = EditorGUIUtility.TrTextContent("Type"); - public static readonly GUIContent Shape = EditorGUIUtility.TrTextContent("Shape"); - public static readonly GUIContent Mode = EditorGUIUtility.TrTextContent("Mode"); - public static readonly GUIContent Color = EditorGUIUtility.TrTextContent("Color"); - public static readonly GUIContent Range = EditorGUIUtility.TrTextContent("Range"); - public static readonly GUIContent Intensity = EditorGUIUtility.TrTextContent("Intensity"); - public static readonly GUIContent IndirectMultiplier = EditorGUIUtility.TrTextContent("Indirect Multiplier"); - public static readonly GUIContent ShadowType = EditorGUIUtility.TrTextContent("Shadows"); - public static readonly GUIContent Projection = EditorGUIUtility.TrTextContent("Projection"); - public static readonly GUIContent HDR = EditorGUIUtility.TrTextContent("HDR"); - public static readonly GUIContent ShadowDistance = EditorGUIUtility.TrTextContent("Shadow Distance"); - public static readonly GUIContent NearPlane = EditorGUIUtility.TrTextContent("Near Plane"); - public static readonly GUIContent FarPlane = EditorGUIUtility.TrTextContent("Far Plane"); - public static readonly GUIContent GlobalIllumination = EditorGUIUtility.TrTextContent("Global Illumination"); + public static readonly GUIContent Name = L10n.TextContent("Name", null, null, null); + public static readonly GUIContent Enabled = L10n.TextContent("Enabled", null, null, null); + public static readonly GUIContent Type = L10n.TextContent("Type", null, null, null); + public static readonly GUIContent Shape = L10n.TextContent("Shape", null, null, null); + public static readonly GUIContent Mode = L10n.TextContent("Mode", null, null, null); + public static readonly GUIContent Color = L10n.TextContent("Color", null, null, null); + public static readonly GUIContent Range = L10n.TextContent("Range", null, null, null); + public static readonly GUIContent Intensity = L10n.TextContent("Intensity", null, null, null); + public static readonly GUIContent IndirectMultiplier = L10n.TextContent("Indirect Multiplier", null, null, null); + public static readonly GUIContent ShadowType = L10n.TextContent("Shadows", null, null, null); + public static readonly GUIContent Projection = L10n.TextContent("Projection", null, null, null); + public static readonly GUIContent HDR = L10n.TextContent("HDR", null, null, null); + public static readonly GUIContent ShadowDistance = L10n.TextContent("Shadow Distance", null, null, null); + public static readonly GUIContent NearPlane = L10n.TextContent("Near Plane", null, null, null); + public static readonly GUIContent FarPlane = L10n.TextContent("Far Plane", null, null, null); + public static readonly GUIContent GlobalIllumination = L10n.TextContent("Global Illumination", null, null, null); public static readonly GUIContent SelectObjects = EditorGUIUtility.TextContent(""); - public static readonly GUIContent SelectObjectsButton = EditorGUIUtility.TrTextContentWithIcon("", "Find References in Scene", "UnityEditor.FindDependencies"); - - public static readonly GUIContent LightCookieSprite = EditorGUIUtility.TrTextContent("Sprite"); - public static readonly GUIContent FallOff = EditorGUIUtility.TrTextContent("Falloff"); - public static readonly GUIContent FallOffStrength = EditorGUIUtility.TrTextContent("Falloff Strength"); - public static readonly GUIContent TargetSortingLayer = EditorGUIUtility.TrTextContent("Target Sorting Layer"); - public static readonly GUIContent All = EditorGUIUtility.TrTextContent("All"); - public static readonly GUIContent None = EditorGUIUtility.TrTextContent("None"); - public static readonly GUIContent Mixed = EditorGUIUtility.TrTextContent("Mixed..."); - public static readonly GUIContent ShadowIntensityEnabled = EditorGUIUtility.TrTextContent("Shadow"); - public static readonly GUIContent ShadowIntensity = EditorGUIUtility.TrTextContent("Shadow Strength"); - public static readonly GUIContent Light2DParametric = EditorGUIUtility.TrTextContentWithIcon("Parametric", "Parametric Lights have been deprecated. To continue, upgrade your Parametric Lights to Freeform Lights to enjoy similar light functionality.", MessageType.Warning); - - public static readonly GUIContent[] LightmapBakeTypeTitles = { EditorGUIUtility.TrTextContent("Realtime"), EditorGUIUtility.TrTextContent("Mixed"), EditorGUIUtility.TrTextContent("Baked") }; + public static readonly GUIContent SelectObjectsButton = L10n.TextContentWithIcon("", "Find References in Scene", "UnityEditor.FindDependencies", null); + + public static readonly GUIContent LightCookieSprite = L10n.TextContent("Sprite", null, null, null); + public static readonly GUIContent FallOff = L10n.TextContent("Falloff", null, null, null); + public static readonly GUIContent FallOffStrength = L10n.TextContent("Falloff Strength", null, null, null); + public static readonly GUIContent TargetSortingLayer = L10n.TextContent("Target Sorting Layer", null, null, null); + public static readonly GUIContent All = L10n.TextContent("All", null, null, null); + public static readonly GUIContent None = L10n.TextContent("None", null, null, null); + public static readonly GUIContent Mixed = L10n.TextContent("Mixed...", null, null, null); + public static readonly GUIContent ShadowIntensityEnabled = L10n.TextContent("Shadow", null, null, null); + public static readonly GUIContent ShadowIntensity = L10n.TextContent("Shadow Strength", null, null, null); + public static readonly GUIContent Light2DParametric = L10n.TextContentWithIcon("Parametric", "Parametric Lights have been deprecated. To continue, upgrade your Parametric Lights to Freeform Lights to enjoy similar light functionality.", MessageType.Warning, null); + + public static readonly GUIContent[] LightmapBakeTypeTitles = { L10n.TextContent("Realtime", null, null, null), L10n.TextContent("Mixed", null, null, null), L10n.TextContent("Baked", null, null, null) }; public static readonly int[] LightmapBakeTypeValues = { (int)LightmapBakeType.Realtime, (int)LightmapBakeType.Mixed, (int)LightmapBakeType.Baked }; - public static readonly GUIContent[] LightTypeTitles = { EditorGUIUtility.TrTextContent("Spot"), EditorGUIUtility.TrTextContent("Directional"), EditorGUIUtility.TrTextContent("Point"), EditorGUIUtility.TrTextContent("Area (baked only)") }; + public static readonly GUIContent[] LightTypeTitles = { L10n.TextContent("Spot", null, null, null), L10n.TextContent("Directional", null, null, null), L10n.TextContent("Point", null, null, null), L10n.TextContent("Area (baked only)", null, null, null) }; public static readonly int[] LightTypeValues = { (int)LightType.Spot, (int)LightType.Directional, (int)LightType.Point, (int)LightType.Rectangle }; - public static readonly GUIContent[] LightShapeTitles = { EditorGUIUtility.TrTextContent("Rectangle"), EditorGUIUtility.TrTextContent("Disc") }; + public static readonly GUIContent[] LightShapeTitles = { L10n.TextContent("Rectangle", null, null, null), L10n.TextContent("Disc", null, null, null) }; public static readonly int[] LightShapeValues = { (int)LightType.Rectangle, (int)LightType.Disc }; - public static readonly GUIContent[] Light2DTypeTitles = { EditorGUIUtility.TrTextContent("Freeform"), EditorGUIUtility.TrTextContent("Sprite"), EditorGUIUtility.TrTextContent("Spot"), EditorGUIUtility.TrTextContent("Global") }; + public static readonly GUIContent[] Light2DTypeTitles = { L10n.TextContent("Freeform", null, null, null), L10n.TextContent("Sprite", null, null, null), L10n.TextContent("Spot", null, null, null), L10n.TextContent("Global", null, null, null) }; #pragma warning disable UAC2001 // Avoid Linq public static readonly int[] Light2DTypeValues = Enumerable.Range(0, Light2DTypeTitles.Length).ToArray(); #pragma warning restore UAC2001 @@ -460,7 +459,7 @@ protected internal virtual UnityEngine.Object[] GetEmissives() return GetObjectsForLightingExplorer().Where((MeshRenderer mr) => #pragma warning restore UAC2001 { - return GameObjectUtility.AreStaticEditorFlagsSet(mr.gameObject, StaticEditorFlags.ContributeGI); + return GameObjectUtility.AnyStaticEditorFlagsSet(mr.gameObject, StaticEditorFlags.ContributeGI); }).SelectMany(meshRenderer => meshRenderer.sharedMaterials).Where((Material m) => { @@ -619,4 +618,3 @@ protected void SearchForReferences(SerializedProperty prop){ } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneModeWindows/LightingExplorerTab.cs b/Editor/Mono/SceneModeWindows/LightingExplorerTab.cs index 7b4209501c..e111c84076 100644 --- a/Editor/Mono/SceneModeWindows/LightingExplorerTab.cs +++ b/Editor/Mono/SceneModeWindows/LightingExplorerTab.cs @@ -38,7 +38,7 @@ public LightingExplorerTab(string title, Func objects, Fun m_LightTable = new SerializedPropertyTable(serializationUID, new SerializedPropertyDataStore.GatherDelegate(objects), () => { return Array.ConvertAll(columns(), item => item.internalColumn); }, showFilterGUI); - m_Title = EditorGUIUtility.TrTextContent(title); + m_Title = L10n.TextContent(title, null, null, null); } internal void OnDisable() diff --git a/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs b/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs index db43506252..df51aab69f 100644 --- a/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs +++ b/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using UnityEngine; using UnityEngine.Rendering; using UnityEditor.Rendering; @@ -173,7 +172,9 @@ private void UpdateTabs() OnDisableTabsAndExtension(); +#pragma warning disable UAL0018 // the extension is held by this window, which is recreated on code reload, and UpdateTabs re-resolves it on the next enable m_CurrentLightingExplorerExtension = GetLightExplorerExtension(SRPType); +#pragma warning restore UAL0018 m_CurrentLightingExplorerExtension.OnEnable(); m_SelectedTab = EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D ? /* 2D Lights */ 1 : /* Lights */ 0; @@ -208,4 +209,3 @@ ILightingExplorerExtension GetLightExplorerExtension(Type currentSRPType) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneModeWindows/LightingWindow.cs b/Editor/Mono/SceneModeWindows/LightingWindow.cs index 8c83fd9218..cab10111de 100644 --- a/Editor/Mono/SceneModeWindows/LightingWindow.cs +++ b/Editor/Mono/SceneModeWindows/LightingWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using System; using System.Collections.Generic; using UnityEngine; @@ -24,41 +23,41 @@ static class Styles { public static readonly GUIContent[] modeStrings = { - EditorGUIUtility.TrTextContent("Scene"), - EditorGUIUtility.TrTextContent("Environment"), - EditorGUIUtility.TrTextContent("Realtime Lightmaps"), - EditorGUIUtility.TrTextContent("Baked Lightmaps") + L10n.TextContent("Scene", null, null, null), + L10n.TextContent("Environment", null, null, null), + L10n.TextContent("Realtime Lightmaps", null, null, null), + L10n.TextContent("Baked Lightmaps", null, null, null) }; public static readonly GUIStyle labelStyle = EditorStyles.wordWrappedMiniLabel; public static readonly GUIStyle buttonStyle = "LargeButton"; - public static readonly GUIContent continuousBakeLabel = EditorGUIUtility.TrTextContent("Auto Generate", "Generate lighting data in the Scene when there are changes that affect Scene lighting, such as modifications to lights, materials, or geometry. This option is only available when there is a Lighting Settings Asset assigned in the Lighting Window."); - public static readonly GUIContent bakeLabel = EditorGUIUtility.TrTextContent("Generate Lighting", "Generates the lightmap data for the current active scene. This lightmap data (for realtime and baked global illumination) is stored in the GI Cache. For GI Cache settings see the Preferences panel."); - public static readonly GUIContent bakeLabelAnythingCompiling = EditorGUIUtility.TrTextContent("Generate Lighting", "Generate Lighting is currently unavailable. Waiting for asynchronous shader compilation."); - public static readonly GUIContent cancelLabel = EditorGUIUtility.TrTextContent("Cancel"); - public static readonly GUIContent ImageconversionModuleDisabledMessage = EditorGUIUtility.TrTextContentWithIcon("Generate Lighting is unavailable without the Image Conversion Module.", MessageType.Warning); + public static readonly GUIContent continuousBakeLabel = L10n.TextContent("Auto Generate", "Generate lighting data in the Scene when there are changes that affect Scene lighting, such as modifications to lights, materials, or geometry. This option is only available when there is a Lighting Settings Asset assigned in the Lighting Window.", null, null); + public static readonly GUIContent bakeLabel = L10n.TextContent("Generate Lighting", "Generates the lightmap data for the current active scene. This lightmap data (for realtime and baked global illumination) is stored in the GI Cache. For GI Cache settings see the Preferences panel.", null, null); + public static readonly GUIContent bakeLabelAnythingCompiling = L10n.TextContent("Generate Lighting", "Generate Lighting is currently unavailable. Waiting for asynchronous shader compilation.", null, null); + public static readonly GUIContent cancelLabel = L10n.TextContent("Cancel", null, null, null); + public static readonly GUIContent ImageconversionModuleDisabledMessage = L10n.TextContentWithIcon("Generate Lighting is unavailable without the Image Conversion Module.", MessageType.Warning, null); public static readonly string unityComputeLightBakerInfoBoxText = L10n.Tr("The Unity Compute Light Baker samples the environment and emissive surfaces with the direct sample count. To improve quality increase the number of Direct Samples. To reduce bake time, set GPU Baking Profile to Highest Performance.", null); - public static readonly GUIContent dontShowAgain = EditorGUIUtility.TrTextContent("Don't show again"); + public static readonly GUIContent dontShowAgain = L10n.TextContent("Don't show again", null, null, null); - public static readonly GUIContent progressiveGPUBakingDevice = EditorGUIUtility.TrTextContent("GPU Baking Device", "Will list all available GPU devices."); - public static readonly GUIContent progressiveGPUUnknownDeviceInfo = EditorGUIUtility.TrTextContent("No devices found. Please start an initial bake to make this information available."); - public static readonly GUIContent progressiveGPUChangeWarning = EditorGUIUtility.TrTextContent("Changing the compute device used by the Progressive GPU Lightmapper requires the editor to be relaunched. Do you want to change device and restart?"); - public static readonly GUIContent gpuBakingProfile = EditorGUIUtility.TrTextContent("GPU Baking Profile", "The profile chosen for trading off between performance and memory usage when baking using the GPU."); + public static readonly GUIContent progressiveGPUBakingDevice = L10n.TextContent("GPU Baking Device", "Will list all available GPU devices.", null, null); + public static readonly GUIContent progressiveGPUUnknownDeviceInfo = L10n.TextContent("No devices found. Please start an initial bake to make this information available.", null, null, null); + public static readonly GUIContent progressiveGPUChangeWarning = L10n.TextContent("Changing the compute device used by the Progressive GPU Lightmapper requires the editor to be relaunched. Do you want to change device and restart?", null, null, null); + public static readonly GUIContent gpuBakingProfile = L10n.TextContent("GPU Baking Profile", "The profile chosen for trading off between performance and memory usage when baking using the GPU.", null, null); - public static readonly GUIContent bakeOnSceneLoad = EditorGUIUtility.TrTextContent("Bake On Scene Load", "Whether to automatically generate lighting for Scenes that do not have valid lighting data when first opened."); + public static readonly GUIContent bakeOnSceneLoad = L10n.TextContent("Bake On Scene Load", "Whether to automatically generate lighting for Scenes that do not have valid lighting data when first opened.", null, null); - public static readonly GUIContent invalidEnvironmentLabel = EditorGUIUtility.TrTextContentWithIcon("Baked environment lighting does not match the current Scene state. Generate Lighting to update this.", MessageType.Warning); - public static readonly GUIContent unsupportedDenoisersLabel = EditorGUIUtility.TrTextContentWithIcon("Unsupported denoiser selected", MessageType.Error); - public static readonly GUIContent cannotBakeRosettaNotInstalledLabel = EditorGUIUtility.TrTextContentWithIcon("The lighting features this Scene uses require Apple Rosetta 2, which is not installed. Use a lightmapper that runs natively instead: set Default Light Baker to Unity Compute in Project Settings > Graphics.", MessageType.Error); + public static readonly GUIContent invalidEnvironmentLabel = L10n.TextContentWithIcon("Baked environment lighting does not match the current Scene state. Generate Lighting to update this.", MessageType.Warning, null); + public static readonly GUIContent unsupportedDenoisersLabel = L10n.TextContentWithIcon("Unsupported denoiser selected", MessageType.Error, null); + public static readonly GUIContent cannotBakeRosettaNotInstalledLabel = L10n.TextContentWithIcon("The lighting features this Scene uses require Apple Rosetta 2, which is not installed. Use a lightmapper that runs natively instead: set Default Light Baker to Unity Compute in Project Settings > Graphics.", MessageType.Error, null); - public static readonly GUIContent GPUUseHardwareRayTracing = EditorGUIUtility.TrTextContent("Hardware Ray Tracing", "Use hardware ray tracing if the GPU device supports it."); - public static readonly GUIContent GPUUseHardwareRayTracingNotSupported = EditorGUIUtility.TrTextContent("Hardware Ray Tracing", "Hardware ray tracing is not supported by the GPU device."); + public static readonly GUIContent GPUUseHardwareRayTracing = L10n.TextContent("Hardware Ray Tracing", "Use hardware ray tracing if the GPU device supports it.", null, null); + public static readonly GUIContent GPUUseHardwareRayTracingNotSupported = L10n.TextContent("Hardware Ray Tracing", "Hardware ray tracing is not supported by the GPU device.", null, null); public static readonly int[] progressiveGPUUnknownDeviceValues = { 0 }; public static readonly GUIContent[] progressiveGPUUnknownDeviceStrings = { - EditorGUIUtility.TrTextContent("Unknown"), + L10n.TextContent("Unknown", null, null, null), }; // Keep in sync with BakingProfile.h::BakingProfile @@ -66,11 +65,11 @@ static class Styles public static readonly int[] bakingProfileValues = { 0, 1, 2, 3, 4 }; public static readonly GUIContent[] bakingProfileStrings = { - EditorGUIUtility.TrTextContent("Highest Performance"), - EditorGUIUtility.TrTextContent("High Performance"), - EditorGUIUtility.TrTextContent("Automatic"), - EditorGUIUtility.TrTextContent("Low Memory Usage"), - EditorGUIUtility.TrTextContent("Lowest Memory Usage"), + L10n.TextContent("Highest Performance", null, null, null), + L10n.TextContent("High Performance", null, null, null), + L10n.TextContent("Automatic", null, null, null), + L10n.TextContent("Low Memory Usage", null, null, null), + L10n.TextContent("Lowest Memory Usage", null, null, null), }; public static readonly string[] BakeModeStrings = @@ -358,9 +357,9 @@ void DrawSettingsGUI(Mode mode) if (EditorGUI.DropdownButton(rect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.iconButton)) { if (mode == Mode.LightingSettings) - EditorUtility.DisplayCustomMenu(rect, new[] { EditorGUIUtility.TrTextContent("Reset") }, -1, ResetLightingSettings, null); + EditorUtility.DisplayCustomMenu(rect, new[] { L10n.TextContent("Reset", null, null, null) }, -1, ResetLightingSettings, null); else if (mode == Mode.EnvironmentSettings) - EditorUtility.DisplayCustomMenu(rect, new[] { EditorGUIUtility.TrTextContent("Reset") }, -1, ResetEnvironmentSettings, null); + EditorUtility.DisplayCustomMenu(rect, new[] { L10n.TextContent("Reset", null, null, null) }, -1, ResetEnvironmentSettings, null); } } } @@ -1043,4 +1042,3 @@ internal static void DestroyLightingWindow() } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneModeWindows/LightingWindowEnvironmentTab.cs b/Editor/Mono/SceneModeWindows/LightingWindowEnvironmentTab.cs index aea5315a84..3fa93e822f 100644 --- a/Editor/Mono/SceneModeWindows/LightingWindowEnvironmentTab.cs +++ b/Editor/Mono/SceneModeWindows/LightingWindowEnvironmentTab.cs @@ -22,7 +22,7 @@ internal class LightingWindowEnvironmentTab : LightingWindow.WindowTab { class Styles { - public static readonly GUIContent OtherSettings = EditorGUIUtility.TrTextContent("Other Settings"); + public static readonly GUIContent OtherSettings = L10n.TextContent("Other Settings", null, null, null); } class DefaultEnvironmentSectionExtension : LightingWindowEnvironmentSection diff --git a/Editor/Mono/SceneModeWindows/LightingWindowLightingTab.cs b/Editor/Mono/SceneModeWindows/LightingWindowLightingTab.cs index 2f057f4748..2d9c9b2122 100644 --- a/Editor/Mono/SceneModeWindows/LightingWindowLightingTab.cs +++ b/Editor/Mono/SceneModeWindows/LightingWindowLightingTab.cs @@ -20,9 +20,9 @@ internal class LightingWindowLightingTab : LightingWindow.WindowTab { class Styles { - public static readonly GUIContent newLightingSettings = EditorGUIUtility.TrTextContent("New", "Create a new Lighting Settings Asset with default settings."); - public static readonly GUIContent cloneLightingSettings = EditorGUIUtility.TrTextContent("Clone", "Create a new Lighting Settings Asset based on the current settings."); - public static readonly GUIContent lightingSettings = EditorGUIUtility.TrTextContent("Lighting Settings"); + public static readonly GUIContent newLightingSettings = L10n.TextContent("New", "Create a new Lighting Settings Asset with default settings.", null, null); + public static readonly GUIContent cloneLightingSettings = L10n.TextContent("Clone", "Create a new Lighting Settings Asset based on the current settings.", null, null); + public static readonly GUIContent lightingSettings = L10n.TextContent("Lighting Settings", null, null, null); } SavedBool m_ShowLightingSettings; diff --git a/Editor/Mono/SceneModeWindows/LightingWindowLightmapPreviewTab.cs b/Editor/Mono/SceneModeWindows/LightingWindowLightmapPreviewTab.cs index b68e8fc974..34116ae515 100644 --- a/Editor/Mono/SceneModeWindows/LightingWindowLightmapPreviewTab.cs +++ b/Editor/Mono/SceneModeWindows/LightingWindowLightmapPreviewTab.cs @@ -35,13 +35,13 @@ internal class LightingWindowLightmapPreviewTab : LightingWindow.WindowTab static class Styles { public static readonly GUIStyle SelectedLightmapHighlight = "LightmapEditorSelectedHighlight"; - public static readonly GUIContent LightingDataAsset = EditorGUIUtility.TrTextContent("Lighting Data Asset", "A different LightingData.asset can be assigned here. These assets are generated by baking a scene in the OnDemand mode."); - public static readonly GUIContent OpenPreview = EditorGUIUtility.TrTextContent("View"); + public static readonly GUIContent LightingDataAsset = L10n.TextContent("Lighting Data Asset", "A different LightingData.asset can be assigned here. These assets are generated by baking a scene in the OnDemand mode.", null, null); + public static readonly GUIContent OpenPreview = L10n.TextContent("View", null, null, null); public static readonly GUIStyle OpenPreviewStyle = EditorStyles.objectFieldThumb.name + "LightmapPreviewOverlay"; - public static readonly GUIContent BakedLightmapsFoldoutTitle = EditorGUIUtility.TrTextContent("Baked Lightmaps"); - public static readonly GUIContent PreviewLightmapsFoldoutTitle = EditorGUIUtility.TrTextContent("Preview Lightmaps"); + public static readonly GUIContent BakedLightmapsFoldoutTitle = L10n.TextContent("Baked Lightmaps", null, null, null); + public static readonly GUIContent PreviewLightmapsFoldoutTitle = L10n.TextContent("Preview Lightmaps", null, null, null); } public LightingWindowLightmapPreviewTab(LightmapType type) diff --git a/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs b/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs index 6ce890badc..012c3050db 100644 --- a/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs +++ b/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Lighting not yet converted using System; using UnityEngine; using UnityEngineInternal; @@ -78,42 +77,42 @@ static class Styles { public static readonly GUIContent[] RealtimePreviewTextureOptions = { - EditorGUIUtility.TrTextContent("Realtime Indirect"), - EditorGUIUtility.TrTextContent("Realtime Directionality"), - EditorGUIUtility.TrTextContent("Realtime Albedo"), - EditorGUIUtility.TrTextContent("Realtime Emissive"), - EditorGUIUtility.TrTextContent("UV Charts") + L10n.TextContent("Realtime Indirect", null, null, null), + L10n.TextContent("Realtime Directionality", null, null, null), + L10n.TextContent("Realtime Albedo", null, null, null), + L10n.TextContent("Realtime Emissive", null, null, null), + L10n.TextContent("UV Charts", null, null, null) }; public static readonly GUIContent[] InstanceBasedBakedPreviewTextureOptions = { - EditorGUIUtility.TrTextContent("Baked Lightmap"), - EditorGUIUtility.TrTextContent("Baked Directionality"), - EditorGUIUtility.TrTextContent("Baked Shadowmask"), - EditorGUIUtility.TrTextContent("Baked Albedo"), - EditorGUIUtility.TrTextContent("Baked Emissive"), - EditorGUIUtility.TrTextContent("Baked UV Charts"), - EditorGUIUtility.TrTextContent("Baked Texel Validity"), - EditorGUIUtility.TrTextContent("Baked UV Overlap"), + L10n.TextContent("Baked Lightmap", null, null, null), + L10n.TextContent("Baked Directionality", null, null, null), + L10n.TextContent("Baked Shadowmask", null, null, null), + L10n.TextContent("Baked Albedo", null, null, null), + L10n.TextContent("Baked Emissive", null, null, null), + L10n.TextContent("Baked UV Charts", null, null, null), + L10n.TextContent("Baked Texel Validity", null, null, null), + L10n.TextContent("Baked UV Overlap", null, null, null), }; public static readonly GUIContent[] IndexBasedBakedPreviewTextureOptions = { - EditorGUIUtility.TrTextContent("Baked Lightmap"), - EditorGUIUtility.TrTextContent("Baked Directionality"), - EditorGUIUtility.TrTextContent("Baked Shadowmask"), - EditorGUIUtility.TrTextContent("Baked UV Charts"), - EditorGUIUtility.TrTextContent("Baked Texel Validity"), - EditorGUIUtility.TrTextContent("Baked UV Overlap"), + L10n.TextContent("Baked Lightmap", null, null, null), + L10n.TextContent("Baked Directionality", null, null, null), + L10n.TextContent("Baked Shadowmask", null, null, null), + L10n.TextContent("Baked UV Charts", null, null, null), + L10n.TextContent("Baked Texel Validity", null, null, null), + L10n.TextContent("Baked UV Overlap", null, null, null), }; public static readonly GUIStyle PreviewLabel = new GUIStyle(EditorStyles.whiteLabel); - public static readonly GUIContent TextureNotAvailableRealtime = EditorGUIUtility.TrTextContent("The texture is not available at the moment."); - public static readonly GUIContent TextureNotAvailableBaked = EditorGUIUtility.TrTextContent("The texture is not available at the moment.\nPlease try to rebake the current scene, and make sure that this object is set to 'Contribute Global Illumination' if it's meant to be baked."); - public static readonly GUIContent TextureNotAvailableBakedShadowmask = EditorGUIUtility.TrTextContent("The texture is not available at the moment.\nPlease make sure that Mixed Lights affect this GameObject and that it is set to 'Contribute Global Illumination'."); - public static readonly GUIContent TextureLoading = EditorGUIUtility.TrTextContent("Loading..."); - public static readonly GUIContent UVOverlayIcon = EditorGUIUtility.TrIconContent("ToggleUVOverlay", "Toggles the UV Overlay for all the objects in the lightmap. The currently selected object will be highlighted. "); + public static readonly GUIContent TextureNotAvailableRealtime = L10n.TextContent("The texture is not available at the moment.", null, null, null); + public static readonly GUIContent TextureNotAvailableBaked = L10n.TextContent("The texture is not available at the moment.\nPlease try to rebake the current scene, and make sure that this object is set to 'Contribute Global Illumination' if it's meant to be baked.", null, null, null); + public static readonly GUIContent TextureNotAvailableBakedShadowmask = L10n.TextContent("The texture is not available at the moment.\nPlease make sure that Mixed Lights affect this GameObject and that it is set to 'Contribute Global Illumination'.", null, null, null); + public static readonly GUIContent TextureLoading = L10n.TextContent("Loading...", null, null, null); + public static readonly GUIContent UVOverlayIcon = L10n.IconContent("ToggleUVOverlay", "Toggles the UV Overlay for all the objects in the lightmap. The currently selected object will be highlighted. ", null); } public int lightmapIndex @@ -709,4 +708,3 @@ private Rect ScaleRectByZoomableArea(Rect rect, ZoomableArea zoomableArea) } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneModeWindows/OcclusionCullingWindow.cs b/Editor/Mono/SceneModeWindows/OcclusionCullingWindow.cs index 624a03fc56..26bc8bfdc4 100644 --- a/Editor/Mono/SceneModeWindows/OcclusionCullingWindow.cs +++ b/Editor/Mono/SceneModeWindows/OcclusionCullingWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Culling not yet converted using System; using UnityEngine; using UnityEditor.Overlays; @@ -34,21 +33,21 @@ class Styles { public GUIContent[] ModeToggles = { - EditorGUIUtility.TrTextContent("Object"), - EditorGUIUtility.TrTextContent("Bake"), - EditorGUIUtility.TrTextContent("Visualization") + L10n.TextContent("Object", null, null, null), + L10n.TextContent("Bake", null, null, null), + L10n.TextContent("Visualization", null, null, null) }; public GUIStyle labelStyle = EditorStyles.wordWrappedMiniLabel; - public GUIContent emptyAreaSelection = EditorGUIUtility.TrTextContent("Select a Mesh Renderer or an Occlusion Area from the scene."); - public GUIContent emptyCameraSelection = EditorGUIUtility.TrTextContent("Select a Camera from the scene."); - public GUIContent visualizationNote = EditorGUIUtility.TrTextContent("The visualization may not correspond to current bake settings and Occlusion Area placements if they have been changed since last bake."); - public GUIContent seeVisualizationInScene = EditorGUIUtility.TrTextContent("See the occlusion culling visualization in the Scene View based on the selected Camera."); - public GUIContent noOcclusionData = EditorGUIUtility.TrTextContent("No occlusion data has been baked."); - public GUIContent smallestHole = EditorGUIUtility.TrTextContent("Smallest Hole", "Smallest hole in the geometry through which the camera is supposed to see. The single float value of the parameter represents the diameter of the imaginary smallest hole, i.e. the maximum extent of a 3D object that fits through the hole."); - public GUIContent backfaceThreshold = EditorGUIUtility.TrTextContent("Backface Threshold", "The backface threshold is a size optimization that reduces unnecessary details by testing backfaces. A value of 100 is robust and never removes any backfaces. A value of 5 aggressively reduces the data based on locations with visible backfaces. The idea is that typically valid camera positions cannot see many backfaces. For example, geometry under terrain and inside solid objects can be removed."); - public GUIContent farClipPlane = EditorGUIUtility.TrTextContent("Far Clip Plane", "Far Clip Plane used during baking. This should match the largest far clip plane used by any camera in the scene. A value of 0.0 sets the far plane to Infinity."); - public GUIContent smallestOccluder = EditorGUIUtility.TrTextContent("Smallest Occluder", "The size of the smallest object that will be used to hide other objects when doing occlusion culling. For example, if a value of 4 is chosen, then all the objects that are higher or wider than 4 meters will block visibility and the objects that are smaller than that will not. This value is a tradeoff between occlusion accuracy and storage size."); - public GUIContent defaultParameterText = EditorGUIUtility.TrTextContent("Default Parameters", "The default parameters guarantee that any given scene computes fast and the occlusion culling results are good. As the parameters are always scene specific, better results will be achieved when fine tuning the parameters on a scene to scene basis. All the parameters are dependent on the unit scale of the scene and it is imperative that the unit scale parameter is set correctly before setting the default values."); + public GUIContent emptyAreaSelection = L10n.TextContent("Select a Mesh Renderer or an Occlusion Area from the scene.", null, null, null); + public GUIContent emptyCameraSelection = L10n.TextContent("Select a Camera from the scene.", null, null, null); + public GUIContent visualizationNote = L10n.TextContent("The visualization may not correspond to current bake settings and Occlusion Area placements if they have been changed since last bake.", null, null, null); + public GUIContent seeVisualizationInScene = L10n.TextContent("See the occlusion culling visualization in the Scene View based on the selected Camera.", null, null, null); + public GUIContent noOcclusionData = L10n.TextContent("No occlusion data has been baked.", null, null, null); + public GUIContent smallestHole = L10n.TextContent("Smallest Hole", "Smallest hole in the geometry through which the camera is supposed to see. The single float value of the parameter represents the diameter of the imaginary smallest hole, i.e. the maximum extent of a 3D object that fits through the hole.", null, null); + public GUIContent backfaceThreshold = L10n.TextContent("Backface Threshold", "The backface threshold is a size optimization that reduces unnecessary details by testing backfaces. A value of 100 is robust and never removes any backfaces. A value of 5 aggressively reduces the data based on locations with visible backfaces. The idea is that typically valid camera positions cannot see many backfaces. For example, geometry under terrain and inside solid objects can be removed.", null, null); + public GUIContent farClipPlane = L10n.TextContent("Far Clip Plane", "Far Clip Plane used during baking. This should match the largest far clip plane used by any camera in the scene. A value of 0.0 sets the far plane to Infinity.", null, null); + public GUIContent smallestOccluder = L10n.TextContent("Smallest Occluder", "The size of the smallest object that will be used to hide other objects when doing occlusion culling. For example, if a value of 4 is chosen, then all the objects that are higher or wider than 4 meters will block visibility and the objects that are smaller than that will not. This value is a tradeoff between occlusion accuracy and storage size.", null, null); + public GUIContent defaultParameterText = L10n.TextContent("Default Parameters", "The default parameters guarantee that any given scene computes fast and the occlusion culling results are good. As the parameters are always scene specific, better results will be achieved when fine tuning the parameters on a scene to scene basis. All the parameters are dependent on the unit scale of the scene and it is imperative that the unit scale parameter is set correctly before setting the default values.", null, null); } enum Mode @@ -310,7 +309,7 @@ void BakeButtons() private bool CustomDropdownButton(string name, float width, params GUILayoutOption[] options) { - var content = EditorGUIUtility.TrTextContent(name); + var content = L10n.TextContent(name, null, null, null); var rect = GUILayoutUtility.GetRect(content, EditorStyles.dropDownList, options); var halfDiff = (width - rect.width) / 2f; @@ -607,4 +606,3 @@ public override void OnGUI() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneView/GridSettings.cs b/Editor/Mono/SceneView/GridSettings.cs index 21bf4e6eca..1aad9c8058 100644 --- a/Editor/Mono/SceneView/GridSettings.cs +++ b/Editor/Mono/SceneView/GridSettings.cs @@ -187,6 +187,9 @@ public Vector3 position // state (the rotation setter clears it, the only reader null-checks and falls back), and it // is re-read lazily on the next UI refresh. [AutoStaticsCleanupOnCodeReload] + // Null is an ordinary state that the rotation setter itself produces, and the only reader falls back + // when it is null; the next "sample transform rotation" action sets it again. + [IgnoreForUAL0015("Sampled-transform latch; null is a normal state and the next sample action re-sets it")] internal static Transform lastRotationSampleTransform { get; set; } public Quaternion rotation diff --git a/Editor/Mono/SceneView/SceneOrientationGizmo.cs b/Editor/Mono/SceneView/SceneOrientationGizmo.cs index c6c8e4368f..d02aca37a1 100644 --- a/Editor/Mono/SceneView/SceneOrientationGizmo.cs +++ b/Editor/Mono/SceneView/SceneOrientationGizmo.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using System; using UnityEditor; using UnityEditor.AnimatedValues; @@ -18,6 +17,10 @@ sealed class SceneOrientationGizmo : IMGUIOverlay { static readonly Color k_PickingClearColor = Color.magenta; + + // Negative axis cones, labels and the rotation lock icon are not meant to be customizable + // via the "Center Axis" color preference, which should only affect the center cube. + static readonly Color k_GizmoNeutralColor = new Color(0.8f, 0.8f, 0.8f, 0.93f); const int kRotationSize = 100; const float kRotationLockedAlpha = 0.4f; const int kPerspOrthoLabelHeight = 16; @@ -111,8 +114,8 @@ static class Styles public static readonly GUIStyle viewLabelStyleCentered = "SC ViewLabelCentered"; public static readonly GUIStyle viewAxisLabelStyle = "SC ViewAxisLabel"; public static readonly GUIStyle lockStyle = "CenteredLabel"; - public static readonly GUIContent unlockedRotationIcon = EditorGUIUtility.TrIconContent("LockIcon", "Click to lock the rotation in the current direction."); - public static readonly GUIContent lockedRotationIcon = EditorGUIUtility.TrIconContent("LockIcon-On", "Click to unlock the rotation."); + public static readonly GUIContent unlockedRotationIcon = L10n.IconContent("LockIcon", "Click to lock the rotation in the current direction.", null); + public static readonly GUIContent lockedRotationIcon = L10n.IconContent("LockIcon-On", "Click to unlock the rotation.", null); } struct BlendingScope : IDisposable @@ -252,7 +255,7 @@ void AxisSelectors(SceneView view, Camera cam, float size, float sgn, bool hover c = Handles.zAxisColor; break; default: - c = Handles.centerColor; + c = k_GizmoNeutralColor; break; } @@ -377,7 +380,7 @@ void DrawRotationLock(SceneView view, Rect rect) float lockCenterY = 17; Rect lockRect = new Rect(lockCenterX - (clickWidth / 2), lockCenterY - (clickHeight / 2), clickWidth, clickHeight); - Color c = Handles.centerColor; + Color c = k_GizmoNeutralColor; c.a *= m_Visible.faded; if (c.a > 0.0f) { @@ -450,7 +453,7 @@ void DrawLabels(SceneView view, Rect rect) { if (i == index2D) // Future proof even if we add more labels after the 2D one continue; - Color c = Handles.centerColor; + Color c = k_GizmoNeutralColor; c.a *= dirNameVisible[i].faded * fadedRotationLock; if (c.a > 0.0f) { @@ -461,7 +464,7 @@ void DrawLabels(SceneView view, Rect rect) // Then draw just the label for 2D. It uses the original labelRect, and with a style where the text is horizontally centered. { - Color c = Handles.centerColor; + Color c = k_GizmoNeutralColor; c.a *= faded2Dgray * fadedVisibility; if (c.a > 0.0f) { @@ -804,4 +807,3 @@ void SwitchDirNameVisible(int newVisible) m_Visible.target = (newVisible != 8); } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneView/SceneView.cs b/Editor/Mono/SceneView/SceneView.cs index 8bd770359b..b42de6c541 100644 --- a/Editor/Mono/SceneView/SceneView.cs +++ b/Editor/Mono/SceneView/SceneView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using System; using System.Collections; using System.Collections.Generic; @@ -88,6 +87,9 @@ public override string ToString() } [AutoStaticsCleanupOnCodeReload] + // Last-active cache: the lastActiveSceneView getter falls back to the first entry of the live scene + // view list when this is null, and it is reassigned as scene views are focused. + [IgnoreForUAL0015("Last-active cache re-derived from the live scene view list by the getter")] static SceneView s_LastActiveSceneView; [RequiredByNativeCode] @@ -656,6 +658,9 @@ public bool audioPlay } [AutoStaticsCleanupOnCodeReload] + // Latch recording which scene view currently owns audio preview; RefreshAudioPlay re-establishes it + // on the next audio toggle or stage change, and the per-view flag driving it is serialized. + [IgnoreForUAL0015("Audio-preview owner latch, re-established by the next RefreshAudioPlay")] static SceneView s_AudioSceneView; [SerializeField] @@ -698,6 +703,9 @@ internal bool debugDrawModesUseInteractiveLightBakingData [AutoStaticsCleanupOnCodeReload] public static event Action beforeSceneGui; [AutoStaticsCleanupOnCodeReload] + // Subscribers are inspectors, tools and overlays that subscribe in OnEnable and unsubscribe in + // OnDisable, so the cleared invocation list refills as those editors are enabled again. + [IgnoreForUAL0015("Event whose subscribers re-register from inspector and overlay OnEnable")] public static event Action duringSceneGui; [AutoStaticsCleanupOnCodeReload] @@ -1351,20 +1359,20 @@ public float cameraDistance internal static class Styles { - public static readonly GUIContent toolsContent = EditorGUIUtility.TrIconContent("SceneViewTools", "Hide or show the Component Editor Tools panel in the Scene view."); - public static readonly GUIContent lighting = EditorGUIUtility.TrIconContent("SceneviewLighting", "When toggled on, the Scene lighting is used. When toggled off, a light attached to the Scene view camera is used."); - public static readonly GUIContent fx = EditorGUIUtility.TrIconContent("SceneviewFx", "Toggle skybox, fog, and various other effects."); - public static readonly GUIContent audioPlayContent = EditorGUIUtility.TrIconContent("SceneviewAudio", "Toggle audio on or off."); - public static readonly GUIContent gizmosContent = EditorGUIUtility.TrTextContent("Gizmos", "Toggle visibility of all Gizmos in the Scene view"); - public static readonly GUIContent gizmosDropDownContent = EditorGUIUtility.TrTextContent("", "Toggle the visibility of different Gizmos in the Scene view."); - public static readonly GUIContent mode2DContent = EditorGUIUtility.TrIconContent("SceneView2D", "When toggled on, the Scene is in 2D view. When toggled off, the Scene is in 3D view."); - public static readonly GUIContent gridXToolbarContent = EditorGUIUtility.TrIconContent("GridAxisX", "Toggle the visibility of the grid"); - public static readonly GUIContent gridYToolbarContent = EditorGUIUtility.TrIconContent("GridAxisY", "Toggle the visibility of the grid"); - public static readonly GUIContent gridZToolbarContent = EditorGUIUtility.TrIconContent("GridAxisZ", "Toggle the visibility of the grid"); - public static readonly GUIContent metalFrameCaptureContent = EditorGUIUtility.TrIconContent("FrameCapture", "Capture the current view and open in Xcode frame debugger"); - public static readonly GUIContent sceneVisToolbarButtonContent = EditorGUIUtility.TrIconContent("SceneViewVisibility", "Number of hidden objects, click to toggle scene visibility"); + public static readonly GUIContent toolsContent = L10n.IconContent("SceneViewTools", "Hide or show the Component Editor Tools panel in the Scene view.", null); + public static readonly GUIContent lighting = L10n.IconContent("SceneviewLighting", "When toggled on, the Scene lighting is used. When toggled off, a light attached to the Scene view camera is used.", null); + public static readonly GUIContent fx = L10n.IconContent("SceneviewFx", "Toggle skybox, fog, and various other effects.", null); + public static readonly GUIContent audioPlayContent = L10n.IconContent("SceneviewAudio", "Toggle audio on or off.", null); + public static readonly GUIContent gizmosContent = L10n.TextContent("Gizmos", "Toggle visibility of all Gizmos in the Scene view", null, null); + public static readonly GUIContent gizmosDropDownContent = L10n.TextContent("", "Toggle the visibility of different Gizmos in the Scene view.", null, null); + public static readonly GUIContent mode2DContent = L10n.IconContent("SceneView2D", "When toggled on, the Scene is in 2D view. When toggled off, the Scene is in 3D view.", null); + public static readonly GUIContent gridXToolbarContent = L10n.IconContent("GridAxisX", "Toggle the visibility of the grid", null); + public static readonly GUIContent gridYToolbarContent = L10n.IconContent("GridAxisY", "Toggle the visibility of the grid", null); + public static readonly GUIContent gridZToolbarContent = L10n.IconContent("GridAxisZ", "Toggle the visibility of the grid", null); + public static readonly GUIContent metalFrameCaptureContent = L10n.IconContent("FrameCapture", "Capture the current view and open in Xcode frame debugger", null); + public static readonly GUIContent sceneVisToolbarButtonContent = L10n.IconContent("SceneViewVisibility", "Number of hidden objects, click to toggle scene visibility", null); public static readonly GUIStyle gizmoButtonStyle; - public static readonly GUIContent sceneViewCameraContent = EditorGUIUtility.TrIconContent("SceneViewCamera", "Settings for the Scene view camera."); + public static readonly GUIContent sceneViewCameraContent = L10n.IconContent("SceneViewCamera", "Settings for the Scene view camera.", null); static Styles() { @@ -1772,12 +1780,10 @@ void UpdateHiddenObjectCount() public SceneView() { - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced m_HierarchyType = HierarchyType.GameObjects; // Note: Rendering for Scene view picking depends on the depth buffer of the window depthBufferBits = 32; - #pragma warning restore UAL0015 } internal void Awake() @@ -1824,9 +1830,9 @@ internal void Awake() Tools.current = Tool.Rect; } - #pragma warning disable UAL0018 // rebuilt/resubscribed wholesale on the next reload via this object's own lifecycle; a stale value in the interim is never observed +#pragma warning disable UAL0018 // the back-reference is held by this scene view, which is recreated on code reload along with the view it points at m_PreviousScene = lastActiveSceneView; - #pragma warning restore UAL0018 +#pragma warning restore UAL0018 } internal static void AlignCameraWithView(Camera camera) @@ -4580,7 +4586,7 @@ internal static void ShowSceneViewPlayModeSaveWarning() // In this case, we want to explicitly try the GameView before passing it on to whatever notificationView we have var playModeView = (PlayModeView)WindowLayout.FindEditorWindowOfType(typeof(PlayModeView)); if (playModeView != null && playModeView.hasFocus) - playModeView.ShowNotification(EditorGUIUtility.TrTextContent("You must exit play mode to save the scene!")); + playModeView.ShowNotification(L10n.TextContent("You must exit play mode to save the scene!", null, null, null)); else ShowNotification("You must exit play mode to save the scene!"); } @@ -4730,4 +4736,3 @@ internal void SetOverlayVisible(string id, bool show) } } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneView/SceneViewOverlays.cs b/Editor/Mono/SceneView/SceneViewOverlays.cs index 870519c368..b16b29a26b 100644 --- a/Editor/Mono/SceneView/SceneViewOverlays.cs +++ b/Editor/Mono/SceneView/SceneViewOverlays.cs @@ -18,7 +18,7 @@ internal class SceneViewIsolationOverlay : TransientSceneViewOverlay internal static class Styles { - public static readonly GUIContent isolationModeExitButton = EditorGUIUtility.TrTextContent("Exit", "Exit isolation mode"); + public static readonly GUIContent isolationModeExitButton = L10n.TextContent("Exit", "Exit isolation mode", null, null); } public override bool visible => m_ShouldDisplay; diff --git a/Editor/Mono/SceneView/SceneViewToolbarStyles.cs b/Editor/Mono/SceneView/SceneViewToolbarStyles.cs index 14fe4153af..6a9109a40c 100644 --- a/Editor/Mono/SceneView/SceneViewToolbarStyles.cs +++ b/Editor/Mono/SceneView/SceneViewToolbarStyles.cs @@ -14,8 +14,14 @@ static partial class SceneViewToolbarStyles const string k_StyleDark = "StyleSheets/SceneViewToolbarElements/SceneViewToolbarElementsDark.uss"; [AutoStaticsCleanupOnCodeReload] + // AddStyleSheets reloads the style sheet whenever this is null, so it comes back the next time a + // toolbar element is styled. + [IgnoreForUAL0015("Lazy style sheet cache, reloaded on demand by AddStyleSheets")] static StyleSheet s_Style; [AutoStaticsCleanupOnCodeReload] + // AddStyleSheets reloads the skin style sheet whenever this is null, so it comes back the next time + // a toolbar element is styled. + [IgnoreForUAL0015("Lazy style sheet cache, reloaded on demand by AddStyleSheets")] static StyleSheet s_Skin; internal static void AddStyleSheets(VisualElement ve) { diff --git a/Editor/Mono/SceneView/SceneViewToolbars.cs b/Editor/Mono/SceneView/SceneViewToolbars.cs index 33ee7f0d05..d11343c18c 100644 --- a/Editor/Mono/SceneView/SceneViewToolbars.cs +++ b/Editor/Mono/SceneView/SceneViewToolbars.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; using UnityEditor.EditorTools; @@ -254,4 +253,3 @@ public GridAndSnapToolBar() : base( } } // namespace -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SceneVisibility/SceneVisibilityHierarchyGUI.cs b/Editor/Mono/SceneVisibility/SceneVisibilityHierarchyGUI.cs index afe69d0676..0303e27bb3 100644 --- a/Editor/Mono/SceneVisibility/SceneVisibilityHierarchyGUI.cs +++ b/Editor/Mono/SceneVisibility/SceneVisibilityHierarchyGUI.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SceneView not yet converted using Unity.Scripting.LifecycleManagement; using UnityEditor.Experimental; using UnityEditor.IMGUI.Controls; @@ -33,27 +32,27 @@ public class IconState [NoAutoStaticsCleanup] // readonly icon set (GUIContent), safe to persist public static readonly IconState iconNormal = new IconState { - visibleAll = EditorGUIUtility.TrIconContent("scenevis_visible"), - visibleMixed = EditorGUIUtility.TrIconContent("scenevis_visible-mixed"), - hiddenAll = EditorGUIUtility.TrIconContent("scenevis_hidden"), - hiddenMixed = EditorGUIUtility.TrIconContent("scenevis_hidden-mixed"), - pickingEnabledAll = EditorGUIUtility.TrIconContent("scenepicking_pickable"), - pickingEnabledMixed = EditorGUIUtility.TrIconContent("scenepicking_pickable-mixed"), - pickingDisabledAll = EditorGUIUtility.TrIconContent("scenepicking_notpickable"), - pickingDisabledMixed = EditorGUIUtility.TrIconContent("scenepicking_notpickable-mixed"), + visibleAll = L10n.IconContent("scenevis_visible", null, null), + visibleMixed = L10n.IconContent("scenevis_visible-mixed", null, null), + hiddenAll = L10n.IconContent("scenevis_hidden", null, null), + hiddenMixed = L10n.IconContent("scenevis_hidden-mixed", null, null), + pickingEnabledAll = L10n.IconContent("scenepicking_pickable", null, null), + pickingEnabledMixed = L10n.IconContent("scenepicking_pickable-mixed", null, null), + pickingDisabledAll = L10n.IconContent("scenepicking_notpickable", null, null), + pickingDisabledMixed = L10n.IconContent("scenepicking_notpickable-mixed", null, null), }; [NoAutoStaticsCleanup] // readonly icon set (GUIContent), safe to persist public static readonly IconState iconHovered = new IconState { - visibleAll = EditorGUIUtility.TrIconContent("scenevis_visible_hover"), - visibleMixed = EditorGUIUtility.TrIconContent("scenevis_visible-mixed_hover"), - hiddenAll = EditorGUIUtility.TrIconContent("scenevis_hidden_hover"), - hiddenMixed = EditorGUIUtility.TrIconContent("scenevis_hidden-mixed_hover"), - pickingEnabledAll = EditorGUIUtility.TrIconContent("scenepicking_pickable_hover"), - pickingEnabledMixed = EditorGUIUtility.TrIconContent("scenepicking_pickable-mixed_hover"), - pickingDisabledAll = EditorGUIUtility.TrIconContent("scenepicking_notpickable_hover"), - pickingDisabledMixed = EditorGUIUtility.TrIconContent("scenepicking_notpickable-mixed_hover"), + visibleAll = L10n.IconContent("scenevis_visible_hover", null, null), + visibleMixed = L10n.IconContent("scenevis_visible-mixed_hover", null, null), + hiddenAll = L10n.IconContent("scenevis_hidden_hover", null, null), + hiddenMixed = L10n.IconContent("scenevis_hidden-mixed_hover", null, null), + pickingEnabledAll = L10n.IconContent("scenepicking_pickable_hover", null, null), + pickingEnabledMixed = L10n.IconContent("scenepicking_pickable-mixed_hover", null, null), + pickingDisabledAll = L10n.IconContent("scenepicking_notpickable_hover", null, null), + pickingDisabledMixed = L10n.IconContent("scenepicking_notpickable-mixed_hover", null, null), }; public static readonly Color backgroundColor = EditorResources.GetStyle("game-object-tree-view-scene-visibility") @@ -302,4 +301,3 @@ private static void DrawSceneItemPicking(Rect rect, Scene scene, bool isItemHove } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Scripting/APIUpdater/APIUpdaterManager.bindings.cs b/Editor/Mono/Scripting/APIUpdater/APIUpdaterManager.bindings.cs index 9232de3c52..dc60bb2f93 100644 --- a/Editor/Mono/Scripting/APIUpdater/APIUpdaterManager.bindings.cs +++ b/Editor/Mono/Scripting/APIUpdater/APIUpdaterManager.bindings.cs @@ -133,6 +133,9 @@ internal static void UpdateAssemblies() PersistListOfAssembliesToUpdate(); } + // CoreCLR rejects WaitHandle.WaitAll on an STA thread, which the Windows editor main thread + // is. Waiting per handle against a shared deadline is equivalent. Mono accepts the call and + // keeps the original batched WaitAll. internal static bool WaitOnManyEvents(IEnumerable waitEvents, TimeSpan timeout) { var timeBomb = DateTime.Now + timeout; @@ -149,8 +152,7 @@ internal static bool WaitOnManyEvents(IEnumerable waitEvents, TimeSp private static IEnumerable BatchWaitHandles(IEnumerable handles) { - // According to documentation (https://docs.microsoft.com/en-us/dotnet/api/system.threading.waithandle.waitall?view=net-5.0#System_Threading_WaitHandle_WaitAll_System_Threading_WaitHandle___System_Int32) - // WaitAll accepts a maximum of 64 handles. So the max size of the returned batch will be 64 + // WaitAll accepts a maximum of 64 handles, so the max size of a returned batch is 64. const int batchMaxSize = 64; var currentBatch = new List(batchMaxSize); foreach (var handle in handles) @@ -169,6 +171,7 @@ private static IEnumerable BatchWaitHandles(IEnumerable t.Event); var timeout = TimeSpan.FromSeconds(30); - if (!WaitHandle.WaitAll(waitEvents, timeout)) + if (!WaitOnManyEvents(waitEvents, timeout)) { LogTimeoutError(tasks, timeout); } @@ -516,6 +519,7 @@ private static void UpdatePublishUpdaterConfigStatusAndAddDependents(HashSet debuggerAttached; diff --git a/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs b/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs index d8b41b4e88..affe4d6c7b 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ScriptingBuildtime not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -208,6 +207,7 @@ internal AssemblyDefinitionPlatform(string name, string displayName, BuildTarget } } + [VisibleToOtherModules("UnityEditor.BurstModule")] internal struct CompilationDoneResult { internal CompilationDoneResult(bool isForEditor, bool isSuccessful, IReadOnlyList updatedFiles, IReadOnlyList deletedFiles, IReadOnlyDictionary> assemblyDefines) @@ -252,6 +252,11 @@ public static partial class CompilationPipeline [AutoStaticsCleanupOnCodeReload] public static event Action codeOptimizationChanged; + [AutoStaticsCleanupOnCodeReload] + // New MSBuild events + [VisibleToOtherModules("UnityEditor.BurstModule")] + internal static event Action buildFinished; + public static CodeOptimization codeOptimization { get { return IsScriptDebugInfoEnabled() ? CodeOptimization.Debug : CodeOptimization.Release; } @@ -298,7 +303,7 @@ internal static bool TryGetLastBuildResult(CompileTarget target, out Compilation internal static void ReportBuildFinished(CompileTarget target, CompilationDoneResult compilationDoneResult) { - + buildFinished?.Invoke(compilationDoneResult); } static CompilationPipeline() @@ -772,4 +777,3 @@ internal static void OnCodeOptimizationChanged(bool scriptDebugInfoEnabled) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs index c1f9ba4bfb..58203b66f4 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs @@ -2,8 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ScriptingBuildtime not yet converted -#pragma warning disable UAL0010,UAL0011,UAL0012,UAL0013,UAL0014 // AutoStaticsCleanup: ScriptingBuildtime not yet converted using System; using System.Collections.Generic; using System.Diagnostics; @@ -519,6 +517,7 @@ static CustomScriptAssembly() new CustomScriptAssemblyPlatform("LinuxStandaloneUniversal", BuildTarget.StandaloneLinuxUniversal), new CustomScriptAssemblyPlatform("Lumin", BuildTarget.Lumin), new CustomScriptAssemblyPlatform("Stadia", BuildTarget.Stadia), + new CustomScriptAssemblyPlatform("Kepler", BuildTarget.Kepler), }; RenamedPlatforms = new string[] { @@ -803,5 +802,3 @@ private static string GenerateImmutablePackageRulesetContent() } } } -#pragma warning restore UAL0010,UAL0011,UAL0012,UAL0013,UAL0014 -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs b/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs index 2ec004102e..7687007590 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs @@ -20,6 +20,9 @@ namespace UnityEditor.Scripting.ScriptCompilation static partial class EditorCompilationInterface { [AutoStaticsCleanupOnCodeReload] // this object has events + // Lazy singleton: the Instance getter constructs a new EditorCompilation on the next access after + // cleanup nulls it. + [IgnoreForUAL0015("Lazy singleton recreated on demand by the Instance getter")] static EditorCompilation editorCompilation; public static EditorCompilation Instance diff --git a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs index db15bd0a4a..d38329735f 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs @@ -12,7 +12,6 @@ using UnityEditor.MSBuild; using Unity.AsmDefToCSProj; using UnityEditor.Build; -using Unity.Scripting; using Unity.Scripting.LifecycleManagement; using UnityEngine; using UnityEngine.Bindings; @@ -44,11 +43,18 @@ internal class CompilationMessage public LogMessage Msg; } + [VisibleToOtherModules("UnityEditor.ProjectAuditorModule")] + internal class CompilationAssembly + { + public string Name; + public List ReferencedAssemblyNames; + } + [VisibleToOtherModules("UnityEditor.ProjectAuditorModule")] internal class CompilationMessages { public bool Success; - public string[] Assemblies = Array.Empty(); + public CompilationAssembly[] Assemblies = Array.Empty(); public CompilationMessage[] Messages = Array.Empty(); } @@ -499,14 +505,22 @@ private static MSBuildCompilationOptions GetAnalysisCompilationOptions(string co private static CompilationMessages BuildScriptCompilationMessages(BuildResultMessage buildResult) { - var assemblies = new List(); + var assemblies = new List(); var messages = new List(); foreach (var kvp in buildResult.GetProjectResults()) { var projectResult = kvp.Value; - if (!string.IsNullOrEmpty(projectResult.AssemblyName)) - assemblies.Add(projectResult.AssemblyName); + + // ILPostProcessors are build-time tools, not script assemblies, so they don't belong in the assembly list. + if (!string.IsNullOrEmpty(projectResult.AssemblyName) && !projectResult.IsILPostProcessor) + { + assemblies.Add(new CompilationAssembly + { + Name = projectResult.AssemblyName, + ReferencedAssemblyNames = new List(projectResult.GetReferencedAssemblyNames()) + }); + } foreach (var msg in projectResult.GetLogMessages()) { diff --git a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs index a8fa8c5fb7..accbeec866 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs @@ -97,7 +97,7 @@ public static void UpdateGeneratedMSBuildFileIfNeeded(BuildTarget buildTarget, M UpdateSystemSearchPaths(buildTarget); UpdateRoslynAnalyzersProps(globalAnalyzers); - PropsGenerator.Instance.UpdateUnityContentLocation(EditorApplication.applicationScriptingPath); + PropsGenerator.Instance.UpdateUnityContentLocation(EditorApplication.applicationScriptingPath, EditorApplication.applicationBuildPipelinePath); PropsGenerator.Instance.UpdateBuildConfigurationProperties(buildTarget.ToString(), CompilationPipeline.codeOptimization == CodeOptimization.Release); } @@ -147,6 +147,7 @@ public static void UpdateEssentialPropsOnly(BuildTarget buildTarget) PropsGenerator.Instance.UpdateEssentialPropsOnly( EditorApplication.applicationScriptingPath, + EditorApplication.applicationBuildPipelinePath, editorVersion); } diff --git a/Editor/Mono/Search/ObjectSelectorSearch.cs b/Editor/Mono/Search/ObjectSelectorSearch.cs index eaccdd59d5..4c5ddbd404 100644 --- a/Editor/Mono/Search/ObjectSelectorSearch.cs +++ b/Editor/Mono/Search/ObjectSelectorSearch.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -79,6 +78,9 @@ public interface IObjectSelectorEngine : ISelectorEngine {} public static partial class ObjectSelectorSearch { [AutoStaticsCleanupOnCodeReload] + // The engineImp property calls StaticInit() whenever this is null, and StaticInit also runs from the + // first tick after every code load, so the engine wrapper is recreated before it is used. + [IgnoreForUAL0015("Engine wrapper recreated by StaticInit() on the next access after cleanup nulls it")] static SearchApiBaseImp s_EngineImp = null; static SearchApiBaseImp engineImp { @@ -205,4 +207,3 @@ public void SetSearchFilter(string searchFilter) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Search/OpenSearchHelper.cs b/Editor/Mono/Search/OpenSearchHelper.cs index e37d3bbb6b..42e661fc39 100644 --- a/Editor/Mono/Search/OpenSearchHelper.cs +++ b/Editor/Mono/Search/OpenSearchHelper.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using System.Linq; using Unity.Scripting.LifecycleManagement; using UnityEditor.ShortcutManagement; @@ -14,7 +13,7 @@ static partial class OpenSearchHelper { static class Styles { - public static readonly GUIContent gotoSearch = EditorGUIUtility.TrIconContent("SearchJump Icon"); + public static readonly GUIContent gotoSearch = L10n.IconContent("SearchJump Icon", null, null); } internal const string k_SearchMenuName = "Edit/Search/Search All..."; @@ -102,4 +101,3 @@ public static bool IsShortcutAvailable() } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Search/ProjectSearch.cs b/Editor/Mono/Search/ProjectSearch.cs index 4cdf9031f0..18c4ac4fad 100644 --- a/Editor/Mono/Search/ProjectSearch.cs +++ b/Editor/Mono/Search/ProjectSearch.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -27,6 +26,9 @@ public interface IProjectSearchEngine : ISearchEngine {} public static partial class ProjectSearch { [AutoStaticsCleanupOnCodeReload] + // The engineImp property calls StaticInit() whenever this is null, and StaticInit also runs from the + // first tick after every code load, so the engine wrapper is recreated before it is used. + [IgnoreForUAL0015("Engine wrapper recreated by StaticInit() on the next access after cleanup nulls it")] static SearchApiBaseImp s_EngineImp = null; static SearchApiBaseImp engineImp { @@ -124,4 +126,3 @@ public IEnumerable Search(string query, Action> asyn } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Search/SceneSearch.cs b/Editor/Mono/Search/SceneSearch.cs index 6da69673af..48a52f0241 100644 --- a/Editor/Mono/Search/SceneSearch.cs +++ b/Editor/Mono/Search/SceneSearch.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using System; using System.Collections.Generic; using Unity.Scripting.LifecycleManagement; @@ -48,6 +47,9 @@ internal class SearchEngineInterop : ISceneSearchEngineV2 public static partial class SceneSearch { [AutoStaticsCleanupOnCodeReload] + // The engineImp property calls StaticInit() whenever this is null, and StaticInit also runs from the + // first tick after every code load, so the engine wrapper is recreated before it is used. + [IgnoreForUAL0015("Engine wrapper recreated by StaticInit() on the next access after cleanup nulls it")] static SearchApiBaseImp s_EngineImp = null; static SearchApiBaseImp engineImp { @@ -143,4 +145,3 @@ public bool Filter(string query, HierarchyIterator objectToFilter) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Search/SearchService.cs b/Editor/Mono/Search/SearchService.cs index cd6be1545a..87599a7b19 100644 --- a/Editor/Mono/Search/SearchService.cs +++ b/Editor/Mono/Search/SearchService.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Search not yet converted using System; using System.Collections.Generic; using System.Linq; @@ -116,8 +115,10 @@ void Init(bool pullEngines = false) var index = SearchService.searchApis.FindIndex(api => api.engineScope == m_EngineScope); if (index >= 0) { +#pragma warning disable UAL0018 // session handlers are owned by editor windows, which are recreated on code reload; a handler that finds no api yet re-resolves it from the refilled registry in BeginSession m_Api = SearchService.searchApis[index]; m_Api.activeEngineChanged += OnActiveEngineChanged; +#pragma warning restore UAL0018 } } @@ -212,6 +213,9 @@ static partial class SearchService public const string keyPrefix = "searchservice"; public const string activeSearchEnginesPrefKey = keyPrefix + ".activeengines."; [AutoStaticsCleanupOnCodeReload] + // Live-instance registry: every SearchApiBaseImp adds itself from its own constructor, and each + // engine impl is itself lazily recreated, so the list cleared on reload refills itself. + [IgnoreForUAL0015("Live search-api registry, refilled by each SearchApiBaseImp constructor")] public static List searchApis = new List(); public enum SyncSearchEvent @@ -452,4 +456,3 @@ public void HandleUserException(Exception ex) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Selection/Selection.cs b/Editor/Mono/Selection/Selection.cs index 6e23191a17..a1724d040a 100644 --- a/Editor/Mono/Selection/Selection.cs +++ b/Editor/Mono/Selection/Selection.cs @@ -19,6 +19,9 @@ public sealed partial class Selection static readonly EntityId[] k_SingleSelectionCache = new EntityId[1]; [AutoStaticsCleanupOnCodeReload] + // Subscribers attach through their own lifecycle and re-subscribe after a code reload, so the + // cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static System.Action selectionChanged; [AutoStaticsCleanupOnCodeReload] private static DelegateWithPerformanceTracker m_SelectionChangedEvent = new DelegateWithPerformanceTracker($"{nameof(Selection)}.{nameof(selectionChanged)}"); diff --git a/Editor/Mono/Selection/SelectionHistory.cs b/Editor/Mono/Selection/SelectionHistory.cs index 9f1608660e..f1eeb83e75 100644 --- a/Editor/Mono/Selection/SelectionHistory.cs +++ b/Editor/Mono/Selection/SelectionHistory.cs @@ -186,6 +186,9 @@ internal partial class SelectionHistory : ScriptableSingleton bool m_ApplyingCustomSelection; [AutoStaticsCleanupOnCodeReload] + // Notification hook whose listeners attach through their own lifecycle and re-subscribe after a + // code reload, so the cleared invocation list refills itself. + [IgnoreForUAL0015("Event whose subscribers re-register through their own lifecycle after a code reload")] public static EditorApplication.CallbackFunction indexChanged; [MenuItem("Edit/Previous Selection %#[", priority = 70)] diff --git a/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs b/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs index 497e1a00ff..587e83f315 100644 --- a/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs +++ b/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: Serialization not yet converted using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -219,8 +218,8 @@ internal static class Styles public static readonly string serializeTreeViewState = "_TreeViewState"; public static readonly string serializeColumnHeaderState = "_ColumnHeaderState"; public static readonly string serializeFilter = "_Filter_"; - public static readonly GUIContent filterSelection = EditorGUIUtility.TrTextContent("Isolate Selection", "Limits the table contents to the active selection."); - public static readonly GUIContent showInactiveObjects = EditorGUIUtility.TrTextContent("Show Inactive Objects", "Show objects that are not active in the hierarchy but contains the component."); + public static readonly GUIContent filterSelection = L10n.TextContent("Isolate Selection", "Limits the table contents to the active selection.", null, null); + public static readonly GUIContent showInactiveObjects = L10n.TextContent("Show Inactive Objects", "Show objects that are not active in the hierarchy but contains the component.", null, null); } // this gets stuffed into the view and displayed on screen. It is a visible subset of the actual data @@ -816,4 +815,3 @@ private bool IsColumnVisible(int idx) private Column Col(int idx) { return (Column)multiColumnHeader.state.columns[idx]; } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Settings.cs b/Editor/Mono/Settings.cs index e48c9870c6..253bc2014b 100644 --- a/Editor/Mono/Settings.cs +++ b/Editor/Mono/Settings.cs @@ -187,6 +187,10 @@ internal partial class PrefSettings [NoAutoStaticsCleanup] // registered editor preferences keyed by name (internal pref types only); persists across reload static SortedList m_Prefs = new SortedList(); [AutoStaticsCleanupOnCodeReload] + // Subscribers (OverlayPrefs, RectTransformEditor, scene-view overlays, UI Toolkit authoring + // controls) all re-register through their own lifecycle after a code reload: OnEnable, + // [OnCodeLoaded], constructors of recreated instances, or panel attach events. + [IgnoreForUAL0015("Subscribers re-register through their own lifecycle after a code reload")] public static Action settingChanged; [AutoStaticsCleanupOnCodeReload] public static Action settingsReverted; @@ -340,6 +344,7 @@ public SavedFloat(string name, float value) : base(name, value) { } public static implicit operator float(SavedFloat s) => s.value; } + [VisibleToOtherModules("UnityEditor.UIToolkitAuthoringModule")] internal class SavedBool : SavedValue { public SavedBool(string name, bool value) : base(name, value) { } diff --git a/Editor/Mono/Settings/SettingsWindow.cs b/Editor/Mono/Settings/SettingsWindow.cs index e9ffec4d5c..663c297b8b 100644 --- a/Editor/Mono/Settings/SettingsWindow.cs +++ b/Editor/Mono/Settings/SettingsWindow.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: SettingsWindowFramework not yet converted using System; using System.IO; using System.Linq; @@ -94,15 +93,11 @@ internal static class Styles public static float s_DefaultLayoutMaxWidth => Styles.window.GetFloat("-unity-max-layout-width"); public SettingsWindow() - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced : this(SettingsScope.Project) - #pragma warning restore UAL0015 { } - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced public SettingsWindow(SettingsScope scope) - #pragma warning restore UAL0015 { m_Scope = scope; titleContent.text = scope == SettingsScope.Project ? "Project Settings" : "Preferences"; @@ -125,8 +120,8 @@ public void AddItemsToMenu(GenericMenu menu) { if (Unsupported.IsDeveloperMode()) { - menu.AddItem(EditorGUIUtility.TrTextContent("Print Provider Keywords"), false, PrintProviderKeywords); - menu.AddItem(EditorGUIUtility.TrTextContent("Refresh providers"), false, OnSettingsProviderChanged); + menu.AddItem(L10n.TextContent("Print Provider Keywords", null, null, null), false, PrintProviderKeywords); + menu.AddItem(L10n.TextContent("Refresh providers", null, null, null), false, OnSettingsProviderChanged); } } @@ -746,9 +741,7 @@ protected override void CloseScope() internal class ProjectSettingsWindow : SettingsWindow { public ProjectSettingsWindow() - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced : base(SettingsScope.Project) - #pragma warning restore UAL0015 { } } @@ -756,11 +749,8 @@ public ProjectSettingsWindow() internal class PreferenceSettingsWindow : SettingsWindow { public PreferenceSettingsWindow() - #pragma warning disable UAL0015 // this side effect does not outlive the current call (global trigger / lazily-loaded asset re-fetched on next access); a stale reference is harmlessly replaced : base(SettingsScope.User) - #pragma warning restore UAL0015 { } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/SettingsWindow/FogEditor.cs b/Editor/Mono/SettingsWindow/FogEditor.cs index c2bb22b73e..ac38d0b9ff 100644 --- a/Editor/Mono/SettingsWindow/FogEditor.cs +++ b/Editor/Mono/SettingsWindow/FogEditor.cs @@ -11,13 +11,13 @@ internal class FogEditor : Editor { internal class Styles { - public static readonly GUIContent FogWarning = EditorGUIUtility.TrTextContent("Fog has no effect on opaque objects when using Deferred Shading rendering. Use the Global Fog image effect instead, which supports opaque objects."); - public static readonly GUIContent FogDensity = EditorGUIUtility.TrTextContent("Density", "Controls the density of the fog effect in the Scene when using Exponential or Exponential Squared modes."); - public static readonly GUIContent FogLinearStart = EditorGUIUtility.TrTextContent("Start", "Controls the distance from the camera where the fog will start in the Scene."); - public static readonly GUIContent FogLinearEnd = EditorGUIUtility.TrTextContent("End", "Controls the distance from the camera where the fog will completely obscure objects in the Scene."); - public static readonly GUIContent FogEnable = EditorGUIUtility.TrTextContent("Fog", "Specifies whether fog is used in the Scene or not."); - public static readonly GUIContent FogColor = EditorGUIUtility.TrTextContent("Color", "Controls the color of the fog drawn in the Scene."); - public static readonly GUIContent FogMode = EditorGUIUtility.TrTextContent("Mode", "Controls the mathematical function determining the way fog accumulates with distance from the camera. Options are Linear, Exponential, and Exponential Squared."); + public static readonly GUIContent FogWarning = L10n.TextContent("Fog has no effect on opaque objects when using Deferred Shading rendering. Use the Global Fog image effect instead, which supports opaque objects.", null, null, null); + public static readonly GUIContent FogDensity = L10n.TextContent("Density", "Controls the density of the fog effect in the Scene when using Exponential or Exponential Squared modes.", null, null); + public static readonly GUIContent FogLinearStart = L10n.TextContent("Start", "Controls the distance from the camera where the fog will start in the Scene.", null, null); + public static readonly GUIContent FogLinearEnd = L10n.TextContent("End", "Controls the distance from the camera where the fog will completely obscure objects in the Scene.", null, null); + public static readonly GUIContent FogEnable = L10n.TextContent("Fog", "Specifies whether fog is used in the Scene or not.", null, null); + public static readonly GUIContent FogColor = L10n.TextContent("Color", "Controls the color of the fog drawn in the Scene.", null, null); + public static readonly GUIContent FogMode = L10n.TextContent("Mode", "Controls the mathematical function determining the way fog accumulates with distance from the camera. Options are Linear, Exponential, and Exponential Squared.", null, null); } protected SerializedProperty m_Fog; diff --git a/Editor/Mono/SettingsWindow/LightingEditor.cs b/Editor/Mono/SettingsWindow/LightingEditor.cs index 47309a80a8..0ec3bf4cf1 100644 --- a/Editor/Mono/SettingsWindow/LightingEditor.cs +++ b/Editor/Mono/SettingsWindow/LightingEditor.cs @@ -23,33 +23,33 @@ internal static class Styles { static Styles() {} - public static readonly GUIContent env_top = EditorGUIUtility.TrTextContent("Environment"); - public static readonly GUIContent env_skybox_mat = EditorGUIUtility.TrTextContent("Skybox Material", "Specifies the material that is used to simulate the sky or other distant background in the Scene."); - public static readonly GUIContent env_skybox_sun = EditorGUIUtility.TrTextContent("Sun Source", "Specifies the directional light that is used to indicate the direction of the sun when a procedural skybox is used. If set to None, the brightest directional light in the Scene is used to represent the sun."); - public static readonly GUIContent env_amb_top = EditorGUIUtility.TrTextContent("Environment Lighting"); - public static readonly GUIContent env_amb_src = EditorGUIUtility.TrTextContent("Source", "Specifies whether to use a skybox, gradient, or color for ambient light contributed to the Scene."); - public static readonly GUIContent env_amb_int = EditorGUIUtility.TrTextContent("Intensity Multiplier", "Controls the brightness of the skybox lighting in the Scene."); - public static readonly GUIContent env_refl_top = EditorGUIUtility.TrTextContent("Environment Reflections"); - public static readonly GUIContent env_refl_src = EditorGUIUtility.TrTextContent("Source", "Specifies whether to use the skybox or a custom cube map for reflection effects in the Scene."); - public static readonly GUIContent env_refl_res = EditorGUIUtility.TrTextContent("Resolution", "Controls the resolution for the cube map assigned to the skybox material for reflection effects in the Scene."); - public static readonly GUIContent env_refl_cmp = EditorGUIUtility.TrTextContent("Compression", "Controls how Unity compresses the reflection cube maps. Options are Auto, Compressed, and Uncompressed. Auto compresses the cube maps if the compression format is suitable."); - public static readonly GUIContent env_refl_int = EditorGUIUtility.TrTextContent("Intensity Multiplier", "Controls how much the skybox or custom cubemap affects reflections in the Scene. A value of 1 produces physically correct results."); - public static readonly GUIContent env_refl_bnc = EditorGUIUtility.TrTextContent("Bounces", "Controls how many times a reflection includes other reflections. A value of 1 results in the Scene being rendered once so mirrored reflections will be black. A value of 2 results in mirrored reflections being visible in the Scene."); - public static readonly GUIContent skyboxWarning = EditorGUIUtility.TrTextContent("Shader of this material does not support skybox rendering."); - public static readonly GUIContent createLight = EditorGUIUtility.TrTextContent("Create Light"); - public static readonly GUIContent ambientUp = EditorGUIUtility.TrTextContent("Sky Color", "Controls the color of light emitted from the sky in the Scene."); - public static readonly GUIContent ambientMid = EditorGUIUtility.TrTextContent("Equator Color", "Controls the color of light emitted from the sides of the Scene."); - public static readonly GUIContent ambientDown = EditorGUIUtility.TrTextContent("Ground Color", "Controls the color of light emitted from the ground of the Scene."); - public static readonly GUIContent ambient = EditorGUIUtility.TrTextContent("Ambient Color", "Controls the color of the ambient light contributed to the Scene."); - public static readonly GUIContent customReflection = EditorGUIUtility.TrTextContent("Cubemap", "Specifies the custom cube map used for reflection effects in the Scene."); - public static readonly GUIContent unusedCustomReflectionWarning = EditorGUIUtility.TrTextContent("A custom cubemap is still assigned and included in builds, even though Source is set to Skybox. To remove it, set Source to Custom and clear the Cubemap field."); - public static readonly GUIContent SubtractiveColor = EditorGUIUtility.TrTextContent("Realtime Shadow Color", "The color used for mixing realtime shadows with baked lightmaps in Subtractive lighting mode. The color defines the darkest point of the realtime shadow."); + public static readonly GUIContent env_top = L10n.TextContent("Environment", null, null, null); + public static readonly GUIContent env_skybox_mat = L10n.TextContent("Skybox Material", "Specifies the material that is used to simulate the sky or other distant background in the Scene.", null, null); + public static readonly GUIContent env_skybox_sun = L10n.TextContent("Sun Source", "Specifies the directional light that is used to indicate the direction of the sun when a procedural skybox is used. If set to None, the brightest directional light in the Scene is used to represent the sun.", null, null); + public static readonly GUIContent env_amb_top = L10n.TextContent("Environment Lighting", null, null, null); + public static readonly GUIContent env_amb_src = L10n.TextContent("Source", "Specifies whether to use a skybox, gradient, or color for ambient light contributed to the Scene.", null, null); + public static readonly GUIContent env_amb_int = L10n.TextContent("Intensity Multiplier", "Controls the brightness of the skybox lighting in the Scene.", null, null); + public static readonly GUIContent env_refl_top = L10n.TextContent("Environment Reflections", null, null, null); + public static readonly GUIContent env_refl_src = L10n.TextContent("Source", "Specifies whether to use the skybox or a custom cube map for reflection effects in the Scene.", null, null); + public static readonly GUIContent env_refl_res = L10n.TextContent("Resolution", "Controls the resolution for the cube map assigned to the skybox material for reflection effects in the Scene.", null, null); + public static readonly GUIContent env_refl_cmp = L10n.TextContent("Compression", "Controls how Unity compresses the reflection cube maps. Options are Auto, Compressed, and Uncompressed. Auto compresses the cube maps if the compression format is suitable.", null, null); + public static readonly GUIContent env_refl_int = L10n.TextContent("Intensity Multiplier", "Controls how much the skybox or custom cubemap affects reflections in the Scene. A value of 1 produces physically correct results.", null, null); + public static readonly GUIContent env_refl_bnc = L10n.TextContent("Bounces", "Controls how many times a reflection includes other reflections. A value of 1 results in the Scene being rendered once so mirrored reflections will be black. A value of 2 results in mirrored reflections being visible in the Scene.", null, null); + public static readonly GUIContent skyboxWarning = L10n.TextContent("Shader of this material does not support skybox rendering.", null, null, null); + public static readonly GUIContent createLight = L10n.TextContent("Create Light", null, null, null); + public static readonly GUIContent ambientUp = L10n.TextContent("Sky Color", "Controls the color of light emitted from the sky in the Scene.", null, null); + public static readonly GUIContent ambientMid = L10n.TextContent("Equator Color", "Controls the color of light emitted from the sides of the Scene.", null, null); + public static readonly GUIContent ambientDown = L10n.TextContent("Ground Color", "Controls the color of light emitted from the ground of the Scene.", null, null); + public static readonly GUIContent ambient = L10n.TextContent("Ambient Color", "Controls the color of the ambient light contributed to the Scene.", null, null); + public static readonly GUIContent customReflection = L10n.TextContent("Cubemap", "Specifies the custom cube map used for reflection effects in the Scene.", null, null); + public static readonly GUIContent unusedCustomReflectionWarning = L10n.TextContent("A custom cubemap is still assigned and included in builds, even though Source is set to Skybox. To remove it, set Source to Custom and clear the Cubemap field.", null, null, null); + public static readonly GUIContent SubtractiveColor = L10n.TextContent("Realtime Shadow Color", "The color used for mixing realtime shadows with baked lightmaps in Subtractive lighting mode. The color defines the darkest point of the realtime shadow.", null, null); public static readonly GUIContent[] kFullAmbientSource = { - EditorGUIUtility.TrTextContent("Skybox"), - EditorGUIUtility.TrTextContent("Gradient"), - EditorGUIUtility.TrTextContent("Color"), + L10n.TextContent("Skybox", null, null, null), + L10n.TextContent("Gradient", null, null, null), + L10n.TextContent("Color", null, null, null), }; public static readonly int[] kFullAmbientSourceValues = { (int)AmbientMode.Skybox, (int)AmbientMode.Trilight, (int)AmbientMode.Flat }; diff --git a/Editor/Mono/SettingsWindow/OtherRenderingEditor.cs b/Editor/Mono/SettingsWindow/OtherRenderingEditor.cs index 88b758d3ea..d6a5e6ef9d 100644 --- a/Editor/Mono/SettingsWindow/OtherRenderingEditor.cs +++ b/Editor/Mono/SettingsWindow/OtherRenderingEditor.cs @@ -11,11 +11,11 @@ internal class OtherRenderingEditor : Editor { internal static class Styles { - public static readonly GUIContent HaloStrength = EditorGUIUtility.TrTextContent("Halo Strength", "Controls the visibility of the halo effect around lights in the Scene."); - public static readonly GUIContent HaloTexture = EditorGUIUtility.TrTextContent("Halo Texture", "Specifies the Texture used when drawing the halo effect around lights in the Scene"); - public static readonly GUIContent FlareStrength = EditorGUIUtility.TrTextContent("Flare Strength", "Controls the visibility of lens flares from lights in the Scene."); - public static readonly GUIContent FlareFadeSpeed = EditorGUIUtility.TrTextContent("Flare Fade Speed", "Controls the time over which lens flares fade from view after initially appearing."); - public static readonly GUIContent SpotCookie = EditorGUIUtility.TrTextContent("Spot Cookie", "Specifies the Texture mask used to cast shadows, create silhouettes, or patterned illumination when using spot lights."); + public static readonly GUIContent HaloStrength = L10n.TextContent("Halo Strength", "Controls the visibility of the halo effect around lights in the Scene.", null, null); + public static readonly GUIContent HaloTexture = L10n.TextContent("Halo Texture", "Specifies the Texture used when drawing the halo effect around lights in the Scene", null, null); + public static readonly GUIContent FlareStrength = L10n.TextContent("Flare Strength", "Controls the visibility of lens flares from lights in the Scene.", null, null); + public static readonly GUIContent FlareFadeSpeed = L10n.TextContent("Flare Fade Speed", "Controls the time over which lens flares fade from view after initially appearing.", null, null); + public static readonly GUIContent SpotCookie = L10n.TextContent("Spot Cookie", "Specifies the Texture mask used to cast shadows, create silhouettes, or patterned illumination when using spot lights.", null, null); } protected SerializedProperty m_HaloStrength; diff --git a/Editor/Mono/Shaders/MaterialHierarchyPopup.cs b/Editor/Mono/Shaders/MaterialHierarchyPopup.cs index bfdf7a08e7..4a450ccc04 100644 --- a/Editor/Mono/Shaders/MaterialHierarchyPopup.cs +++ b/Editor/Mono/Shaders/MaterialHierarchyPopup.cs @@ -2,7 +2,6 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License -#pragma warning disable UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 // AutoStaticsCleanup usage analysis: ShaderSystem not yet converted using System.Collections.Generic; using UnityEngine; using UnityEditorInternal; @@ -81,20 +80,20 @@ public static class Colors public static class Styles { - public static readonly GUIContent rootLabel = EditorGUIUtility.TrTextContent("Root", "The root of the hierarchy."); - public static readonly GUIContent selectedLabel = EditorGUIUtility.TrTextContent("Current", "The currently selected Material."); + public static readonly GUIContent rootLabel = L10n.TextContent("Root", "The root of the hierarchy.", null, null); + public static readonly GUIContent selectedLabel = L10n.TextContent("Current", "The currently selected Material.", null, null); - public static readonly GUIContent instanceLabel = EditorGUIUtility.TrTextContent("Variant Family of"); - public static readonly GUIContent ancestorLabel = EditorGUIUtility.TrTextContent("Ancestors"); - public static readonly GUIContent overridesLabel = EditorGUIUtility.TrTextContent("Overrides"); - public static readonly GUIContent locksLabel = EditorGUIUtility.TrTextContent("Locks"); - public static readonly GUIContent childrenLabel = EditorGUIUtility.TrTextContent("Children"); - public static readonly GUIContent noResultsLabel = EditorGUIUtility.TrTextContent("No results"); - public static readonly GUIContent noChildrenLabel = EditorGUIUtility.TrTextContent("This Material doesn't have any children.\nMaterial Variants created from this Material\nwill be listed here."); + public static readonly GUIContent instanceLabel = L10n.TextContent("Variant Family of", null, null, null); + public static readonly GUIContent ancestorLabel = L10n.TextContent("Ancestors", null, null, null); + public static readonly GUIContent overridesLabel = L10n.TextContent("Overrides", null, null, null); + public static readonly GUIContent locksLabel = L10n.TextContent("Locks", null, null, null); + public static readonly GUIContent childrenLabel = L10n.TextContent("Children", null, null, null); + public static readonly GUIContent noResultsLabel = L10n.TextContent("No results", null, null, null); + public static readonly GUIContent noChildrenLabel = L10n.TextContent("This Material doesn't have any children.\nMaterial Variants created from this Material\nwill be listed here.", null, null, null); public static readonly string[] headerPopupOptions = new string[] { "Material", "Material Variant" }; - public static readonly GUIContent convertingLabel = EditorGUIUtility.TrTextContent("Converting to Material Variant"); - public static readonly GUIContent conversionHelpLabel = EditorGUIUtility.TrTextContent("To convert, select a Parent Material"); + public static readonly GUIContent convertingLabel = L10n.TextContent("Converting to Material Variant", null, null, null); + public static readonly GUIContent conversionHelpLabel = L10n.TextContent("To convert, select a Parent Material", null, null, null); public static readonly GUIStyle searchBackground = new GUIStyle("ProjectBrowserIconAreaBg"); public static readonly GUIStyle centered = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleCenter }; @@ -594,4 +593,3 @@ void DoObjectLabel(Rect rect, Object entry, GUIStyle style) } } } -#pragma warning restore UAL0015,UAL0018,UAL0019,UAL0020,UAL0021 diff --git a/Editor/Mono/Shaders/ShaderBuildSettings.cs b/Editor/Mono/Shaders/ShaderBuildSettings.cs index 00e2da3c4b..066e8f13f5 100644 --- a/Editor/Mono/Shaders/ShaderBuildSettings.cs +++ b/Editor/Mono/Shaders/ShaderBuildSettings.cs @@ -44,6 +44,13 @@ internal enum ShaderOptimizationLevel High } + [UsedByNativeCode] + internal enum FastBuildMode + { + Off, + On + } + internal static bool IsEmptyKeyword(string keyword) { if (keyword.Length == 0) @@ -236,6 +243,16 @@ internal bool ValueEquals(KeywordDeclarationOverride other) return ArrayValuesEqual(keywords, other.keywords, static (a, b) => a.ValueEquals(b)); } + // Copying the struct alone still shares the keywords array. This does a deep copy instead. + internal KeywordDeclarationOverride DeepCopy() + { + return new KeywordDeclarationOverride + { + keywords = keywords == null ? null : (KeywordOverrideInfo[])keywords.Clone(), + variantGenerationMode = variantGenerationMode, + }; + } + [SerializeField] public KeywordOverrideInfo[] keywords = Array.Empty(); [SerializeField] public ShaderVariantGenerationMode variantGenerationMode = ShaderVariantGenerationMode.Default; @@ -348,8 +365,10 @@ public KeywordDeclarationOverride[] GetKeywordDeclarationOverridesCopy() return (KeywordDeclarationOverride[])keywordDeclarationOverrides.Clone(); } + [SerializeField] internal FastBuildMode fastBuildMode = FastBuildMode.Off; + [SerializeField] internal string[] defines = Array.Empty(); - [SerializeField] private uint numInternalDefines = 0; + [SerializeField] internal uint numInternalDefines = 0; internal string[] GetAllDefinesCopy() { @@ -366,6 +385,9 @@ internal bool ValueEquals(ShaderBuildSettings other) if (numInternalDefines != other.numInternalDefines) return false; + if (fastBuildMode != other.fastBuildMode) + return false; + if (!ArrayValuesEqual(defines, other.defines, static (a, b) => a == b)) return false; @@ -389,6 +411,47 @@ internal void AddInternalDefine(string define) numInternalDefines++; } + internal bool HasInternalDefine(string identifier) + { + for (int i = 0; i < numInternalDefines; ++i) + { + if (DefineHasIdentifier(defines[i], identifier)) + return true; + } + + return false; + } + + // Returns true when a define was removed. + internal bool RemoveInternalDefine(string identifier) + { + for (int i = 0; i < numInternalDefines; ++i) + { + if (!DefineHasIdentifier(defines[i], identifier)) + continue; + + // Internal defines stay at the start of the array, which GetDefinesCopy and the setter both rely on. + var remaining = new string[defines.Length - 1]; + Array.Copy(defines, 0, remaining, 0, i); + Array.Copy(defines, i + 1, remaining, i, defines.Length - i - 1); + + defines = remaining; + numInternalDefines--; + return true; + } + + return false; + } + + static bool DefineHasIdentifier(string define, string identifier) + { + if (define == null) + return false; + + var sections = define.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); + return sections.Length > 0 && sections[0] == identifier; + } + internal static bool SplitAndValidateDefine(string define, out string identifier, out string value, out string msg) { identifier = ""; diff --git a/Editor/Mono/Shaders/ShaderBuildSettingsUI.cs b/Editor/Mono/Shaders/ShaderBuildSettingsUI.cs index 93af0c3ed2..b16693c7ab 100644 --- a/Editor/Mono/Shaders/ShaderBuildSettingsUI.cs +++ b/Editor/Mono/Shaders/ShaderBuildSettingsUI.cs @@ -17,7 +17,6 @@ internal class ShaderBuildSettingsUI private List m_ConstantDefines = new(); private List m_InternalConstantDefines = new(); private List m_CompilerBackendSettings = new(); - private bool[] m_LoadedItemInitialized = Array.Empty(); private SerializedObject m_SettingsDataStore = null; private SerializedProperty m_SettingsProperty = null; private bool m_IsTargetingBuildProfile = false; @@ -47,6 +46,16 @@ internal class ShaderBuildSettingsUI private VisualTreeAsset m_ConstantDefineUXML; private VisualTreeAsset m_CompilerBackendRowUXML; + private VisualElement m_FastBuildSettings; + private DropdownField m_FastBuildDropdown; + private Label m_ActiveModeLabel; + private HelpBox m_FastBuildInfoBox; + private bool m_AppliedFastBuildEnabled; + private Func m_KeywordDeclarationSource = ShaderKeywordDeclarations.GatherFromProject; + private bool m_FastBuildEnabled; + // Shown in place of the settings data while Fast Build is on. Never saved; see BuildFastBuildDisplayedOverrides. + private readonly List m_FastBuildDisplayedOverrides = new(); + private static string CompilerDisplayName(ShaderBuildSettings.ShaderCompilerToolchain compiler) { switch (compiler) @@ -80,7 +89,7 @@ private static string CompilerTooltip(ShaderBuildSettings.ShaderCompilerToolchai } } - public bool HasUnsavedChanges => m_HasUnsavedChanges; + public bool HasUnsavedChanges => m_HasUnsavedChanges || m_FastBuildEnabled != m_AppliedFastBuildEnabled; public void Initialize(VisualElement root, SerializedObject settingsDataStore, bool isTargetingBuildProfile) { @@ -153,6 +162,7 @@ public void Initialize(VisualElement root, SerializedObject settingsDataStore, b } SetupDebugOptControls(shaderBuildSettingsUI); + SetupFastBuildControls(shaderBuildSettingsUI); m_ApplyButton = shaderBuildSettingsUI.Q