From 4225f971be6db12e1f9c35de77f441a2307ff415 Mon Sep 17 00:00:00 2001 From: Unity Technologies Date: Thu, 5 Mar 2026 10:01:52 +0000 Subject: [PATCH 01/24] Unity 6000.5.0a8 C# reference source code --- .../Animation/AnimationWindow/AnimEditor.cs | 2 +- .../AnimationWindow/AnimationWindowState.cs | 4 +- .../AnimationWindow/CurveEditorSettings.cs | 2 + .../RotationCurveInterpolation.cs | 40 +- Editor/Mono/Animation/TickStyle.cs | 1 - .../SpeedTree/SpeedTreeImporterOutputData.cs | 2 + .../SpeedTree/SpeedTreeImporterSettings.cs | 2 + .../Mixer/Bindings/AudioMixerController.cs | 1 + .../Audio/Mixer/GUI/AudioMixerSelection.cs | 4 +- .../BuildPipeline/BuildPipeline.bindings.cs | 3 +- .../BuildPipeline/BuildPipelineInterfaces.cs | 7 +- .../BuildTargetDiscovery.bindings.cs | 116 +- Editor/Mono/BuildPipeline/NamedBuildTarget.cs | 5 +- .../BuildPipeline/PostprocessBuildPlayer.cs | 4 +- .../Settings/BuildPlayerOptions.bindings.cs | 7 + .../Mono/BuildProfile/BuildProfileContext.cs | 44 +- .../BuildProfileGraphicsSettings.cs | 83 + .../BuildProfileGraphicsSettingsEditor.cs | 9 +- .../BuildProfile/BuildProfileModuleUtil.cs | 18 +- Editor/Mono/Clipboard/Clipboard.cs | 21 + Editor/Mono/Clipboard/ClipboardContextMenu.cs | 6 + Editor/Mono/Clipboard/ClipboardParser.cs | 19 + Editor/Mono/Clipboard/ClipboardState.cs | 12 + .../CodeEditor/DefaultExternalCodeEditor.cs | 4 +- Editor/Mono/ContainerWindow.cs | 2 +- Editor/Mono/EditorGUI.cs | 24 + Editor/Mono/EditorResources.cs | 6 +- Editor/Mono/EditorSceneManager.bindings.cs | 3 +- Editor/Mono/GUI/AnimatedValues.cs | 2 + Editor/Mono/GUI/LoadableReferenceDrawer.cs | 129 -- Editor/Mono/GUI/PackageExportTreeView.cs | 6 +- Editor/Mono/GUI/PackageImportTreeView.cs | 6 +- Editor/Mono/GUI/TreeView/MultiColumnHeader.cs | 2 - .../TreeViewTests/TreeViewTestDragging.cs | 4 +- Editor/Mono/GUI/TreeView/TreeViewUtililty.cs | 3 +- .../Mono/GUIDebugger/StyleDrawInspectView.cs | 2 + .../GraphicsStateCollectionSettingsUI.cs | 77 + .../TextureImportPlatformSettings.cs | 20 +- .../TextureImporterInspector.cs | 2 +- Editor/Mono/Inspector/CameraEditorUtils.cs | 14 +- .../AddComponent/NewScriptDropdownItem.cs | 3 - .../AdvancedDropdown/AdvancedDropdownGUI.cs | 56 + .../AdvancedDropdown/AdvancedDropdownItem.cs | 21 + .../AdvancedDropdownWindow.cs | 4 + Editor/Mono/Inspector/Core/PropertyEditor.cs | 5 +- .../Core/Utils/InspectorWindowUtils.cs | 21 +- .../Core/Utils/ObsoleteMessageHelper.cs | 23 + Editor/Mono/Inspector/Editor.cs | 3 +- .../Inspector/GraphicsSettingsInspector.cs | 85 +- Editor/Mono/Inspector/LightEditor.cs | 6 +- .../Inspector/LightProbeProxyVolumeEditor.cs | 1 + Editor/Mono/Inspector/MaterialEditor.cs | 236 ++- .../PlayerSettingsEditor.cs | 13 +- .../PlayerSettingsIconsEditor.cs | 37 +- .../Mono/Inspector/QualitySettingsEditor.cs | 59 +- Editor/Mono/Inspector/RectTransformEditor.cs | 4 +- Editor/Mono/Inspector/RendererEditorBase.cs | 2 + .../Inspector/SpeedTreeMaterialInspector.cs | 4 - .../VisualElements/ObjectFieldWithPrompt.cs | 29 + Editor/Mono/InternalEditorUtility.bindings.cs | 4 - Editor/Mono/Menu.bindings.cs | 1 + .../Mono/Modules/PlatformSDK/PlatformSDK.cs | 39 + Editor/Mono/ObjectSelector.cs | 25 +- Editor/Mono/Overlays/OverlayCanvas.cs | 12 +- .../Mono/Overlays/OverlayPreferencesState.cs | 18 +- Editor/Mono/Overlays/OverlayUtilities.cs | 17 +- Editor/Mono/PlayerSettings.bindings.cs | 10 + Editor/Mono/PlayerSettingsWSA.bindings.cs | 6 +- Editor/Mono/Prefabs/PrefabReplaceUtility.cs | 4 +- .../Prefabs/PropertyModification.bindings.cs | 11 + .../PreferencesSettingsProviders.cs | 19 +- Editor/Mono/ProjectBrowser/ProjectBrowser.cs | 16 +- .../Mono/ProjectBrowser/ProjectWindowUtil.cs | 4 + Editor/Mono/SceneManagement/SceneSetup.cs | 9 + .../StageManager/MainStageHierarchyState.cs | 4 +- .../DefaultLightingExplorerExtension.cs | 5 +- .../LightingExplorerWindow.cs | 1 + .../SceneModeWindows/LightmapPreviewWindow.cs | 23 +- Editor/Mono/SceneView/SceneView.cs | 11 +- .../APIUpdater/AssemblyDependencyGraph.cs | 3 +- .../PotentiallyUpdatableErrorMessages.cs | 1 + .../BeeDriver/UnityScriptUpdater.cs | 4 +- .../ScriptCompilation/CompilationPipeline.cs | 4 +- .../ScriptCompilation/CustomScriptAssembly.cs | 6 +- .../ScriptCompilation/EditorCompilation.cs | 3 +- .../MsBuild/MsBuildCompilation.cs | 2 +- .../ScriptCompilation/RoslynAnalyzers.cs | 4 +- Editor/Mono/Selection/Selection.bindings.cs | 2 +- Editor/Mono/SerializationDebug.bindings.cs | 4 + Editor/Mono/SerializedObject.bindings.cs | 1 + Editor/Mono/SerializedProperty.bindings.cs | 36 +- .../SerializedPropertyTreeView.cs | 1 + Editor/Mono/Text/EditorTextSettings.cs | 4 + Editor/Mono/Tools/EditorToolManager.cs | 9 +- .../UIElements/BaseLiveReloadAssetTracker.cs | 38 +- Editor/Mono/UIElements/Controls/ColorField.cs | 14 +- .../Controls/LoadableReferenceField.cs | 93 + .../Mono/UIElements/Controls/ObjectField.cs | 26 +- .../Mono/UIElements/Controls/PropertyField.cs | 5 + .../UIElements/UIElementsEditorUtility.cs | 28 +- .../Services/ServicesConfiguration.cs | 2 +- Editor/Mono/Utils/Paths.cs | 3 +- Editor/Mono/View.cs | 1 - External/NVUnityPlugin/Scripts/NVCommands.cs | 4 +- External/NiceIO/NiceIO.cs | 2 +- .../CodeGen/ClassAutoCleanup.cs | 10 +- .../CodeInitializedScope.cs | 4 +- .../LifecycleManagement/CodeLoadedScope.cs | 4 +- .../LifecycleManagement/LifecycleScopeBase.cs | 7 +- .../StaticsCleanupAttributes.cs | 22 +- .../Indexer/AdaptivePerformanceIndexer.cs | 129 +- .../IAdaptivePerformanceSettings.cs | 2 +- ...daptivePerformanceGeneralBuildProcessor.cs | 6 + ...anceGeneralSettingsPerBuildTargetEditor.cs | 15 + .../AdaptivePerformanceSettingsManager.cs | 6 +- .../Management/EditorUtilities.cs | 49 +- .../AdaptivePerformanceKnownPackages.cs | 31 +- ...ildProfileAdaptivePerformanceProviderUI.cs | 2 + .../BuildProfileAdaptivePerformanceToggle.cs | 2 + .../AndroidJNI/AndroidAssetPacks.bindings.cs | 57 + .../V2/Managed/ArtifactInfo.deprecated.cs | 2 +- .../Editor/V2/Managed/ImportActivityWindow.cs | 3 +- .../ImportSettings/AssetImporterEditor.cs | 5 +- .../AssetImporterTabbedEditor.cs | 2 +- .../ImportSettings/AudioImporterInspector.cs | 6 + .../ImportSettings/PluginImporterInspector.cs | 7 +- .../ScriptBindings/SampleProvider.bindings.cs | 18 + .../Public/ScriptBindings/Audio.bindings.cs | 59 +- .../ScriptableGenerator.bindings.cs | 18 + .../BuildProfileEditor/BuildProfileWindow.cs | 5 +- .../Elements/BuildProfileCard.cs | 21 + .../PlatformDiscoveryWindow.cs | 32 + Modules/BuildProfileEditor/TrText.cs | 2 + .../Managed/BuildReportRestService.cs | 4 + .../Managed/StrippingInfo.cs | 6 +- ...indings.cs => ContentManifest.bindings.cs} | 2 +- .../Managed/NativeLoadingSystem.bindings.cs | 103 + Modules/ContentLoadEditor/LoadableDrawer.cs | 81 +- .../DeviceInfo/DeviceInfoAsset.cs | 2 + .../DeviceInfo/DeviceInfoImporter.cs | 6 +- .../DeviceInfo/DeviceLoader.cs | 22 +- .../DeviceSimulatorEditor/SimulatorState.cs | 2 + .../Controls/AIDropdownContent.cs | 1 - .../ToolbarElements/OverlayMenu.cs | 2 +- .../TypeSystem/BuiltInTypeHandles.cs | 4 +- .../GraphToolkit/TypeSystem/TypeHandle.cs | 6 +- .../TypeSystem/TypeHandleHelpers.cs | 5 +- .../ToolState/UndoStateRecorder.cs | 23 + .../EditorCommon/GraphToolkitAnalytics.cs | 53 + .../EditorCommon/Utility/AssemblyCache.cs | 3 +- .../VariableNodeGraphProcessor.cs | 3 +- .../ItemLibrary/UI/LibraryTreeView.cs | 18 +- .../Blackboard/BlackboardContentModel.cs | 1 + .../Model/BasicModel/ContextNodeModel.cs | 19 +- .../ExternalVariableDeclarationModelBase.cs | 1 + .../Model/BasicModel/GraphModel.cs | 5 +- .../Model/BasicModel/NodeModel.cs | 43 +- .../Model/BasicModel/PortModel.cs | 26 +- .../Model/BasicModel/SubgraphNodeModel.cs | 12 +- .../Model/BasicModel/WirePortalModel.cs | 3 + .../GraphToolkitEditor/Model/GraphObject.cs | 5 + .../Model/TypeExtensions.cs | 13 + .../UI/Actions/DeleteAndReconnectAction.cs | 10 +- .../Blackboard/ModelView/BlackboardField.cs | 20 +- .../GraphView/ModelView/CapsuleNodeView.cs | 92 +- .../ModelView/ConstantCollectionNodeView.cs | 19 + .../ModelView/Context/BlockDragInfos.cs | 4 +- .../ModelView/Context/BlockNodeView.cs | 80 +- .../UI/ModelView/GraphView/ModelView/Port.cs | 23 +- .../GraphView/ModelView/VariableNodeView.cs | 9 +- .../CapsuleNodePortContainerPart.cs | 131 ++ .../Node/ConstantCollectionNodeTitlePart.cs | 2 +- .../ModelViewParts/Node/NodeTitlePart.cs | 7 +- .../ModelViewParts/PortConnectorPart.cs | 17 + .../PortConnectorWithIconPart.cs | 22 +- .../UIElements/PortHierarchyContainer.cs | 13 +- .../GraphElementTitlePropertyField.cs | 23 + .../TransitionSupportEditor.cs | 6 +- .../Variables/VariableFieldsInspector.cs | 4 +- .../UI/Utils/SubgraphCreationHelper.cs | 74 +- .../UI/Utils/TypeHandleInfos.cs | 4 +- .../UI/Views/GraphView/GraphView.cs | 4 +- .../Windows/WindowAssetModificationWatcher.cs | 51 +- .../GraphToolkitPublic/Graph/Graph.cs | 93 +- .../Implementation/GraphModelImp.cs | 90 +- .../Implementation/Nodes/PortModelImp.cs | 14 - .../Nodes/UserNodes/UserBlockNodeModelImp.cs | 6 +- .../UserNodes/UserContextNodeModelImp.cs | 63 +- .../Nodes/UserNodes/UserNodeModelImp.cs | 13 +- .../GraphToolkitPublic/Node/ContextNode.cs | 106 +- .../Node/Internal/Node_Internal.cs | 10 +- .../GraphViewEditor/Elements/GroupDropArea.cs | 12 +- .../Elements/Placemat/Placemat.cs | 4 +- Modules/GraphViewEditor/Elements/Scope.cs | 29 +- Modules/GraphViewEditor/IconBadge.cs | 51 +- .../Manipulators/SelectionDragger.cs | 4 +- .../GraphViewEditor/NodeSearch/SearchTree.cs | 4 + .../Windows/GraphViewTemplateCustomIndexer.cs | 15 +- .../Windows/GraphViewTemplateWindow.cs | 63 +- Modules/GridAndSnap/SnapSettingsWindow.cs | 20 +- .../Hierarchy/Managed/HierarchyExtensions.cs | 40 +- .../Managed/HierarchyNodeTypeHandler.cs | 41 +- .../HierarchyNodeTypeHandlerEnumerable.cs | 14 +- Modules/Hierarchy/Managed/HierarchyView.cs | 202 +- .../Managed/HierarchyViewColumnName.cs | 17 +- .../HierarchyViewDragAndDropHandlingData.cs | 22 +- .../HierarchyViewDragAndDropSetupData.cs | 12 +- .../Hierarchy/Managed/HierarchyViewItem.cs | 30 +- .../Managed/HierarchyViewItemContainer.cs | 38 +- .../Hierarchy/Managed/HierarchyViewState.cs | 52 +- .../Managed/IHierarchyEntityIdConverter.cs | 3 - Modules/IMGUI/ATGIMGUITextHandle.cs | 97 +- Modules/IMGUI/RuntimeTextSettings.cs | 14 - .../Editor/InAppPurchasingAnalytics.cs | 39 - .../Editor/InAppPurchasingInstaller.cs | 122 -- .../Editor/InAppPurchasingMenuItem.cs | 63 - Modules/Input/AssemblyInfo.cs | 3 + Modules/Input/Private/Input.cs | 2 +- .../Input/Private/Managed/InputCommonTypes.cs | 25 + .../Input/Private/Managed/InputFocusEvent.cs | 56 + .../Editor/LevelPlayInstallAnalytics.cs | 39 - .../LevelPlay/Editor/LevelPlayInstaller.cs | 119 -- Modules/LevelPlay/Editor/LevelPlayMenuItem.cs | 66 - .../LightingSearchDataAccessors.cs | 315 ++-- .../LightingSearchExposureSettings.cs | 7 + .../LightingSearchQueryTreeNodeHandler.cs | 199 ++ .../LightingSearch/LightingSearchSelectors.cs | 3 - .../LightingSearchSelectorsLight.cs | 4 + .../LightingSearchSelectorsScene.cs | 84 - .../LightingSearch/LightingSearchWindow.cs | 80 +- .../LightingSearch/LightmapSearchProvider.cs | 63 +- .../LightingSearch/LightmapTextureCache.cs | 53 +- Modules/Lighting/UITK/LightmapPreviewField.cs | 5 +- .../Marshalling/MarshallingTests.bindings.cs | 45 + .../Managed/Geometry/MinMaxAABB.cs | 12 +- Modules/Mathematics/Managed/svd.cs | 27 +- .../Managed/Common/ServiceSingleton.cs | 42 + .../Deprecated/InstanceDescription.cs | 2 +- .../OrchestratedScenario.deprecated.cs | 4 +- .../OrchestratedScenario/CustomAssetsData.cs | 123 ++ .../OrchestratedScenario/DecoratorItem.cs | 71 + .../OrchestratedScenario/InstanceItem.cs | 118 +- .../OrchestratedScenario.cs | 28 +- .../OrchestratedScenarioSettings.cs | 50 +- .../OrchestratedScenarioUserSettings.cs | 101 + .../PlayModeConfig/ScenarioFactory.cs | 46 +- .../UI/FilteredInstancesListProperty.cs | 4 +- .../PlayModeConfig/UI/InstanceItemDrawer.cs | 19 + .../UI/LocalPlayerSettingsDrawer.cs | 20 +- .../InstanceStatusElement.cs | 8 +- .../LocalPlayerInstanceStatusElement.cs | 6 +- .../PlaymodeStatusPopupContent.cs | 2 +- .../Scenarios/Debugging/NodeStatusElement.cs | 6 +- .../Scenarios/Debugging/StageStatusElement.cs | 4 +- .../Decorators/ExtensionsDatabase.cs | 106 ++ .../Decorators/InstanceControllerDecorator.cs | 57 + .../Decorators/InstanceExtensionManager.cs | 48 + .../FreeRunning/FreeRunningController.cs | 50 + .../GraphsFoundation/ExecutionGraph.cs | 38 +- .../{Node.cs => ExecutionNode.cs} | 9 +- .../GraphsFoundation/ExecutionStatusData.cs | 2 +- .../Scenarios/GraphsFoundation/Instance.cs | 18 +- .../Scenarios/GraphsFoundation/NodeInput.cs | 6 +- .../Scenarios/GraphsFoundation/NodeOutput.cs | 6 +- .../GraphsFoundation/NodeParameter.cs | 2 +- .../Scenarios/GraphsFoundation/Scenario.cs | 10 +- .../Instances/CloneEditorController.cs | 2 +- .../Scenarios/Instances/EditorController.cs | 5 +- .../Scenarios/Instances/InstanceController.cs | 55 +- .../Instances/LocalPlayerController.cs | 26 +- .../Instances/MainEditorController.cs | 2 +- .../Scenarios/Instances/PlayerController.cs | 5 +- .../Nodes/Editors/CloneEditorDeployNode.cs | 2 +- .../Nodes/Editors/CloneEditorRunNode.cs | 2 +- .../Nodes/Editors/MainEditorRunNode.cs | 2 +- .../Nodes/Editors/MainEditorStartNode.cs | 2 +- .../Scenarios/Nodes/Editors/OpenSceneNode.cs | 2 +- .../Editors/RestoreSceneManagerSetupNode.cs | 2 +- .../Editors/SetupEditorMultiplayerRoleNode.cs | 2 +- .../Nodes/Editors/SetupEditorTagsNode.cs | 2 +- .../Nodes/Local/Adb/AdbInstallNode.cs | 2 +- .../Nodes/Local/Adb/AdbLogcatNode.cs | 2 +- .../Nodes/Local/Adb/AdbMonitorProcessNode.cs | 2 +- .../Nodes/Local/Adb/AdbStartProcessNode.cs | 2 +- .../Nodes/Local/Adb/AdbStopProcessNode.cs | 2 +- .../Scenarios/Nodes/Local/BuildPlayerNode.cs | 2 +- .../Scenarios/Nodes/Local/DeleteFileNode.cs | 2 +- .../Nodes/Local/MonitorProcessNode.cs | 2 +- .../Scenarios/Nodes/Local/StartProcessNode.cs | 2 +- .../Scenarios/Nodes/Local/StopProcessNode.cs | 2 +- .../Nodes/Local/StreamLogsFromFileNode.cs | 2 +- .../Config/CommandLineParameters.cs | 20 +- .../Workflow/MultiplayerPlaymode.cs | 7 + .../WorkflowUI/MultiplayerWindow.cs | 2 +- .../Editor/Managed/Requests/Request.cs | 1 + .../Managed/Requests/Requests.bindings.cs | 2 + .../Editor/Extensions/ExtensionManager.cs | 22 +- .../External/EditorGameServiceExtension.cs | 6 +- .../PackageManagerFiltersAnalytics.cs | 8 +- .../Services/AssetStore/AssetStoreClientV2.cs | 29 +- .../AssetStore/AssetStoreDownloadManager.cs | 3 +- .../AssetStore/AssetStoreListOperation.cs | 14 +- .../AssetStore/AssetStorePackageVersion.cs | 2 +- .../AssetStore/AssetStorePurchases.cs | 62 +- .../Services/AssetStore/AssetStoreRestAPI.cs | 18 - .../Services/Common/BackgroundFetchHandler.cs | 26 +- .../Services/Common/BasePackageVersion.cs | 72 +- .../Services/Common/CollectionExtensions.cs | 18 +- .../Services/Common/DictionaryExtensions.cs | 7 +- .../Editor/Services/Common/Icon.cs | 2 + .../Editor/Services/Common/Package.cs | 4 +- .../Services/Common/PackageInfoExtension.cs | 6 + .../Services/Common/PackageManagerPrefs.cs | 10 +- .../Editor/Services/Common/ResourceLoader.cs | 8 +- .../Services/Common/SearchTextParams.cs | 33 + .../Services/Interfaces/IPackageVersion.cs | 2 +- .../Editor/Services/Interfaces/IPage.cs | 94 +- .../Services/Interfaces/IVisualStateList.cs | 8 +- .../Services/Packages/Actions/ActionBase.cs | 49 + .../Services/Packages/Actions/AddAction.cs | 4 +- ...lectAction.cs => DeselectPackageAction.cs} | 8 +- .../Packages/Actions/GitUpdateAction.cs | 2 +- .../Packages/Actions/PackageAction.cs | 54 +- .../Services/Packages/Actions/RemoveAction.cs | 7 +- .../Services/Packages/Actions/ResetAction.cs | 5 +- .../Services/Packages/Actions/SampleAction.cs | 27 + .../Services/Packages/Actions/UnlockAction.cs | 5 +- .../Services/Packages/Actions/UpdateAction.cs | 2 +- .../Packages/Actions/UpdateActionBase.cs | 2 +- .../Packages/InProjectPackagesMonitor.cs | 1 - .../Services/Packages/PackageCreator.cs | 7 +- .../Services/Packages/PackageDatabase.cs | 134 +- .../PackageLink/PackageLinkFactory.cs | 2 +- .../Packages/PackageOperationDispatcher.cs | 33 +- .../Editor/Services/Packages/PackageSample.cs | 291 --- .../Packages/PackagesChangedSource.cs | 1 + .../Samples/Actions/DeselectSampleAction.cs | 44 + .../Samples/Actions/GoToPackageAction.cs | 28 + .../Samples/Actions/ImportSampleAction.cs | 100 + .../Samples/Actions/LocateSampleAction.cs | 53 + .../Packages/Samples/ImportedSample.cs | 22 + .../Samples/ImportedSampleCollection.cs | 58 + .../Packages/Samples/PackageSample.cs | 171 ++ .../Services/Packages/Samples/SampleCache.cs | 311 +++ .../Packages/Samples/SampleCollection.cs | 52 + .../Packages/Samples/SampleFactory.cs | 129 ++ .../Packages/Samples/SampleImporter.cs | 67 + .../Editor/Services/Pages/BasePage.cs | 360 ++-- .../Editor/Services/Pages/PageCapability.cs | 4 +- .../Editor/Services/Pages/PageFactory.cs | 22 +- .../Editor/Services/Pages/PageFilterStatus.cs | 37 + .../Editor/Services/Pages/PageFilters.cs | 280 ++- .../Editor/Services/Pages/PageManager.cs | 215 ++- .../Services/Pages/PageRefreshHandler.cs | 69 +- .../Editor/Services/Pages/PageSelection.cs | 139 +- .../Services/Pages/PageTypes/BuiltInPage.cs | 12 +- .../Services/Pages/PageTypes/ExtensionPage.cs | 20 +- .../InProjectErrorsAndWarningsPage.cs | 32 +- .../PageTypes/InProjectNonCompliancePage.cs | 14 + .../Services/Pages/PageTypes/InProjectPage.cs | 28 +- .../Services/Pages/PageTypes/MyAssetsPage.cs | 208 +- .../Pages/PageTypes/MyRegistriesPage.cs | 2 +- .../Services/Pages/PageTypes/SamplesPage.cs | 202 ++ .../Pages/PageTypes/ScopedRegistryPage.cs | 7 +- .../Pages/PageTypes/UnityRegistryPage.cs | 27 +- .../Pages/PaginatedVisualStateList.cs | 53 +- .../Editor/Services/Pages/RefreshOptions.cs | 3 +- .../Editor/Services/Pages/SimplePage.cs | 189 +- .../Services/Pages/SimplePageWithPackages.cs | 178 ++ .../Editor/Services/Pages/VisualState.cs | 10 +- .../Editor/Services/Pages/VisualStateList.cs | 70 +- .../Services/Proxies/ApplicationProxy.cs | 9 + .../Services/Proxies/AssetDatabaseProxy.cs | 6 + .../Editor/Services/Proxies/IOProxy.cs | 30 +- .../Proxies/PackageManagerWindowProxy.cs | 19 + .../Editor/Services/ServicesContainer.cs | 18 +- .../Editor/Services/Upm/OperationType.cs | 13 + .../Services/Upm/UpmAddAndRemoveOperation.cs | 22 +- .../Editor/Services/Upm/UpmCache.cs | 45 +- .../Editor/Services/Upm/UpmClient.cs | 58 +- .../Upm/UpmOnAssetStorePackageFactory.cs | 2 +- .../Editor/Services/Upm/UpmPackageFactory.cs | 2 +- .../ActiveTrustReturnValue.cs | 2 +- .../UI/ActiveTrustWindow/ActiveTrustWindow.cs | 21 +- .../UI/Common/DelayedSelectionHandler.cs | 11 +- .../Editor/UI/Common/IOUtils.cs | 6 +- .../Editor/UI/Common/LoadingSpinner.cs | 1 - .../Editor/UI/Common/ManageDropdownButton.cs | 4 +- .../Editor/UI/Common/Tabs/BaseTabView.cs | 1 - .../Editor/UI/Common/UIUtils.cs | 82 +- .../BaseDetailsView.cs} | 6 +- .../Editor/UI/Details/DetailsArea.cs | 207 ++ .../Editor/UI/Details/InProgressView.cs | 49 + .../Editor/UI/Details/PackageAuthorLabel.cs | 68 + .../Editor/UI/Details/PackageDetails.cs | 137 ++ .../UI/{ => Details}/PackageDetailsBody.cs | 58 +- .../UI/{ => Details}/PackageDetailsHeader.cs | 37 +- .../UI/{ => Details}/PackageDetailsLinks.cs | 0 .../UI/{ => Details}/PackagePlatformList.cs | 0 .../PackageReleaseDetailsItem.cs | 0 .../Editor/UI/Details/SampleDetails.cs | 64 + .../Editor/UI/Details/SampleDetailsBody.cs | 52 + .../Editor/UI/Details/SampleDetailsHeader.cs | 101 + .../Tabs}/PackageDetailsDependenciesTab.cs | 0 .../Tabs}/PackageDetailsDetailsTab.cs | 0 .../PackageDetailsFeatureDependenciesTab.cs | 0 .../Tabs}/PackageDetailsImagesTab.cs | 0 .../Tabs}/PackageDetailsImportedAssetsTab.cs | 0 .../Tabs}/PackageDetailsOverviewTab.cs | 0 .../Tabs}/PackageDetailsReleasesTab.cs | 0 .../Details/Tabs/PackageDetailsSampleItem.cs | 67 + .../Tabs}/PackageDetailsSamplesTab.cs | 15 +- .../Tabs}/PackageDetailsTabElement.cs | 0 .../Tabs}/PackageDetailsTabView.cs | 0 .../Tabs}/PackageDetailsVersionHistoryItem.cs | 0 .../Tabs}/PackageDetailsVersionsTab.cs | 0 .../Tabs}/SignInDetails.cs | 0 .../Tabs}/SortedColumn.cs | 0 .../UI/{ => Details}/VersionInfoIcon.cs | 0 .../AddPackageByNameDropdown.cs | 4 +- .../{ => Dropdowns}/CreatePackageDropdown.cs | 0 .../UI/{ => Dropdowns}/DropdownContent.cs | 0 .../{ => Dropdowns}/GenericInputDropdown.cs | 0 .../UI/{ => Dropdowns}/InProgressDropdown.cs | 16 +- .../Interfaces/IPackageManagerExtension.cs | 0 .../PackageManagerExtensions.cs | 0 .../UI/Filters/AssetStoreFiltersWindow.cs | 230 --- .../Editor/UI/Filters/PageFiltersWindow.cs | 337 ++++ .../Editor/UI/Filters/UpmFiltersWindow.cs | 70 - .../DeprecatedPackageHelpBox.cs | 0 .../DeprecatedVersionHelpBox.cs | 0 .../DisabledPackageHelpBox.cs | 0 .../{Generic => HelpBoxes}/ExtendedHelpBox.cs | 0 .../HiddenProductHelpBox.cs | 0 .../NonCompliantPackageHelpBox.cs | 0 .../PackageBaseHelpBox.cs | 0 .../PackageSignatureHelpBox.cs | 0 .../Editor/UI/InProgressView.cs | 56 - .../InformationCards/SampleInformationCard.cs | 12 + .../SampleParentPackageDisplayNameCard.cs | 18 + .../UI/InformationCards/SampleSizeInfoCard.cs | 17 + .../UI/{ => Inspector}/PackageManifest.cs | 0 .../PackageManifestImporterEditor.cs | 507 +++-- .../Editor/UI/List/BaseListItem.cs | 36 + .../Interfaces/IItemListView.cs} | 10 +- .../Editor/UI/List/Interfaces/IListItem.cs | 17 + .../Editor/UI/List/ItemListScrollView.cs | 402 ++++ .../UI/{PackageList.cs => List/ListArea.cs} | 184 +- .../Editor/UI/List/ListItemGroup.cs | 75 + .../Editor/UI/List/PackageItem.cs | 214 +++ .../Editor/UI/List/PackageListView.cs | 362 ++++ .../Editor/UI/{ => List}/PackageLoadBar.cs | 42 +- .../Editor/UI/{ => List}/PackageSearchBar.cs | 64 +- .../Editor/UI/{ => List}/PackageStatusBar.cs | 23 +- .../PartiallyNonCompliantRegistryMessage.cs | 9 +- .../Editor/UI/List/SampleItem.cs | 68 + .../Editor/UI/{ => List}/SignInBar.cs | 9 +- .../{ => MainWindow}/MainContainerOverlay.cs | 0 .../{ => MainWindow}/PackageManagerToolbar.cs | 104 +- .../{ => MainWindow}/PackageManagerWindow.cs | 86 +- .../PackageManagerWindowRoot.cs | 133 +- .../MultiSelect/IMultiSelectFoldoutElement.cs | 6 +- .../UI/MultiSelect/MultiSelectDetails.cs | 185 +- .../UI/MultiSelect/MultiSelectFoldout.cs | 97 - .../UI/MultiSelect/MultiSelectFoldoutBase.cs | 96 + .../UI/MultiSelect/MultiSelectFoldoutGroup.cs | 50 - .../Editor/UI/MultiSelect/MultiSelectItem.cs | 95 - .../UI/MultiSelect/MultiSelectItemBase.cs | 60 + .../{ => Packages}/CheckUpdateFoldout.cs | 10 +- .../{ => Packages}/DownloadFoldoutGroup.cs | 2 +- .../DownloadUpdateFoldoutGroup.cs | 2 +- .../{ => Packages}/InstallFoldoutGroup.cs | 10 +- .../NoActionsOnPackagesFoldout.cs} | 6 +- .../OpenManifestExternallyFoldoutGroup.cs | 2 +- .../Packages/PackageMultiSelectFoldout.cs | 14 + .../PackageMultiSelectFoldoutGroup.cs | 57 + .../Packages/PackageMultiSelectItem.cs | 30 + .../{ => Packages}/RemoveFoldoutGroup.cs | 10 +- .../RemoveImportedFoldoutGroup.cs | 6 +- .../{ => Packages}/UnlockFoldout.cs | 8 +- .../{ => Packages}/UpdateFoldout.cs | 8 +- .../{ => Packages}/UpdateFoldoutGroup.cs | 8 +- .../Samples/NoActionsOnSamplesFoldout.cs | 14 + .../Samples/SampleMultiSelectFoldout.cs | 14 + .../Samples/SampleMultiSelectItem.cs | 14 + .../Editor/UI/PackageDetails.cs | 271 --- .../PackageDetailsSampleItem.cs | 138 -- .../Editor/UI/PackageGroup.cs | 94 - .../PackageManagerUI/Editor/UI/PackageItem.cs | 328 ---- .../Editor/UI/PackageListScrollView.cs | 536 ------ .../Editor/UI/PackageListView.cs | 333 ---- .../Editor/UI/PackageManagerFiltersWindow.cs | 155 -- .../Interfaces/IPackageToolBarButton.cs | 0 .../LegacyFormatDropdownButton.cs | 14 +- .../PackageToolBar.cs | 35 +- .../PackageToolBarButtonSingleAction.cs | 74 + .../PackageToolBarError.cs | 0 .../UI/PackageToolBar/SampleToolBarButton.cs | 39 + .../UI/PackageToolBar/ToolbarButtonBase.cs | 106 ++ .../UI/{ => ScopedRegistries}/RegistryItem.cs | 0 .../ScopedRegistriesSettings.cs | 0 .../ScopedRegistryAddedPopup.cs | 0 .../Editor/UI/Sidebar/Sidebar.cs | 174 +- .../PackageToolBarButtonSingleAction.cs | 142 -- .../ParticleSystemEditor/ParticleEffectUI.cs | 11 +- .../ScriptBindings/Physics2D.bindings.cs | 11 +- .../Managed/Joints/HingeJoint2DEditor.cs | 22 +- .../Managed/Joints/HingeJoint2DTool.cs | 34 +- .../APIUpdates/PhysicsCore2D.obsolete.cs | 4 + .../Bindings/PhysicsBody.bindings.cs | 4 + .../Bindings/PhysicsChain.bindings.cs | 4 + .../Bindings/PhysicsComposer2D.bindings.cs | 2 + .../Bindings/PhysicsJoint.bindings.cs | 4 + .../Bindings/PhysicsShape.bindings.cs | 6 +- .../Bindings/PhysicsWorld.bindings.cs | 4 +- .../Scripting/Joints/PhysicsDistanceJoint.cs | 17 + .../Joints/PhysicsDistanceJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsFixedJoint.cs | 17 + .../Joints/PhysicsFixedJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsHingeJoint.cs | 17 + .../Joints/PhysicsHingeJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsIgnoreJoint.cs | 17 + .../Joints/PhysicsIgnoreJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsJoint.cs | 26 + .../Scripting/Joints/PhysicsRelativeJoint.cs | 17 + .../Joints/PhysicsRelativeJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsSliderJoint.cs | 17 + .../Joints/PhysicsSliderJointDefinition.cs | 12 +- .../Scripting/Joints/PhysicsWheelJoint.cs | 17 + .../Joints/PhysicsWheelJointDefinition.cs | 12 +- .../Miscellaneous/PhysicsUserData.cs | 7 + .../PhysicsCore2D/Scripting/PhysicsBody.cs | 25 +- .../Scripting/PhysicsBodyDefinition.cs | 8 + .../PhysicsCore2D/Scripting/PhysicsChain.cs | 17 + .../Scripting/PhysicsComposer.cs | 38 +- .../Scripting/PhysicsGeometry.cs | 2 +- .../PhysicsCore2D/Scripting/PhysicsShape.cs | 29 +- .../Scripting/PhysicsShapeDefinition.cs | 8 + .../PhysicsCore2D/Scripting/PhysicsWorld.cs | 25 +- .../ContactFilterPropertyDrawer.cs | 2 +- .../PhysicsUserDataPropertyDrawer.cs | 18 +- .../PolygonGeometryPropertyDrawer.cs | 4 +- .../QueryFilterPropertyDrawer.cs | 2 +- Modules/PhysicsEditor/PhysicsDebugWindow.cs | 1 - .../PhysicsDebugWindowInfoTab.cs | 3 +- .../PhysicsDebugWindowQueries.cs | 2 +- .../UI/Toolbar/PlayModePopupContent.cs | 1 + Modules/PresetsUIEditor/PresetEditor.cs | 15 +- .../MemoryProfiler/ArrayEntries.cs | 37 +- .../MemoryProfiler/MemorySnapshot.cs | 6 +- .../ProfilerRoleProvider.cs | 4 +- .../Chart/Data/BottlenecksChartViewModel.cs | 5 + .../{Box Plot => BoxPlot}/BoxPlotModel.cs | 0 .../BoxPlotViewController.cs | 0 .../FoldableSectionViewController.cs | 0 .../AllocationsSectionViewController.cs | 0 .../FrameAllocationsSectionViewController.cs | 0 .../FrameTimesSectionViewController.cs | 0 .../SingleFrameTimesSectionViewController.cs | 0 .../FrameBottlenecksModel.cs | 0 .../FrameBottlenecksViewController.cs | 0 .../FrameGCAllocationsModel.cs | 2 +- .../FrameGCAllocationsViewController.cs | 0 .../FrameGCCollectModel.cs | 0 .../FrameGCCollectViewController.cs | 0 .../BottlenecksModelBuilder.cs | 0 .../FrameBottlenecksModelBuilder.cs | 0 .../RangeBottlenecksModelBuilder.cs | 0 .../BoxPlotModelExtensions.cs | 27 +- .../FrameTimesBoxPlotModelBuilder.cs | 2 +- .../GCCollectBoxPlotModelBuilder.cs | 2 +- .../BuilderUtility.cs | 0 .../FrameGCCollectModelBuilder.cs | 0 .../FrameSummaryModelBuilder.cs | 0 .../GCAllocationsInFrameModelBuilder.cs | 0 .../GCAllocationsInRangeModelBuilder.cs | 0 ...inThreadUtilizationPieChartModelBuilder.cs | 0 .../ProfilerFrameIndexOutOfBounds.cs | 0 .../RangeSummaryModelBuilder.cs | 0 .../SystemsImpactInFrameModelBuilder.cs | 0 .../SystemsImpactInRangeModelBuilder.cs | 0 .../SystemsImpactModelBuilder.cs | 0 .../TopFrameMarkersModelBuilder.cs | 0 .../TopMarkersCollection.cs | 0 .../TopMarkersModelBuilder.cs | 0 .../TopRangeMarkersModelBuilder.cs | 0 .../PieChartKeyItem.cs | 0 .../{Pie Chart => PieChart}/PieChartModel.cs | 0 .../PieChartViewController.cs | 0 .../RangeBottlenecksModel.cs | 16 +- .../RangeBottlenecksViewController.cs | 0 .../GCAllocationsModel.cs | 0 .../GCAllocationsViewController.cs | 0 .../SelectionSummaryViewController.cs | 0 .../SystemImpactItem.cs | 0 .../SystemsImpactModel.cs | 0 .../SystemsImpactViewController.cs | 0 .../TopMarkerDetailsProvider.cs | 0 .../TopMarkerItem.cs | 0 .../TopMarkersModel.cs | 0 .../TopMarkersModelUtility.cs | 0 .../TopMarkersViewController.cs | 0 .../CaptureFileTreeItemViewController.cs | 20 +- .../ModuleEditor/ModuleEditorWindow.cs | 4 +- .../ProfilerDetailedObjectsView.cs | 4 + .../ProfilerWindow/ProfilerDetailedView.cs | 1 + .../Audio/AudioProfilerModule.cs | 8 + .../ProfilerModules/Memory/MemoryElement.cs | 1 - .../ProfilerModules/Memory/MemorySnapshot.cs | 57 +- .../ProfilerModules/uGui/UIProfilerModule.cs | 4 +- .../ProfilerModules/uGui/UISystemProfiler.cs | 3 + .../ProfilerWindow/ProfilerWindow.cs | 16 +- Modules/ProjectAuditorEditor/API/Report.cs | 1 + .../ProjectAuditorEditor/API/ReportItem.cs | 3 + .../AssemblyUtils/AssemblyCompilation.cs | 1 + .../Core/API/CodeModuleInstructionAnalyzer.cs | 16 +- .../AllocationAnalyzer.cs | 2 +- .../InstructionAnalyzers/BoxingAnalyzer.cs | 2 +- .../BuiltinCallAnalyzer.cs | 2 +- .../InstructionAnalyzers/DebugLogAnalyzer.cs | 2 +- .../EmptyMethodAnalyzer.cs | 2 +- .../ObsoleteAttributeAnalyzer.cs | 2 +- .../UnsupportedOnWebGLAnalyzer.cs | 2 +- .../Modules/CodeModule.cs | 4 +- .../UI/Framework/IssueTable.cs | 2 +- .../ProjectAuditorEditor/UI/Framework/Tab.cs | 1 + .../UI/Framework/ViewManager.cs | 4 +- .../UI/ProjectAuditorWindow.cs | 4 +- .../Algorithms/PropertyContainer+Accept.cs | 6 +- Modules/Properties/Runtime/AssemblyInfo.cs | 1 + .../Properties/ReflectedMemberProperty.cs | 2 +- .../PropertyBags/ContainerPropertyBag.cs | 19 +- .../Internal/PropertiesInitialization.cs | 11 + .../PropertyBags/Internal/PropertyBagStore.cs | 56 +- .../Runtime/PropertyVisitors/PathVisitor.cs | 2 +- .../Internal/ReflectedPropertyBagProvider.cs | 40 +- .../Runtime/Utility/TypeConversion.cs | 1676 +++++++++++++---- .../Properties/Runtime/Utility/TypeTraits.cs | 53 +- .../Properties/Runtime/Utility/TypeUtility.cs | 4 +- .../Implementation/QuickInstallAnalytics.cs | 41 + .../Implementation/QuickInstallConfig.cs | 31 + .../Implementation/QuickInstallMenuItem.cs | 63 + .../QuickInstallSettingsProvider.cs | 115 ++ .../Editor/Implementation/QuickInstaller.cs | 182 ++ .../QuickInstall/Editor/InAppPurchasing.cs | 53 + Modules/QuickInstall/Editor/LevelPlay.cs | 54 + .../Editor/Indexing/IndexManager.cs | 4 +- .../Editor/Indexing/ObjectIndexer.cs | 5 + .../Editor/Providers/AdbProvider.cs | 2 +- .../Editor/Providers/MenuProvider.cs | 5 +- .../Providers/PackageManagerProvider.cs | 3 +- .../QueryBuilder/QueryBuilderHelpers.cs | 1 - .../SearchExpressionParser.cs | 26 +- .../SearchExpression/SearchItemQueryEngine.cs | 5 + Modules/QuickSearch/Editor/SearchList.cs | 4 +- Modules/QuickSearch/Editor/SearchUtils.cs | 11 +- .../Editor/Selectors/PropertySelectors.cs | 1 + .../Editor/UITK/SearchAutoCompleteWindow.cs | 8 +- .../Editor/UITK/SearchBaseCollectionView.cs | 3 +- .../Editor/UITK/SearchDetailView.cs | 1 + .../Editor/UITK/SearchQueryPanelTreeView.cs | 50 +- Modules/QuickSearch/Editor/UITK/SearchView.cs | 1 + .../Editor/Utilities/StringView.cs | 1 + .../SceneTemplateDialog.cs | 23 +- .../SceneTemplateEditor/SceneTemplateUtils.cs | 23 +- Modules/SceneTemplateEditor/Styles.cs | 2 +- Modules/SceneView/SceneViewToolbarElements.cs | 2 +- .../Public/Logging/ErrorCode.bindings.cs | 1 + Modules/ShortcutManagerEditor/Directory.cs | 5 +- .../IntegratedSubsystem.deprecated.cs | 2 +- .../TextCoreTextEngine/Managed/FastAction.cs | 1 + .../Managed/FontFeatureCommon.cs | 1 + .../Managed/FontFeatureTable.cs | 1 + .../Managed/MaterialManager.cs | 4 + .../Managed/TextAssets/FontAsset.cs | 331 +--- .../FontAsset/FontAsset.Deprecated.cs | 95 + .../FontAsset/FontAssetAtlasPopulation.cs | 254 +++ .../FontAsset/FontAssetFontFeatures.cs | 4 + .../TextAssets/FontAsset/NativeFontAsset.cs | 31 +- .../Managed/TextAssets/SpriteAsset.cs | 31 +- .../TextAssets/TextSettings.Deprecated.cs | 111 ++ .../Managed/TextAssets/TextSettings.cs | 153 +- .../Managed/TextEditingUtilities.cs | 70 +- .../TextGenerator/RichTextTagParser.cs | 10 +- .../TextGenerator/TextGenerationSettings.cs | 4 + .../TextGenerator/TextGeneratorParsing.cs | 6 +- .../TextGeneratorPreferredValues.cs | 4 + .../TextGenerator/TextGeneratorPrepare.cs | 10 +- .../Managed/TextGenerator/TextLib.bindings.cs | 3 + .../TextCoreTextEngine/Managed/TextHandle.cs | 11 + ...s.cs => TextShaderUtilities.Deprecated.cs} | 19 +- .../Managed/UnicodeLineBreakingRules.cs | 1 + .../Managed/FontAssetCreationMenu.cs | 44 +- .../Managed/FontAssetCreatorWindow.cs | 15 +- .../Managed/FontAssetEditor.cs | 70 +- .../CharacterPropertyDrawer.cs | 3 + .../TextCorePropertyDrawerUtilities.cs | 3 + .../UnicodeLineBreakingRulesPropertyDrawer.cs | 4 + .../Managed/SpriteAssetCreationMenu.cs | 3 + .../Managed/SpriteAssetImporter.cs | 3 + .../Managed/TextCoreContextMenuItems.cs | 4 + .../Managed/TextCoreEditorUtilities.cs | 4 + ...GUI.cs => TextCoreShaderGUI.Deprecated.cs} | 7 +- ... => TextCoreShaderGUIBitmap.Deprecated.cs} | 5 + ....cs => TextCoreShaderGUISDF.Deprecated.cs} | 5 + .../Managed/TextSettingsCreationMenu.cs | 51 - .../Managed/TextSettingsEditor.cs | 85 +- .../UIAutomationEditor/TestEditorWindow.cs | 2 + .../Editor/Builder/BuilderSelection.cs | 14 +- .../Document/BuilderDocumentOpenUXML.cs | 4 +- .../Draggers/BuilderHierarchyDragger.cs | 9 +- .../Explorer/BuilderStyleSheetsUtilities.cs | 3 +- .../BuilderInspectorInheritedStyles.cs | 6 +- .../Inspector/BuilderInspectorStyleFields.cs | 4 +- .../Utilities/BuilderAssetUtilities.cs | 431 +---- .../Utilities/BuilderElementContextMenu.cs | 14 +- .../BuilderUxmlAttributesView.cs | 50 +- .../IBatchedUxmlChangesListener.cs | 2 +- .../StyleField/AssetReferenceStyleField.cs | 3 + .../StyleField/StyleVariableUtilities.cs | 4 +- .../StylePropertyManipulator.cs | 2 +- .../TemplateAssetExtensions.cs | 20 +- .../Core/BackgroundPosition.PropertyBag.cs | 1 + .../Core/BackgroundRepeat.PropertyBag.cs | 1 + .../Core/BackgroundSize.PropertyBag.cs | 1 + .../Core/Bindings/ConverterGroup.cs | 125 +- .../Core/Bindings/ConverterGroups.cs | 337 +--- .../Core/Bindings/DataBindingUtility.cs | 23 +- .../Bindings/Utils/AutoCompletePathVisitor.cs | 2 +- .../Core/Bindings/Utils/TypePathVisitor.cs | 2 +- .../Controllers/BaseListViewController.cs | 2 +- .../Controllers/CollectionViewController.cs | 4 +- .../DynamicHeightVirtualizationController.cs | 2 +- .../Controls/BaseVerticalCollectionView.cs | 1 + Modules/UIElements/Core/Controls/HelpBox.cs | 1 + .../Controls/InputField/TextInputFieldBase.cs | 24 +- .../InputField/TouchScreenTextEditor.cs | 29 +- .../UIElements/Core/Controls/ScrollView.cs | 7 +- .../ToggleButtonGroupState.cs | 6 +- Modules/UIElements/Core/Cursor.PropertyBag.cs | 1 + .../Core/DragAndDrop/ListViewDragger.cs | 20 +- .../Core/Events/PointerDeviceState.cs | 41 +- Modules/UIElements/Core/FocusController.cs | 13 +- .../Core/GameObjects/DocumentPicker.cs | 2 +- .../Core/GameObjects/NavigateFocusRing.cs | 15 +- .../Core/GameObjects/PanelComponentUtils.cs | 49 + .../Core/GameObjects/PanelSettings.cs | 29 +- .../UIElements/Core/GameObjects/UIDocument.cs | 64 +- .../Core/GameObjects/WorldSpaceInput.cs | 4 +- Modules/UIElements/Core/GpuUpdateMode.cs | 53 - .../Core/ILiveReloadAssetTracker.cs | 12 +- Modules/UIElements/Core/ILiveReloadSystem.cs | 12 +- .../Core/Native/Renderer/IPanelComponent.cs | 4 + .../Native/Renderer/PanelRenderer.bindings.cs | 34 +- .../Core/Native/UIAnimationBinder.bindings.cs | 10 +- Modules/UIElements/Core/Panel.cs | 4 +- .../VisualElementAssetReferenceTable.cs | 2 +- .../Referencing/VisualElementReference.cs | 2 +- .../Core/Renderer/UIRElementBuilder.cs | 2 +- .../UIElements/Core/Renderer/UIRGpuUpdater.cs | 61 + .../Core/Renderer/UIRGpuUpdaterMapped.cs | 38 +- .../Core/Renderer/UIRGpuUpdaterStaged.cs | 335 ++-- .../Core/Renderer/UIRMeshGenerator.cs | 42 +- .../Core/Renderer/UIRMeshManager.cs | 65 +- ...anagerStaged.cs => UIRMeshManagerBasic.cs} | 34 +- ...agerMapped.cs => UIRMeshManagerTracked.cs} | 26 +- .../Core/Renderer/UIRRenderTreeManager.cs | 2 +- .../Core/Renderer/UIRRepaintUpdater.cs | 28 - .../Core/Renderer/UIRVEShaderInfoAllocator.cs | 13 +- .../Core/Renderer/UIRenderer/UIRDataSet.cs | 98 +- .../Renderer/UIRenderer/UIRenderDevice.cs | 55 +- .../UIRenderer/UIRenderDeviceAllocator.cs | 13 +- Modules/UIElements/Core/StringUtils.cs | 4 +- .../Core/Style/Angle.PropertyBag.cs | 1 + .../Core/Style/Background.PropertyBag.cs | 1 + .../UIElements/Core/Style/ComputedStyle.cs | 11 +- .../Core/Style/CustomPropertyList.cs | 195 ++ .../Core/Style/EasingFunction.PropertyBag.cs | 1 + .../Core/Style/FilterFunction.PropertyBag.cs | 1 + .../Core/Style/FontDefinition.PropertyBag.cs | 1 + .../Core/Style/Generated/ComputedStyle.gen.cs | 44 +- .../InlineStyleAccessPropertyBag.gen.cs | 89 +- .../ResolvedStyleAccessPropertyBag.gen.cs | 84 +- .../Style/Generated/StyleDataAllocator.gen.cs | 46 + .../Style/Generated/StylePropertyEnums.gen.cs | 15 +- .../Generated/UIToolkitConverters.gen.cs | 345 ++++ .../Style/InlineStyleAccess.PropertyBag.cs | 126 +- .../Core/Style/Length.PropertyBag.cs | 1 + .../Style/MaterialDefinition.PropertyBag.cs | 1 + .../Core/Style/MaterialDefinition.cs | 1 - .../Core/Style/Ratio.PropertyBag.cs | 1 + .../Style/ResolvedStyleAccess.PropertyBag.cs | 22 +- .../Core/Style/Rotate.PropertyBag.cs | 1 + .../Core/Style/Scale.PropertyBag.cs | 1 + .../Core/Style/StyleDataAllocator.bindings.cs | 31 +- Modules/UIElements/Core/Style/StyleDataRef.cs | 191 +- .../UIElements/Core/Style/StyleDataStructs.cs | 29 +- .../Core/Style/StyleValue.PropertyBag.cs | 1 + .../Core/Style/TimeValue.PropertyBag.cs | 1 + .../Core/Style/TransformOrigin.PropertyBag.cs | 1 + .../Core/Style/Translate.PropertyBag.cs | 1 + .../Core/Style/UIToolkitConverters.cs | 74 + .../Core/StylePropertyName.PropertyBag.cs | 1 + .../Core/StyleSheets/StylePropertyReader.cs | 25 +- .../UIElements/Core/StyleSheets/StyleSheet.cs | 6 +- .../Core/StyleSheets/StyleValueHandle.cs | 2 +- Modules/UIElements/Core/Text/ATGTextHandle.cs | 6 +- .../UIElements/Core/Text/ATGTextJobSystem.cs | 4 +- .../Core/Text/TextEditingManipulator.cs | 76 +- Modules/UIElements/Core/Text/TextUtilities.cs | 4 +- .../UIElements/Core/Text/UITKTextJobSystem.cs | 12 +- .../Core/TextAutoSize.PropertyBag.cs | 1 + Modules/UIElements/Core/TextElementEdition.cs | 39 +- .../UIElements/Core/TextShadow.PropertyBag.cs | 1 + .../Core/UIElementsInitialization.cs | 154 +- Modules/UIElements/Core/UIElementsUtility.cs | 13 +- .../UIElements/Core/UXML/UxmlObjectAsset.cs | 6 +- .../Core/UXML/UxmlSerializedData.cs | 1 + .../UIElements/Core/UXML/VisualTreeAsset.cs | 18 +- .../Core/UXML/VisualTreeAssetUtilities.cs | 2 +- .../Core/Unmanaged/UnmanagedHandleBuffer.cs | 21 +- .../Core/Unmanaged/UnmanagedRefCountedList.cs | 4 +- Modules/UIElements/Core/VisualElement.cs | 14 +- .../UIElements/Core/VisualElementHierarchy.cs | 50 +- .../Core/VisualElementStyleAccess.cs | 58 +- .../Core/VisualElementTransformData.cs | 2 +- .../Core/VisualTreeHierarchyFlagsUpdater.cs | 4 +- .../SerializedObjectBindingContext.cs | 3 + .../Bindings/SerializedPropertyHelper.cs | 10 + .../Debugger/Events/EventTypeSearchField.cs | 5 +- .../Debugger/StylePropertyDebugger.cs | 2 +- .../Debugger/UIElementsDebugger.cs | 8 +- .../Inspector/PanelRendererInspector.cs | 9 + .../GameObjects/PlayModeMenuItems.cs | 11 - .../Profiler/UIToolkitProfilerModule.cs | 30 + .../Text/PanelTextSettingsCreationMenu.cs | 4 +- .../UIElementsEditorInitialization.cs | 16 +- .../UIElementsEditorWindowCreator.cs | 75 +- .../USS/StyleSheetExtensions.cs | 37 + .../UIElementsEditor/UXML/UxmlSerializer.cs | 2 +- .../VisualTreeAssetChangeTrackerUpdater.cs | 182 +- .../UIElementsEditor/VisualTreeAssetEditor.cs | 1 + .../UIElementsSamplesEditor/ElementSnippet.cs | 3 +- .../Managed/Commands/AddElementCommand.cs | 1 + .../Managed/Commands/AddStyleSheetCommand.cs | 1 + .../Commands/AddTemplatesToElementCommand.cs | 1 + .../ClearAllStylePropertyBindingsCommand.cs | 1 + .../Commands/DuplicateElementsCommand.cs | 3 + .../Managed/Commands/PasteElementsCommand.cs | 1 + .../Managed/Commands/RemoveBindingCommand.cs | 1 + .../Managed/Commands/RemoveElementsCommand.cs | 3 + .../Commands/ReorderStyleRulesCommand.cs | 51 + .../Commands/ReparentElementsCommand.cs | 4 + .../Managed/Commands/SetAttributeCommand.cs | 56 + .../Commands/SetAttributeOverrideCommand.cs | 57 + .../Managed/Commands/SetElementNameCommand.cs | 1 + .../Commands/SetInlineStylePropertyCommand.cs | 1 + .../Managed/Commands/SetStyleSheetsCommand.cs | 131 ++ .../UnsetAllInlineStylePropertiesCommand.cs | 1 + .../Selection/Editor/StyleRuleHeader.cs | 11 +- .../Selection/Editor/StyleRuleInspector.cs | 2 +- .../Selection/Editor/StyleSheetHeader.cs | 10 +- .../Editor/VisualElementInspector.cs | 92 +- .../Selection/IStyleRuleSelectionHandler.cs | 1 + .../Selection/IStyleSheetSelectionHandler.cs | 1 + .../Selection/StyleRuleSelectionHandler.cs | 13 + .../Selection/StyleSheetSelectionHandler.cs | 13 + .../Controls/StyleInspectorDefaultContent.cs | 84 +- .../Inspector/Controls/UxmlAssetUtilities.cs | 575 ++++++ .../Controls/UxmlAttributeChangeHandler.cs | 136 ++ .../Inspector/Controls/UxmlAttributeField.cs | 5 + .../Controls/UxmlAttributesEditingContext.cs | 26 +- .../UxmlAttributesEditingController.cs | 14 +- .../Inspector/Controls/UxmlAttributesView.cs | 2 + .../VisualElementBindingsInspectorElement.cs | 1 + .../Managed/Library/LibraryContent.cs | 10 +- .../Managed/Menu/MenuItemGenerator.cs | 75 +- .../Managed/Search/UIQueryTypeListBlock.cs | 11 +- .../Managed/Stages/StageContextMenuUtility.cs | 59 +- .../StyleSheetEditingNodeTypeHandler.cs | 290 +++ .../StyleSheets/StyleSheetNodeTypeHandler.cs | 205 +- .../Managed/StyleSheets/StyleSheetsWindow.cs | 202 +- .../Common/NotificationManager.cs | 4 +- .../ServicesProjectSettings.cs | 5 +- .../VFXMemorySerializer.bindings.cs | 3 - .../VectorGraphics/Runtime/VectorSprite.cs | 2 - .../Editor/SVGImporterEditor.cs | 1 - Projects/CSharp/UnityEditor.csproj | 867 +++++---- Projects/CSharp/UnityEngine.csproj | 70 +- README.md | 2 +- .../SpriteDataAccess.bindings.cs | 11 + .../SpriteRendererGroup.bindings.cs | 58 - Runtime/Export/Analytics/AnalyticsCommon.cs | 5 +- .../Application/Application.bindings.cs | 1 + Runtime/Export/AssemblyInfo.cs | 3 + Runtime/Export/Camera/Camera.bindings.cs | 2 +- Runtime/Export/Camera/FlareLayer.bindings.cs | 1 + .../Collections/CollectionExtensions.cs | 18 +- Runtime/Export/Coverage.bindings.cs | 3 + Runtime/Export/Graphics/Graphics.bindings.cs | 6 + Runtime/Export/Graphics/Graphics.cs | 252 ++- .../Export/Graphics/Graphics.deprecated.cs | 2 + .../Graphics/GraphicsComponents.bindings.cs | 11 +- .../Graphics/GraphicsSettings.bindings.cs | 3 +- .../Graphics/Graphics_BindingsOverloads.cs | 98 +- .../LightProbeProxyVolume.bindings.cs | 1 + ...ayTracingAccelerationStructure.bindings.cs | 46 +- Runtime/Export/Math/Vector2Int.cs | 2 +- Runtime/Export/Math/Vector3Int.cs | 2 +- Runtime/Export/Math/math_unity_conversion.cs | 49 + Runtime/Export/ObjectPool/RentSpan.cs | 40 + .../Export/ObjectPool/RentSpanUnmanaged.cs | 60 +- .../Export/PlayerLoop/PlayerLoop.bindings.cs | 2 + Runtime/Export/Scripting/CastHelper.cs | 17 - .../Export/Scripting/Component.bindings.cs | 12 +- .../Export/Scripting/GameObject.bindings.cs | 27 +- .../LifecycleManagement/PlayModeScope.cs | 7 + .../Marshalling/ManagedObjectMarshalling.cs | 32 - .../TransformAccessArray.bindings.cs | 201 ++ .../TransformHierarchy.bindings.cs | 46 + .../BeeDriver2/Bee.BeeDriver2.dll | Bin 120320 -> 120320 bytes .../Distribution/BeeDriver2/Bee.BinLog.dll | Bin 18944 -> 18944 bytes .../BeeTinyProfiler2/Bee.TinyProfiler2.dll | Bin 20480 -> 20480 bytes .../InternalsVisibleTo.cs | 3 +- .../msbuild.host/Unity.BuildService.Host.dll | Bin 261120 -> 0 bytes .../asmDefToCSProj/AsmDefToCSProjLib.dll | Bin 76800 -> 76800 bytes .../buildTools/Unity.BuildService.dll | Bin 86016 -> 86016 bytes .../buildTools/UnityEditor.MSBuild.dll | Bin 24064 -> 24064 bytes .../msbuild.host/Unity.BuildService.Host.dll | Bin 0 -> 257024 bytes third-party-notices.txt | 2 +- 930 files changed, 20858 insertions(+), 11833 deletions(-) delete mode 100644 Editor/Mono/GUI/LoadableReferenceDrawer.cs create mode 100644 Editor/Mono/Graphics/GraphicsStateCollectionSettingsUI.cs create mode 100644 Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs create mode 100644 Editor/Mono/Modules/PlatformSDK/PlatformSDK.cs create mode 100644 Editor/Mono/UIElements/Controls/LoadableReferenceField.cs create mode 100644 Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralSettingsPerBuildTargetEditor.cs create mode 100644 Modules/Audio/Public/SampleProvider/ScriptBindings/SampleProvider.bindings.cs rename Modules/ContentLoad/Managed/{ContentDirectoryCatalog.bindings.cs => ContentManifest.bindings.cs} (96%) create mode 100644 Modules/ContentLoad/Managed/NativeLoadingSystem.bindings.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/EditorCommon/GraphToolkitAnalytics.cs create mode 100644 Modules/GraphToolkitEditor/GraphToolkitEditor/UI/ModelView/GraphView/ModelViewParts/CapsuleNodePortContainerPart.cs delete mode 100644 Modules/InAppPurchasing/Editor/InAppPurchasingAnalytics.cs delete mode 100644 Modules/InAppPurchasing/Editor/InAppPurchasingInstaller.cs delete mode 100644 Modules/InAppPurchasing/Editor/InAppPurchasingMenuItem.cs create mode 100644 Modules/Input/Private/Managed/InputCommonTypes.cs create mode 100644 Modules/Input/Private/Managed/InputFocusEvent.cs delete mode 100644 Modules/LevelPlay/Editor/LevelPlayInstallAnalytics.cs delete mode 100644 Modules/LevelPlay/Editor/LevelPlayInstaller.cs delete mode 100644 Modules/LevelPlay/Editor/LevelPlayMenuItem.cs create mode 100644 Modules/Lighting/LightingSearch/LightingSearchQueryTreeNodeHandler.cs delete mode 100644 Modules/Lighting/LightingSearch/LightingSearchSelectorsScene.cs create mode 100644 Modules/MultiplayerEditor/Managed/Common/ServiceSingleton.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/PlayModeConfig/OrchestratedScenario/CustomAssetsData.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/PlayModeConfig/OrchestratedScenario/DecoratorItem.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/PlayModeConfig/OrchestratedScenario/OrchestratedScenarioUserSettings.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/Decorators/ExtensionsDatabase.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/Decorators/InstanceControllerDecorator.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/Decorators/InstanceExtensionManager.cs create mode 100644 Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/FreeRunning/FreeRunningController.cs rename Modules/MultiplayerEditor/Managed/MultiplayerPlayMode/Scenarios/GraphsFoundation/{Node.cs => ExecutionNode.cs} (98%) create mode 100644 Modules/PackageManagerUI/Editor/Services/Common/SearchTextParams.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Actions/ActionBase.cs rename Modules/PackageManagerUI/Editor/Services/Packages/Actions/{DeselectAction.cs => DeselectPackageAction.cs} (88%) create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Actions/SampleAction.cs delete mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/PackageSample.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/Actions/DeselectSampleAction.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/Actions/GoToPackageAction.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/Actions/ImportSampleAction.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/Actions/LocateSampleAction.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/ImportedSample.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/ImportedSampleCollection.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/PackageSample.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/SampleCache.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/SampleCollection.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/SampleFactory.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Packages/Samples/SampleImporter.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Pages/PageFilterStatus.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Pages/PageTypes/SamplesPage.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Pages/SimplePageWithPackages.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Proxies/PackageManagerWindowProxy.cs create mode 100644 Modules/PackageManagerUI/Editor/Services/Upm/OperationType.cs rename Modules/PackageManagerUI/Editor/UI/{Interfaces/ISelectableItem.cs => Details/BaseDetailsView.cs} (61%) create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/DetailsArea.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/InProgressView.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/PackageAuthorLabel.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/PackageDetails.cs rename Modules/PackageManagerUI/Editor/UI/{ => Details}/PackageDetailsBody.cs (77%) rename Modules/PackageManagerUI/Editor/UI/{ => Details}/PackageDetailsHeader.cs (88%) rename Modules/PackageManagerUI/Editor/UI/{ => Details}/PackageDetailsLinks.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Details}/PackagePlatformList.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Details}/PackageReleaseDetailsItem.cs (100%) create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/SampleDetails.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/SampleDetailsBody.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/SampleDetailsHeader.cs rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsDependenciesTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsDetailsTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsFeatureDependenciesTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsImagesTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsImportedAssetsTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsOverviewTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsReleasesTab.cs (100%) create mode 100644 Modules/PackageManagerUI/Editor/UI/Details/Tabs/PackageDetailsSampleItem.cs rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsSamplesTab.cs (84%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsTabElement.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsTabView.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsVersionHistoryItem.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/PackageDetailsVersionsTab.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/SignInDetails.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageDetailsTabs => Details/Tabs}/SortedColumn.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Details}/VersionInfoIcon.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Dropdowns}/AddPackageByNameDropdown.cs (98%) rename Modules/PackageManagerUI/Editor/UI/{ => Dropdowns}/CreatePackageDropdown.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Dropdowns}/DropdownContent.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Dropdowns}/GenericInputDropdown.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Dropdowns}/InProgressDropdown.cs (87%) rename Modules/PackageManagerUI/Editor/UI/{ => Extensions}/Interfaces/IPackageManagerExtension.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Extensions}/PackageManagerExtensions.cs (100%) delete mode 100644 Modules/PackageManagerUI/Editor/UI/Filters/AssetStoreFiltersWindow.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/Filters/PageFiltersWindow.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/Filters/UpmFiltersWindow.cs rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/DeprecatedPackageHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/DeprecatedVersionHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/DisabledPackageHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{Generic => HelpBoxes}/ExtendedHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/HiddenProductHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/NonCompliantPackageHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/PackageBaseHelpBox.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{PackageHelpBox => HelpBoxes}/PackageSignatureHelpBox.cs (100%) delete mode 100644 Modules/PackageManagerUI/Editor/UI/InProgressView.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/InformationCards/SampleInformationCard.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/InformationCards/SampleParentPackageDisplayNameCard.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/InformationCards/SampleSizeInfoCard.cs rename Modules/PackageManagerUI/Editor/UI/{ => Inspector}/PackageManifest.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => Inspector}/PackageManifestImporterEditor.cs (57%) create mode 100644 Modules/PackageManagerUI/Editor/UI/List/BaseListItem.cs rename Modules/PackageManagerUI/Editor/UI/{Interfaces/IPackageListView.cs => List/Interfaces/IItemListView.cs} (55%) create mode 100644 Modules/PackageManagerUI/Editor/UI/List/Interfaces/IListItem.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/List/ItemListScrollView.cs rename Modules/PackageManagerUI/Editor/UI/{PackageList.cs => List/ListArea.cs} (65%) create mode 100644 Modules/PackageManagerUI/Editor/UI/List/ListItemGroup.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/List/PackageItem.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/List/PackageListView.cs rename Modules/PackageManagerUI/Editor/UI/{ => List}/PackageLoadBar.cs (85%) rename Modules/PackageManagerUI/Editor/UI/{ => List}/PackageSearchBar.cs (77%) rename Modules/PackageManagerUI/Editor/UI/{ => List}/PackageStatusBar.cs (95%) rename Modules/PackageManagerUI/Editor/UI/{ => List}/PartiallyNonCompliantRegistryMessage.cs (83%) create mode 100644 Modules/PackageManagerUI/Editor/UI/List/SampleItem.cs rename Modules/PackageManagerUI/Editor/UI/{ => List}/SignInBar.cs (89%) rename Modules/PackageManagerUI/Editor/UI/{ => MainWindow}/MainContainerOverlay.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => MainWindow}/PackageManagerToolbar.cs (82%) rename Modules/PackageManagerUI/Editor/UI/{ => MainWindow}/PackageManagerWindow.cs (82%) rename Modules/PackageManagerUI/Editor/UI/{ => MainWindow}/PackageManagerWindowRoot.cs (76%) delete mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/MultiSelectFoldout.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/MultiSelectFoldoutBase.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/MultiSelectFoldoutGroup.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/MultiSelectItem.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/MultiSelectItemBase.cs rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/CheckUpdateFoldout.cs (78%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/DownloadFoldoutGroup.cs (92%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/DownloadUpdateFoldoutGroup.cs (93%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/InstallFoldoutGroup.cs (71%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{NoActionsFoldout.cs => Packages/NoActionsOnPackagesFoldout.cs} (59%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/OpenManifestExternallyFoldoutGroup.cs (84%) create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Packages/PackageMultiSelectFoldout.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Packages/PackageMultiSelectFoldoutGroup.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Packages/PackageMultiSelectItem.cs rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/RemoveFoldoutGroup.cs (75%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/RemoveImportedFoldoutGroup.cs (84%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/UnlockFoldout.cs (70%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/UpdateFoldout.cs (71%) rename Modules/PackageManagerUI/Editor/UI/MultiSelect/{ => Packages}/UpdateFoldoutGroup.cs (77%) create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Samples/NoActionsOnSamplesFoldout.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Samples/SampleMultiSelectFoldout.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/MultiSelect/Samples/SampleMultiSelectItem.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageDetails.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageDetailsTabs/PackageDetailsSampleItem.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageGroup.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageItem.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageListScrollView.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageListView.cs delete mode 100644 Modules/PackageManagerUI/Editor/UI/PackageManagerFiltersWindow.cs rename Modules/PackageManagerUI/Editor/UI/{ToolBar => PackageToolBar}/Interfaces/IPackageToolBarButton.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ToolBar => PackageToolBar}/LegacyFormatDropdownButton.cs (90%) rename Modules/PackageManagerUI/Editor/UI/{ToolBar => PackageToolBar}/PackageToolBar.cs (97%) create mode 100644 Modules/PackageManagerUI/Editor/UI/PackageToolBar/PackageToolBarButtonSingleAction.cs rename Modules/PackageManagerUI/Editor/UI/{ToolBar => PackageToolBar}/PackageToolBarError.cs (100%) create mode 100644 Modules/PackageManagerUI/Editor/UI/PackageToolBar/SampleToolBarButton.cs create mode 100644 Modules/PackageManagerUI/Editor/UI/PackageToolBar/ToolbarButtonBase.cs rename Modules/PackageManagerUI/Editor/UI/{ => ScopedRegistries}/RegistryItem.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => ScopedRegistries}/ScopedRegistriesSettings.cs (100%) rename Modules/PackageManagerUI/Editor/UI/{ => ScopedRegistries}/ScopedRegistryAddedPopup.cs (100%) delete mode 100644 Modules/PackageManagerUI/Editor/UI/ToolBar/PackageToolBarButtonSingleAction.cs rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Box Plot => BoxPlot}/BoxPlotModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Box Plot => BoxPlot}/BoxPlotViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Foldable Section => FoldableSection}/FoldableSectionViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Foldable Section => FoldableSection}/Implementations/AllocationsSectionViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Foldable Section => FoldableSection}/Implementations/FrameAllocationsSectionViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Foldable Section => FoldableSection}/Implementations/FrameTimesSectionViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Foldable Section => FoldableSection}/Implementations/SingleFrameTimesSectionViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame Bottlenecks => FrameBottlenecks}/FrameBottlenecksModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame Bottlenecks => FrameBottlenecks}/FrameBottlenecksViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame GC Allocations => FrameGCAllocations}/FrameGCAllocationsModel.cs (92%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame GC Allocations => FrameGCAllocations}/FrameGCAllocationsViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame GC Collect => FrameGCCollect}/FrameGCCollectModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Frame GC Collect => FrameGCCollect}/FrameGCCollectViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Bottlenecks Builders => ModelBuilders/BottlenecksBuilders}/BottlenecksModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Bottlenecks Builders => ModelBuilders/BottlenecksBuilders}/FrameBottlenecksModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Bottlenecks Builders => ModelBuilders/BottlenecksBuilders}/RangeBottlenecksModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Box Plot Builders => ModelBuilders/BoxPlotBuilders}/BoxPlotModelExtensions.cs (61%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Box Plot Builders => ModelBuilders/BoxPlotBuilders}/FrameTimesBoxPlotModelBuilder.cs (98%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Box Plot Builders => ModelBuilders/BoxPlotBuilders}/GCCollectBoxPlotModelBuilder.cs (99%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders => ModelBuilders}/BuilderUtility.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders => ModelBuilders}/FrameGCCollectModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders => ModelBuilders}/FrameSummaryModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/GC Allocations Builders => ModelBuilders/GCAllocationsBuilders}/GCAllocationsInFrameModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/GC Allocations Builders => ModelBuilders/GCAllocationsBuilders}/GCAllocationsInRangeModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Pie Chart Builders => ModelBuilders/PieChartBuilders}/MainThreadUtilizationPieChartModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders => ModelBuilders}/ProfilerFrameIndexOutOfBounds.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders => ModelBuilders}/RangeSummaryModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Systems Impact Builders => ModelBuilders/SystemsImpactBuilders}/SystemsImpactInFrameModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Systems Impact Builders => ModelBuilders/SystemsImpactBuilders}/SystemsImpactInRangeModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Systems Impact Builders => ModelBuilders/SystemsImpactBuilders}/SystemsImpactModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Top Markers Builders => ModelBuilders/TopMarkersBuilders}/TopFrameMarkersModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Top Markers Builders => ModelBuilders/TopMarkersBuilders}/TopMarkersCollection.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Top Markers Builders => ModelBuilders/TopMarkersBuilders}/TopMarkersModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Model Builders/Top Markers Builders => ModelBuilders/TopMarkersBuilders}/TopRangeMarkersModelBuilder.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Pie Chart => PieChart}/PieChartKeyItem.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Pie Chart => PieChart}/PieChartModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Pie Chart => PieChart}/PieChartViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Range Bottlenecks => RangeBottlenecks}/RangeBottlenecksModel.cs (61%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Range Bottlenecks => RangeBottlenecks}/RangeBottlenecksViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Range GC Allocations => RangeGCAllocations}/GCAllocationsModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Range GC Allocations => RangeGCAllocations}/GCAllocationsViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Selection Summary => SelectionSummary}/SelectionSummaryViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Systems Impact => SystemsImpact}/SystemImpactItem.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Systems Impact => SystemsImpact}/SystemsImpactModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Systems Impact => SystemsImpact}/SystemsImpactViewController.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Top Markers => TopMarkers}/TopMarkerDetailsProvider.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Top Markers => TopMarkers}/TopMarkerItem.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Top Markers => TopMarkers}/TopMarkersModel.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Top Markers => TopMarkers}/TopMarkersModelUtility.cs (100%) rename Modules/ProfilerEditor/ProfilerWindow/Bottlenecks/Details/Overview/{Top Markers => TopMarkers}/TopMarkersViewController.cs (100%) create mode 100644 Modules/QuickInstall/Editor/Implementation/QuickInstallAnalytics.cs create mode 100644 Modules/QuickInstall/Editor/Implementation/QuickInstallConfig.cs create mode 100644 Modules/QuickInstall/Editor/Implementation/QuickInstallMenuItem.cs create mode 100644 Modules/QuickInstall/Editor/Implementation/QuickInstallSettingsProvider.cs create mode 100644 Modules/QuickInstall/Editor/Implementation/QuickInstaller.cs create mode 100644 Modules/QuickInstall/Editor/InAppPurchasing.cs create mode 100644 Modules/QuickInstall/Editor/LevelPlay.cs create mode 100644 Modules/TextCoreTextEngine/Managed/TextAssets/FontAsset/FontAsset.Deprecated.cs create mode 100644 Modules/TextCoreTextEngine/Managed/TextAssets/TextSettings.Deprecated.cs rename Modules/TextCoreTextEngine/Managed/{TextShaderUtilities.cs => TextShaderUtilities.Deprecated.cs} (95%) rename Modules/TextCoreTextEngineEditor/Managed/{TextCoreShaderGUI.cs => TextCoreShaderGUI.Deprecated.cs} (97%) rename Modules/TextCoreTextEngineEditor/Managed/{TextCoreShaderGUIBitmap.cs => TextCoreShaderGUIBitmap.Deprecated.cs} (88%) rename Modules/TextCoreTextEngineEditor/Managed/{TextCoreShaderGUISDF.cs => TextCoreShaderGUISDF.Deprecated.cs} (98%) delete mode 100644 Modules/TextCoreTextEngineEditor/Managed/TextSettingsCreationMenu.cs delete mode 100644 Modules/UIElements/Core/GpuUpdateMode.cs create mode 100644 Modules/UIElements/Core/Renderer/UIRGpuUpdater.cs rename Modules/UIElements/Core/Renderer/{UIRMeshManagerStaged.cs => UIRMeshManagerBasic.cs} (69%) rename Modules/UIElements/Core/Renderer/{UIRMeshManagerMapped.cs => UIRMeshManagerTracked.cs} (94%) create mode 100644 Modules/UIElements/Core/Style/CustomPropertyList.cs create mode 100644 Modules/UIElements/Core/Style/Generated/StyleDataAllocator.gen.cs create mode 100644 Modules/UIElements/Core/Style/Generated/UIToolkitConverters.gen.cs create mode 100644 Modules/UIElements/Core/Style/UIToolkitConverters.cs create mode 100644 Modules/UIElementsEditor/Profiler/UIToolkitProfilerModule.cs create mode 100644 Modules/UIElementsEditor/USS/StyleSheetExtensions.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Commands/ReorderStyleRulesCommand.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Commands/SetAttributeCommand.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Commands/SetAttributeOverrideCommand.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Commands/SetStyleSheetsCommand.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Inspector/Controls/UxmlAssetUtilities.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/Inspector/Controls/UxmlAttributeChangeHandler.cs create mode 100644 Modules/UIToolkitAuthoringEditor/Managed/StyleSheets/StyleSheetEditingNodeTypeHandler.cs delete mode 100644 Runtime/2D/Common/ScriptBindings/SpriteRendererGroup.bindings.cs delete mode 100644 Runtime/Export/Scripting/CastHelper.cs delete mode 100644 Runtime/Scripting/Marshalling/ManagedObjectMarshalling.cs create mode 100644 Runtime/Transform/ScriptBindings/TransformHierarchy.bindings.cs delete mode 100644 artifacts/Stevedore/msbu-tools-win-x64_0c1e/msbuild.host/Unity.BuildService.Host.dll rename artifacts/Stevedore/{msbu-tools-win-x64_0c1e => msbu-tools-win-x64_a647}/asmDefToCSProj/AsmDefToCSProjLib.dll (99%) rename artifacts/Stevedore/{msbu-tools-win-x64_0c1e => msbu-tools-win-x64_a647}/buildTools/Unity.BuildService.dll (98%) rename artifacts/Stevedore/{msbu-tools-win-x64_0c1e => msbu-tools-win-x64_a647}/buildTools/UnityEditor.MSBuild.dll (97%) create mode 100644 artifacts/Stevedore/msbu-tools-win-x64_a647/msbuild.host/Unity.BuildService.Host.dll diff --git a/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs b/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs index da21ea42d1..bd679ca0ed 100644 --- a/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs +++ b/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs @@ -20,7 +20,7 @@ class AnimEditor : ScriptableObject [SerializeReference] private AnimationWindowState m_State; [SerializeReference] private DopeSheetEditor m_DopeSheet; [SerializeReference] private CurveEditor m_CurveEditor; - [SerializeField] private AnimationWindowHierarchy m_Hierarchy; + private AnimationWindowHierarchy m_Hierarchy; [SerializeField] private UnityEditor.AnimationWindowBuiltin.AnimationEventTimeLine m_Events; [SerializeField] private EditorWindow m_OwnerWindow; diff --git a/Editor/Mono/Animation/AnimationWindow/AnimationWindowState.cs b/Editor/Mono/Animation/AnimationWindow/AnimationWindowState.cs index bed8e50ef2..282b9c9087 100644 --- a/Editor/Mono/Animation/AnimationWindow/AnimationWindowState.cs +++ b/Editor/Mono/Animation/AnimationWindow/AnimationWindowState.cs @@ -7,7 +7,7 @@ using UnityEngine; using UnityEditor; using System.Collections.Generic; -using UnityEditor.IMGUI.Controls; +using Unity.Collections; using Object = UnityEngine.Object; using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; using static UnityEditor.AnimationUtility; @@ -609,9 +609,7 @@ public bool ShouldShowCurve(AnimationWindowCurve curve) Transform t = activeRootGameObject.transform.Find(curve.path); if (t != null) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!m_SelectionFilter.Contains(t.gameObject.GetEntityId())) -#pragma warning restore UA2001 return false; } else diff --git a/Editor/Mono/Animation/AnimationWindow/CurveEditorSettings.cs b/Editor/Mono/Animation/AnimationWindow/CurveEditorSettings.cs index dbe8c45ece..a9b8945adb 100644 --- a/Editor/Mono/Animation/AnimationWindow/CurveEditorSettings.cs +++ b/Editor/Mono/Animation/AnimationWindow/CurveEditorSettings.cs @@ -2,6 +2,7 @@ // Copyright (c) Unity Technologies. For terms of use, see // https://unity3d.com/legal/licenses/Unity_Reference_Only_License +using System; using UnityEngine; namespace UnityEditor @@ -46,6 +47,7 @@ public bool hasUnboundedRanges // Offset to move the labels along the horizontal axis to make room for the overlaid scrollbar in the // curve editor popup. public float hTickLabelOffset = 0; + [NonSerialized] public EditorGUIUtility.SkinnedColor wrapColor = new EditorGUIUtility.SkinnedColor(new Color(1.0f, 1.0f, 1.0f, 0.5f), new Color(.65f, .65f, .65f, 0.5f)); public bool useFocusColors = false; public bool showAxisLabels = true; diff --git a/Editor/Mono/Animation/AnimationWindow/RotationCurveInterpolation.cs b/Editor/Mono/Animation/AnimationWindow/RotationCurveInterpolation.cs index ece0fffa22..4c943b46c2 100644 --- a/Editor/Mono/Animation/AnimationWindow/RotationCurveInterpolation.cs +++ b/Editor/Mono/Animation/AnimationWindow/RotationCurveInterpolation.cs @@ -3,6 +3,8 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; using UnityEditorInternal; namespace UnityEditor @@ -42,27 +44,37 @@ public static string GetPrefixForInterpolation(Mode newInterpolationMode) return null; } + static List s_BindingsCache = new (); + static readonly Regex s_PropertyWithSuffixRegex = new (@"(?\.[xyz])$"); internal static EditorCurveBinding[] ConvertRotationPropertiesToInterpolationType(ReadOnlySpan selection, Mode newInterpolationMode) { - if (selection.Length != 4) - return selection.ToArray(); + if (s_BindingsCache.Capacity < selection.Length) + s_BindingsCache.Capacity = selection.Length; - if (GetModeFromCurveData(selection[0]) == Mode.RawQuaternions) + s_BindingsCache.Clear(); + for (int i = 0; i < selection.Length; ++i) { - EditorCurveBinding[] newCurves = new EditorCurveBinding[3]; - newCurves[0] = selection[0]; - newCurves[1] = selection[1]; - newCurves[2] = selection[2]; + if (GetModeFromCurveData(selection[i]) == Mode.RawQuaternions) + { + // Process x, y, z rotation bindings. Drop w channel. + var match = s_PropertyWithSuffixRegex.Match(selection[i].propertyName); + if (match.Success) + { + string prefix = GetPrefixForInterpolation(newInterpolationMode); - string prefix = GetPrefixForInterpolation(newInterpolationMode); - newCurves[0].propertyName = prefix + ".x"; - newCurves[1].propertyName = prefix + ".y"; - newCurves[2].propertyName = prefix + ".z"; + var newBinding = selection[i]; + newBinding.propertyName = prefix + match.Groups["suffix"]; - return newCurves; + s_BindingsCache.Add(newBinding); + } + } + else + { + s_BindingsCache.Add(selection[i]); + } } - else - return selection.ToArray(); + + return s_BindingsCache.ToArray(); } } } diff --git a/Editor/Mono/Animation/TickStyle.cs b/Editor/Mono/Animation/TickStyle.cs index cc9e3680e0..2e96e83610 100644 --- a/Editor/Mono/Animation/TickStyle.cs +++ b/Editor/Mono/Animation/TickStyle.cs @@ -6,7 +6,6 @@ namespace UnityEditor { - [System.Serializable] internal class TickStyle { public EditorGUIUtility.SkinnedColor tickColor = new EditorGUIUtility.SkinnedColor(new Color(0.0f, 0.0f, 0.0f, 0.2f), new Color(.45f, .45f, .45f, 0.2f)); // color and opacity of ticks diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterOutputData.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterOutputData.cs index bc11ceb74d..0c5e1c4d5f 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterOutputData.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterOutputData.cs @@ -4,6 +4,7 @@ using UnityEngine; using System.Collections.Generic; +using System; namespace UnityEditor.SpeedTree.Importer { @@ -27,6 +28,7 @@ internal class SpeedTreeImporterOutputData : ScriptableObject /// /// Represents the wind configuration parameters. /// + [NonSerialized] public SpeedTreeWindConfig9 m_WindConfig = new SpeedTreeWindConfig9(); /// diff --git a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterSettings.cs b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterSettings.cs index a6a84b45ee..6412e14e4c 100644 --- a/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterSettings.cs +++ b/Editor/Mono/AssetPipeline/SpeedTree/SpeedTreeImporterSettings.cs @@ -93,7 +93,9 @@ internal class MaterialInfo internal class LODMaterials { public List materials = new List(); + [System.NonSerialized] public Dictionary> lodToMaterials = new Dictionary>(); + [System.NonSerialized] public Dictionary matNameToIndex = new Dictionary(); public void AddLodMaterialIndex(int lod, int matIndex) diff --git a/Editor/Mono/Audio/Mixer/Bindings/AudioMixerController.cs b/Editor/Mono/Audio/Mixer/Bindings/AudioMixerController.cs index e848c5faa8..01563d147f 100644 --- a/Editor/Mono/Audio/Mixer/Bindings/AudioMixerController.cs +++ b/Editor/Mono/Audio/Mixer/Bindings/AudioMixerController.cs @@ -7,6 +7,7 @@ using System.Linq; using UnityEngine; using UnityEngine.Audio; +using Unity.Collections; using Object = UnityEngine.Object; using Random = System.Random; diff --git a/Editor/Mono/Audio/Mixer/GUI/AudioMixerSelection.cs b/Editor/Mono/Audio/Mixer/GUI/AudioMixerSelection.cs index 0be8c9b428..9e49d1f9f4 100644 --- a/Editor/Mono/Audio/Mixer/GUI/AudioMixerSelection.cs +++ b/Editor/Mono/Audio/Mixer/GUI/AudioMixerSelection.cs @@ -3,9 +3,9 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System.Collections.Generic; -using System.Linq; using UnityEngine; using UnityEditor.Audio; +using Unity.Collections; namespace UnityEditor { @@ -69,9 +69,7 @@ private void RefreshCachedChannelStripSelection() List allGroups = m_Controller.GetAllAudioGroupsSlow(); foreach (var g in allGroups) -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (selected.Contains(g)) -#pragma warning restore UA2001 ChannelStripSelection.Add(g); } diff --git a/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs b/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs index 7f67087960..444b1c1329 100644 --- a/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs +++ b/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs @@ -102,8 +102,9 @@ private static void LogBuildExceptionAndExit(string buildFunctionName, System.Ex public extern static CanAppendBuild BuildCanBeAppended(BuildTarget target, string location); [RequiredByNativeCode] - internal static BuildPlayerContext PreparePlayerBuild(BuildPlayerOptions buildPlayerOptions) + internal static BuildPlayerContext PreparePlayerBuild(IntPtr buildPlayerOptionsPtr) { + var buildPlayerOptions = BuildPlayerOptions.GetBuildPlayerOptions(buildPlayerOptionsPtr); var buildPlayerContext = new BuildPlayerContext(buildPlayerOptions); BuildPipelineInterfaces.PreparePlayerBuild(buildPlayerContext); return buildPlayerContext; diff --git a/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs b/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs index 0433ca1446..0c4ba8a300 100644 --- a/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs +++ b/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs @@ -11,12 +11,11 @@ using UnityEditor.Profiling; using UnityEditor.Rendering; using UnityEngine.Scripting; -using UnityEditor.AssetImporters; -using UnityEngine.SceneManagement; using UnityEditor.Build.Profile; using UnityEditor.Build.Content; using UnityEngine.Rendering; using UnityEngine.Bindings; +using Unity.Collections; namespace UnityEditor.Build { @@ -1393,9 +1392,7 @@ internal static string[] FilterAssembliesIncludedInBuild(BuildOptions buildOptio } } -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - if (!filteredAssemblies.All(x => startAssemblies.Contains(x))) -#pragma warning restore UA2001 + if (!Array.TrueForAll(filteredAssemblies, x => startAssemblies.Contains(x))) { throw new Exception("New Assembly names are in the list. Only filtering are allowed"); } diff --git a/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs b/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs index 0ff6f89e63..9ab2dd8b2d 100644 --- a/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs +++ b/Editor/Mono/BuildPipeline/BuildTargetDiscovery.bindings.cs @@ -74,6 +74,8 @@ public struct DiscoveredTargetInfo public bool HasFlag(TargetAttributes flag) { return (flags & flag) == flag; } } + internal static string k_ResourcesSDKPlatformInfoPath => Path.Combine(EditorApplication.applicationContentsPath, "Resources/SDKPlatformInfo"); + public static extern bool PlatformHasFlag(BuildTarget platform, TargetAttributes flag); public static extern bool PlatformGroupHasFlag(BuildTargetGroup group, TargetAttributes flag); @@ -250,6 +252,8 @@ enum PlatformAttributes IsLinuxServerBuildTarget = (1 << 11), IsVisibleInPlatformBrowserOnly = (1 << 12), IsDerivedBuildTarget = (1 << 13), + IsMultiTargetPlatform = (1 << 14), + IsSDKPlatform = (1 << 15) } public record struct NameAndLink(string name, string linkUrl); @@ -259,6 +263,7 @@ struct PlatformInfo public string downloadLinkName = String.Empty; public BuildTarget buildTarget = BuildTarget.NoTarget; public StandaloneBuildSubtarget subtarget = StandaloneBuildSubtarget.Default; + public GUID[] supportedPlatformGuids = Array.Empty(); public PlatformAttributes flags = PlatformAttributes.None; /// @@ -276,12 +281,14 @@ struct PlatformInfo /// public PlatformPackageList partnerPackages = new PlatformPackageList(); - public string description = L10n.Tr(""); + public string description = string.Empty; public string instructions = L10n.Tr("*standard install form hub"); public string iconName = "BuildSettings.Editor"; public string subtitle = string.Empty; public string settingsDocsLink = string.Empty; public List nameAndLinkToShowUnderTitle = null; + public string keyFeatures = string.Empty; + public string resources = string.Empty; // TODO: this is a workaround for onboarding instructions to fix EmbeddedLinux and QNX // needs to be removed when https://jira.unity3d.com/browse/PLAT-7721 is implemented @@ -292,6 +299,7 @@ public PlatformInfo() {} public bool HasFlag(PlatformAttributes flag) { return (flags & flag) == flag; } } + [Serializable] [VisibleToOtherModules("UnityEditor.BuildProfileModule")] internal class PlatformPackageList { @@ -300,14 +308,15 @@ internal class PlatformPackageList public PlatformPackageInfo[] recommendedPackages = Array.Empty(); } + [Serializable] [VisibleToOtherModules("UnityEditor.BuildProfileModule")] internal class PlatformPackageInfo { - public string displayName { get; } - public string qualifiedName { get; } - public string description { get; } - public string publisher { get; } - public bool hasThumbnail { get; } + public string displayName; + public string qualifiedName; + public string description; + public string publisher; + public bool hasThumbnail; public PlatformPackageInfo(string displayName, string qualifiedName, string description, string publisher = "", bool hasThumbnail = false) { @@ -874,6 +883,7 @@ public PlatformGroup() { } static BuildTargetDiscovery() { + LoadSDKPlatforms(); PreloadBuildPlatformInstalledData(); } public static IEnumerable GetAllPlatforms() => allPlatforms.Keys; @@ -972,6 +982,81 @@ public static (BuildTarget, StandaloneBuildSubtarget) GetBuildTargetAndSubtarget return (BuildTarget.NoTarget, StandaloneBuildSubtarget.Default); } + static void LoadSDKPlatforms() + { + if (!Directory.Exists(k_ResourcesSDKPlatformInfoPath)) + return; + + var sdkPlatformFiles = Directory.GetFiles(k_ResourcesSDKPlatformInfoPath, "*.SDKPlatform.json"); + foreach (var sdkPlatformFile in sdkPlatformFiles) + { + var text = File.ReadAllText(sdkPlatformFile); + SDKPlatformInfo sdkPlatformInfo; + try + { + sdkPlatformInfo = JsonUtility.FromJson(text, typeof(SDKPlatformInfo)) as SDKPlatformInfo; + } + catch (Exception) + { + continue; + } + + if (sdkPlatformInfo == null || string.IsNullOrEmpty(sdkPlatformInfo.guid)) + continue; + + var sdkPlatformGuid = new GUID(sdkPlatformInfo.guid); + if (allPlatforms.ContainsKey(sdkPlatformGuid)) + continue; + + var flags = PlatformAttributes.None; + switch (sdkPlatformInfo.flags.platformType) + { + case SDKPlatformType.Derived: + flags |= PlatformAttributes.IsDerivedBuildTarget; + if (sdkPlatformInfo.baseBuildTarget <= 0) + continue; + break; + case SDKPlatformType.MultiTarget: + flags |= PlatformAttributes.IsMultiTargetPlatform; + if (sdkPlatformInfo.supportedPlatformGuids == null || sdkPlatformInfo.supportedPlatformGuids.Length <= 0) + continue; + break; + } + + PlatformInfo platformInfo = new() + { + supportedPlatformGuids = sdkPlatformInfo.flags.platformType == SDKPlatformType.MultiTarget ? + Array.ConvertAll(sdkPlatformInfo.supportedPlatformGuids, s => new GUID(s)) : Array.Empty(), + buildTarget = sdkPlatformInfo.baseBuildTarget, + displayName = sdkPlatformInfo.displayName ?? string.Empty, + description = sdkPlatformInfo.description ?? string.Empty, + instructions = sdkPlatformInfo.instructions ?? string.Empty, + keyFeatures = sdkPlatformInfo.keyFeatures ?? string.Empty, + resources = sdkPlatformInfo.resources ?? string.Empty, + iconName = sdkPlatformInfo.iconName, + buildProfilePlatformBannerBgColorHex = sdkPlatformInfo.bannerBackgroundColorHex ?? "#00000000", + internalPackages = sdkPlatformInfo.internalPackages, + partnerPackages = sdkPlatformInfo.partnerPackages, + flags = flags | PlatformAttributes.IsSDKPlatform | PlatformAttributes.IsVisibleInPlatformBrowserOnly | + PlatformAttributes.IsWindowsBuildTarget | PlatformAttributes.IsWindowsArm64BuildTarget | + PlatformAttributes.IsLinuxBuildTarget | PlatformAttributes.IsMacBuildTarget, + }; + allPlatforms.Add(sdkPlatformGuid, platformInfo); + + if (string.IsNullOrEmpty(sdkPlatformInfo.platformGroupName)) + continue; + + var targetGroupName = L10n.Tr(sdkPlatformInfo.platformGroupName); + var groupIndex = Array.FindIndex(allPlatformGroups, g => g.groupName == targetGroupName); + if (groupIndex < 0) + continue; + + var platformsList = new List(allPlatformGroups[groupIndex].platforms); + platformsList.Add(sdkPlatformGuid); + allPlatformGroups[groupIndex].platforms = platformsList.ToArray(); + } + } + static void PreloadBuildPlatformInstalledData() { foreach (var platform in allPlatforms) @@ -980,7 +1065,8 @@ static void PreloadBuildPlatformInstalledData() // Considers that StandaloneWindows and StandaloneWindows64 are the same platform. if (platform.Value.buildTarget != BuildTarget.StandaloneWindows && platform.Value.subtarget != StandaloneBuildSubtarget.Server - && !platform.Value.HasFlag(PlatformAttributes.IsDerivedBuildTarget)) + && !platform.Value.HasFlag(PlatformAttributes.IsDerivedBuildTarget) + && !platform.Value.HasFlag(PlatformAttributes.IsMultiTargetPlatform)) { s_BuildTargetToPlatformGUID.Add(platform.Value.buildTarget, platform.Key); if (platform.Value.buildTarget == BuildTarget.StandaloneWindows64) @@ -1163,6 +1249,22 @@ public static string BuildPlatformDescription(GUID guid) return string.Empty; } + public static string BuildPlatformKeyFeatures(GUID guid) + { + if (allPlatforms.TryGetValue(guid, out PlatformInfo platformInfo)) + return platformInfo.keyFeatures; + + return string.Empty; + } + + public static string BuildPlatformResources(GUID guid) + { + if (allPlatforms.TryGetValue(guid, out PlatformInfo platformInfo)) + return platformInfo.resources; + + return string.Empty; + } + public static string GetPlatformColorString(GUID guid) { if (allPlatforms.TryGetValue(guid, out PlatformInfo platformInfo)) diff --git a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs index e869654cc8..3eadef274c 100644 --- a/Editor/Mono/BuildPipeline/NamedBuildTarget.cs +++ b/Editor/Mono/BuildPipeline/NamedBuildTarget.cs @@ -3,9 +3,8 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; -using System.ComponentModel; -using System.Linq; using UnityEngine.Internal; +using Unity.Collections; namespace UnityEditor.Build { @@ -88,9 +87,7 @@ namespace UnityEditor.Build internal NamedBuildTarget(string targetName) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!k_ValidNames.Contains(targetName)) -#pragma warning restore UA2001 { throw new ArgumentException($"'{targetName}' is not a valid build target name"); } diff --git a/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs b/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs index 291e25f367..60ccdc21c7 100644 --- a/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs +++ b/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs @@ -110,8 +110,10 @@ internal static string[] GetPreviousContentBuildMetadataLocations() [RequiredByNativeCode] - static public string PrepareForBuild(BuildPlayerOptions buildOptions) + static public string PrepareForBuild(IntPtr buildOptionsPtr) { + var buildOptions = BuildPlayerOptions.GetBuildPlayerOptions(buildOptionsPtr); + var postprocessor = ModuleManager.GetBuildPostProcessor(buildOptions.target); if (postprocessor == null) return null; diff --git a/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs b/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs index 020fb2d1b4..a49e59bbaa 100644 --- a/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs +++ b/Editor/Mono/BuildPipeline/Settings/BuildPlayerOptions.bindings.cs @@ -50,6 +50,7 @@ public struct BuildPlayerOptions ///* UserSettings/ /// ///**Note:** Paths pointing directly to the user desktop are not allowed. + [NativeName("path")] public string locationPathName { get; set; } ///The path to an manifest file describing all of the asset bundles used in the build (optional). ///When you call to create your AssetBundles, Unity will also generate a manifest file with a filename matching the parent directory name and ".manifest" as its extension. @@ -60,9 +61,11 @@ public struct BuildPlayerOptions ///See [Managed code stripping](xref:ManagedCodeStripping) for more information about code stripping. public string assetBundleManifestPath { get; set; } ///The to build. + [NativeName("platformGroup")] public BuildTargetGroup targetGroup { get; set; } ///The to build. /// + [NativeName("platform")] public BuildTarget target { get; set; } ///The Subtarget to build. ///For certain platforms, setting a non-zero value for this property can modify the build behaviour. @@ -86,5 +89,9 @@ public struct BuildPlayerOptions ///The additional preprocessor defines you can specify while compiling assemblies for the Player. These defines are appended to the existing Scripting Define Symbols list configured in the Player settings. public string[] extraScriptingDefines { get; set; } /*UCBP-PUBLIC*/ internal string[] previousBuildMetadataLocations { get; set; } + + [NativeHeader("Editor/Src/BuildPipeline/BuildPlayerOptions.h")] + [FreeFunction("BuildPipeline::GetBuildPlayerSetup")] + internal static extern BuildPlayerOptions GetBuildPlayerOptions(IntPtr dataPtr); } } diff --git a/Editor/Mono/BuildProfile/BuildProfileContext.cs b/Editor/Mono/BuildProfile/BuildProfileContext.cs index 81d58bedde..a90b9de19b 100644 --- a/Editor/Mono/BuildProfile/BuildProfileContext.cs +++ b/Editor/Mono/BuildProfile/BuildProfileContext.cs @@ -13,6 +13,7 @@ using UnityEngine; using UnityEngine.Bindings; using UnityEngine.Scripting; +using UnityEngine.Experimental.Rendering; using UnityEditor.EngineDiagnostics; namespace UnityEditor.Build.Profile @@ -69,10 +70,10 @@ internal static BuildProfile activeProfile get { var profile = EditorUserBuildSettings.activeBuildProfile; - + if (profile == null || !profile) return null; - + return profile; } @@ -118,7 +119,7 @@ internal static BuildProfile activeProfile activeProfileChanged?.Invoke(prev, value); EditorGraphicsSettings.activeProfileHasGraphicsSettings = ActiveProfileHasGraphicsSettings(); value.scriptingDefines = BuildProfileModuleUtil.RemoveInvalidScriptingDefines(value.scriptingDefines); - + if (!ArrayUtility.ArrayEquals(prevDefines, value.scriptingDefines)) BuildProfileModuleUtil.RequestScriptCompilation(value); } @@ -127,7 +128,6 @@ internal static BuildProfile activeProfile [VisibleToOtherModules] internal static PlatformPackageServiceInfoProvider packageServiceInfoProvider = new(); - [SerializeField] List m_PackageAddInfos = new(); [VisibleToOtherModules] @@ -839,6 +839,42 @@ static Shader[] GetActiveAlwaysIncludedShaders() return activeProfile.graphicsSettings.alwaysIncludedShaders; } + [RequiredByNativeCode, UsedImplicitly] + static GraphicsStateCollection GetActiveGraphicsStateCollection() + { + if (!ActiveProfileHasGraphicsSettings()) + return null; + + return activeProfile?.graphicsSettings.graphicsStateCollection; + } + + [RequiredByNativeCode, UsedImplicitly] + static string GetActiveTraceSavePath() + { + if (!ActiveProfileHasGraphicsSettings()) + return string.Empty; + + return activeProfile?.graphicsSettings.traceSavePath; + } + + [RequiredByNativeCode, UsedImplicitly] + static GraphicsStateCollection[] GetActiveAdditionalWarmupCollections() + { + if (!ActiveProfileHasGraphicsSettings()) + return null; + + return activeProfile?.graphicsSettings.additionalWarmupCollections; + } + + [RequiredByNativeCode, UsedImplicitly] + static string GetActiveCacheMissCollectionPath() + { + if (!ActiveProfileHasGraphicsSettings()) + return string.Empty; + + return activeProfile?.graphicsSettings.cacheMissCollectionPath; + } + [RequiredByNativeCode, UsedImplicitly] static ShaderVariantCollection[] GetActiveShaderVariantCollections() { diff --git a/Editor/Mono/BuildProfile/BuildProfileGraphicsSettings.cs b/Editor/Mono/BuildProfile/BuildProfileGraphicsSettings.cs index 01d66af039..aa3855b7db 100644 --- a/Editor/Mono/BuildProfile/BuildProfileGraphicsSettings.cs +++ b/Editor/Mono/BuildProfile/BuildProfileGraphicsSettings.cs @@ -9,6 +9,7 @@ using UnityEditor.Rendering; using UnityEditor.Shaders; using System.Runtime.CompilerServices; +using UnityEngine.Experimental.Rendering; [assembly: InternalsVisibleTo("UnityEditor.Rendering.ShaderBuildSettings.Tests")] namespace UnityEditor.Build.Profile @@ -37,6 +38,15 @@ sealed class BuildProfileGraphicsSettings : ScriptableObject [SerializeField] VideoShadersIncludeMode m_VideoShadersIncludeMode = VideoShadersIncludeMode.Always; [SerializeField] Shader[] m_AlwaysIncludedShaders = Array.Empty(); [SerializeField] LightProbeOutsideHullStrategy m_LightProbeOutsideHullStrategy = LightProbeOutsideHullStrategy.kLightProbeSearchTetrahedralHull; + [SerializeField] GraphicsStateCollection m_GraphicsStateCollection = null; + [SerializeField] GraphicsStateCollectionStartupAction m_CollectionStartupAction = GraphicsStateCollectionStartupAction.None; + [SerializeField] string m_TraceSavePath = "TracedCollection"; + [SerializeField] bool m_TraceSendToEditor = true; + [SerializeField] GraphicsStateCollection[] m_AdditionalWarmupCollections = Array.Empty(); + [SerializeField] bool m_WarmupAsync = true; + [SerializeField] int m_WarmupProgressivelyLimit = -1; + [SerializeField] bool m_EnableCacheMissTracing = false; + [SerializeField] string m_CacheMissCollectionPath = "CacheMissCollection"; [SerializeField] ShaderVariantCollection[] m_PreloadedShaders = Array.Empty(); [SerializeField] int m_PreloadShadersBatchTimeLimit = -1; [SerializeField] ShaderBuildSettings m_ShaderBuildSettings; @@ -155,6 +165,59 @@ internal LightProbeOutsideHullStrategy lightProbeOutsideHullStrategy set => m_LightProbeOutsideHullStrategy = value; } + internal GraphicsStateCollection graphicsStateCollection + { + get => m_GraphicsStateCollection; + set => m_GraphicsStateCollection = value; + } + + internal GraphicsStateCollectionStartupAction collectionStartupAction + { + get => m_CollectionStartupAction; + set => m_CollectionStartupAction = value; + } + + internal string traceSavePath + { + get => m_TraceSavePath; + set => m_TraceSavePath = value; + } + + internal bool traceSendToEditor + { + get => m_TraceSendToEditor; + set => m_TraceSendToEditor = value; + } + + internal GraphicsStateCollection[] additionalWarmupCollections + { + get => m_AdditionalWarmupCollections; + set => m_AdditionalWarmupCollections = value; + } + + internal bool warmupAsync + { + get => m_WarmupAsync; + set => m_WarmupAsync = value; + } + + internal int warmupProgressivelyLimit + { + get => m_WarmupProgressivelyLimit; + set => m_WarmupProgressivelyLimit = value; + } + + internal bool enableCacheMissTracing + { + get => m_EnableCacheMissTracing; + set => m_EnableCacheMissTracing = value; + } + internal string cacheMissCollectionPath + { + get => m_CacheMissCollectionPath; + set => m_CacheMissCollectionPath = value; + } + internal ShaderVariantCollection[] preloadedShaders { get => m_PreloadedShaders; @@ -237,6 +300,21 @@ public void SetGraphicsSetting(string settingName, int value) case "LightProbeOutsideHullStrategy": lightProbeOutsideHullStrategy = (LightProbeOutsideHullStrategy)value; break; + case "CollectionStartupAction": + collectionStartupAction = (GraphicsStateCollectionStartupAction)value; + break; + case "TraceSendToEditor": + traceSendToEditor = IntegerToBoolean(value); + break; + case "WarmupAsync": + warmupAsync = IntegerToBoolean(value); + break; + case "WarmupProgressivelyLimit": + warmupProgressivelyLimit = value; + break; + case "EnableCacheMissTracing": + enableCacheMissTracing = IntegerToBoolean(value); + break; case "PreloadShadersBatchTimeLimit": preloadShadersBatchTimeLimit = value; break; @@ -267,6 +345,11 @@ public int GetGraphicsSetting(string settingName) "CameraRelativeShadowCulling" => BooleanToInteger(cameraRelativeShadowCulling), "VideoShadersIncludeMode" => (int)videoShadersIncludeMode, "LightProbeOutsideHullStrategy" => (int)lightProbeOutsideHullStrategy, + "CollectionStartupAction" => (int)collectionStartupAction, + "TraceSendToEditor" => BooleanToInteger(traceSendToEditor), + "WarmupAsync" => BooleanToInteger(warmupAsync), + "WarmupProgressivelyLimit" => warmupProgressivelyLimit, + "EnableCacheMissTracing" => BooleanToInteger(enableCacheMissTracing), "PreloadShadersBatchTimeLimit" => preloadShadersBatchTimeLimit, _ => k_InvalidGraphicsSetting, }; diff --git a/Editor/Mono/BuildProfile/BuildProfileGraphicsSettingsEditor.cs b/Editor/Mono/BuildProfile/BuildProfileGraphicsSettingsEditor.cs index e646ba5756..c491a8d399 100644 --- a/Editor/Mono/BuildProfile/BuildProfileGraphicsSettingsEditor.cs +++ b/Editor/Mono/BuildProfile/BuildProfileGraphicsSettingsEditor.cs @@ -39,6 +39,7 @@ public override VisualElement CreateInspectorGUI() BindEnumFieldWithFadeGroup(root, "Lightmap", CalculateLightmapStrippingFromCurrentScene); BindEnumFieldWithFadeGroup(root, "Fog", CalculateFogStrippingFromCurrentScene); + GraphicsStateCollectionSettingsUI.BindGraphicsStateCollection(root, serializedObject); BindShaderPreload(root); m_ShaderBuildSettingsUI.Initialize(root, serializedObject, true); @@ -71,9 +72,15 @@ void BindEnumFieldWithFadeGroup(VisualElement content, string id, Action buttonC void BindShaderPreload(VisualElement root) { + var shaderPreloadElements = root.MandatoryQ("PreloadedShaders"); var shaderPreloadProperty = serializedObject.FindProperty("m_PreloadedShaders"); shaderPreloadProperty.isExpanded = false; - + shaderPreloadElements.RegisterValueChangeCallback(evt => + { + UIElementsEditorUtility.SetVisibility(root.MandatoryQ("RecommendGSCInfoBox"), shaderPreloadProperty.arraySize > 0); + shaderPreloadProperty.serializedObject.ApplyModifiedProperties(); + }); + var delayedShaderTimeLimitProperty = serializedObject.FindProperty("m_PreloadShadersBatchTimeLimit"); var shaderPreloadToggle = root.MandatoryQ("ShaderPreloadToggle"); var delayedShaderTimeLimitGroup = root.MandatoryQ("DelayedShaderTimeLimitGroup"); diff --git a/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs b/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs index fcce26a64a..e8d83a36db 100644 --- a/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs +++ b/Editor/Mono/BuildProfile/BuildProfileModuleUtil.cs @@ -160,12 +160,6 @@ public static void UpdateActiveEditors(BuildProfile profile) public static string GetClassicPlatformDisplayName(GUID platformId) => GetModuleDisplayName(platformId); - /// - /// Platform description. - /// - public static string GetPlatformDescription(GUID platformGuid) => - BuildTargetDiscovery.BuildPlatformDescription(platformGuid); - /// /// Get Platform list of name and link url pair. /// @@ -904,6 +898,18 @@ public static string BuildPlatformDescription(GUID platformGuid) return BuildTargetDiscovery.BuildPlatformDescription(platformGuid); } + /// + /// Get platform key features text. + /// + public static string BuildPlatformKeyFeatures(GUID platformGuid) => + BuildTargetDiscovery.BuildPlatformKeyFeatures(platformGuid); + + /// + /// Get platform resources text. + /// + public static string BuildPlatformResources(GUID platformGuid) => + BuildTargetDiscovery.BuildPlatformResources(platformGuid); + public static string GetPlatformColorString(GUID platformGuid) { return BuildTargetDiscovery.GetPlatformColorString(platformGuid); diff --git a/Editor/Mono/Clipboard/Clipboard.cs b/Editor/Mono/Clipboard/Clipboard.cs index 8548774641..083ddca891 100644 --- a/Editor/Mono/Clipboard/Clipboard.cs +++ b/Editor/Mono/Clipboard/Clipboard.cs @@ -272,6 +272,27 @@ public static EntityId entityIdValue set => EditorGUIUtility.systemCopyBuffer = value.ToString(); } + public static bool hasLoadableReference + { + get + { + FetchState(); + m_State.FetchLoadableReference(); + return m_State.m_HasLoadableReference.Value; + } + } + + public static LoadableReference loadableReferenceValue + { + get + { + FetchState(); + m_State.FetchLoadableReference(); + return m_State.m_ValueLoadableReference; + } + set => EditorGUIUtility.systemCopyBuffer = ClipboardParser.WriteCustom(new LoadableReferenceWrapper(value)); + } + public static bool hasVector3 { get diff --git a/Editor/Mono/Clipboard/ClipboardContextMenu.cs b/Editor/Mono/Clipboard/ClipboardContextMenu.cs index e3a9a0adc0..3ca4294756 100644 --- a/Editor/Mono/Clipboard/ClipboardContextMenu.cs +++ b/Editor/Mono/Clipboard/ClipboardContextMenu.cs @@ -162,6 +162,12 @@ internal static void SetupPropertyCopyPaste(SerializedProperty property, Generic p => Clipboard.hasEntityId, p => p.entityIdValue = Clipboard.entityIdValue); break; + case SerializedPropertyType.LoadableReference: + SetupAction(property, menu, evt, + p => Clipboard.loadableReferenceValue = p.loadableReferenceValue, + p => Clipboard.hasLoadableReference, + p => p.loadableReferenceValue = Clipboard.loadableReferenceValue); + break; case SerializedPropertyType.Generic: if (property.type == "MinMaxGradient") { diff --git a/Editor/Mono/Clipboard/ClipboardParser.cs b/Editor/Mono/Clipboard/ClipboardParser.cs index 1cecf290d7..2a037e38a4 100644 --- a/Editor/Mono/Clipboard/ClipboardParser.cs +++ b/Editor/Mono/Clipboard/ClipboardParser.cs @@ -427,6 +427,9 @@ internal static Dictionary WriteGenericSerializedProperty(Serial var bi = p.boundsIntValue; res["val"] = WriteBounds(new Bounds(bi.center, bi.size)); break; + case SerializedPropertyType.LoadableReference: + res["val"] = WriteCustom(new LoadableReferenceWrapper(p.loadableReferenceValue)); + break; // Copy/Paste of these for generic serialized properties is not implemented yet. case SerializedPropertyType.ExposedReference: break; @@ -546,6 +549,10 @@ internal static void ParseGenericSerializedProperty(SerializedProperty prop, Dic new Vector3Int((int)biValue.center.x, (int)biValue.center.y, (int)biValue.center.z), new Vector3Int((int)biValue.size.x, (int)biValue.size.y, (int)biValue.size.z)); break; + case SerializedPropertyType.LoadableReference: + if (ParseCustom(Convert.ToString(oval), out var loadableRefWrapper)) + prop.loadableReferenceValue = loadableRefWrapper.ToLoadableReference(); + break; // Copy/Paste of these for generic serialized properties is not implemented yet. case SerializedPropertyType.FixedBufferSize: break; @@ -652,4 +659,16 @@ internal class AnimationCurveWrapper public AnimationCurveWrapper(AnimationCurve g) { curve = g; } public AnimationCurve curve; } + + [Serializable] + internal class LoadableReferenceWrapper + { + public LoadableReferenceWrapper() { } + + public LoadableReferenceWrapper(LoadableReference r) { loadableReference = r; } + + public LoadableReference loadableReference; + + public LoadableReference ToLoadableReference() => loadableReference; + } } diff --git a/Editor/Mono/Clipboard/ClipboardState.cs b/Editor/Mono/Clipboard/ClipboardState.cs index 3f38b3f04f..5a0ca67ccb 100644 --- a/Editor/Mono/Clipboard/ClipboardState.cs +++ b/Editor/Mono/Clipboard/ClipboardState.cs @@ -42,6 +42,18 @@ internal void FetchEntityId() m_HasEntityId = ClipboardParser.ParseEntityId(m_RawContents, out m_ValueEntityId); } + internal bool? m_HasLoadableReference; + internal LoadableReference m_ValueLoadableReference; + internal void FetchLoadableReference() + { + if (!m_HasLoadableReference.HasValue) + { + var ok = ClipboardParser.ParseCustom(m_RawContents, out var wrapper); + m_HasLoadableReference = ok; + m_ValueLoadableReference = ok ? wrapper.ToLoadableReference() : default; + } + } + internal bool? m_HasBool; internal bool m_ValueBool; internal void FetchBool() diff --git a/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs b/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs index 5612c277c2..b1f443c038 100644 --- a/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs +++ b/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs @@ -6,9 +6,9 @@ using System.IO; using System.Linq; using Unity.CodeEditor; +using Unity.Collections; using UnityEditorInternal; using UnityEngine; -using UnityEngine.Assertions; using NiceIO; namespace UnityEditor @@ -128,9 +128,7 @@ static bool SupportsExtension(string path) var extension = Path.GetExtension(path); if (string.IsNullOrEmpty(extension)) return false; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. return DefaultExtensions.Contains(extension.TrimStart('.')); -#pragma warning restore UA2001 } public bool OpenProject(string path, int line, int column) diff --git a/Editor/Mono/ContainerWindow.cs b/Editor/Mono/ContainerWindow.cs index b070206605..c975ec28c3 100644 --- a/Editor/Mono/ContainerWindow.cs +++ b/Editor/Mono/ContainerWindow.cs @@ -19,7 +19,7 @@ namespace UnityEditor [VisibleToOtherModules("UnityEditor.UIBuilderModule", "UnityEditor.GraphToolkitModule")] internal partial class ContainerWindow : ScriptableObject { - [SerializeField] MonoReloadableIntPtr m_WindowPtr; + MonoReloadableIntPtr m_WindowPtr; [SerializeField] Rect m_PixelRect; [SerializeField] int m_ShowMode; [SerializeField] string m_Title = ""; diff --git a/Editor/Mono/EditorGUI.cs b/Editor/Mono/EditorGUI.cs index f3d1c4dff5..a8dcf9e8bc 100644 --- a/Editor/Mono/EditorGUI.cs +++ b/Editor/Mono/EditorGUI.cs @@ -4490,6 +4490,24 @@ private static void ObjectFieldInternal(Rect position, SerializedProperty proper DoObjectField(position, position, id, objType, property, validator, allowSceneObjects, style); } + private static void LoadableReferenceField(Rect position, SerializedProperty property, GUIContent label) + { + Object currentObject = LoadableReferenceEditorUtility.LoadableReferenceToObject(property.loadableReferenceValue); + + BeginChangeCheck(); + Object newObject = ObjectField(position, label, currentObject, typeof(Object), false); + if (EndChangeCheck()) + { + LoadableReference newLoadableRef = LoadableReferenceEditorUtility.ObjectToLoadableReference(newObject); + if (newObject != null && !newLoadableRef.isValid) + { + Debug.LogWarning(L10n.Tr("The selected object cannot be used as a LoadableReference.")); + return; + } + property.loadableReferenceValue = newLoadableRef; + } + } + public static Object ObjectField(Rect position, Object obj, Type objType, Object targetBeingEdited) { int id = GUIUtility.GetControlID(s_ObjectFieldHash, FocusType.Keyboard, position); @@ -7621,6 +7639,7 @@ internal static bool HasVisibleChildFields(SerializedProperty property, bool isU case SerializedPropertyType.Hash128: case SerializedPropertyType.GUID: case SerializedPropertyType.EntityId: + case SerializedPropertyType.LoadableReference: return false; } @@ -7936,6 +7955,11 @@ internal static bool DefaultPropertyField(Rect position, SerializedProperty prop } break; } + case SerializedPropertyType.LoadableReference: + { + LoadableReferenceField(position, property, label); + break; + } default: { int genericID = GUIUtility.GetControlID(s_GenericField, FocusType.Keyboard, position); diff --git a/Editor/Mono/EditorResources.cs b/Editor/Mono/EditorResources.cs index f43d1e8482..672a1f358c 100644 --- a/Editor/Mono/EditorResources.cs +++ b/Editor/Mono/EditorResources.cs @@ -161,7 +161,7 @@ internal static string GetDefaultFont() return FontDef.k_Inter; } - internal static IEnumerable supportedFontNames => EditorResources.supportedFonts.Keys; + internal static IReadOnlyCollection supportedFontNames => supportedFonts.Keys; private static string s_CurrentFontName = null; @@ -174,9 +174,7 @@ internal static string currentFontName s_CurrentFontName = EditorPrefs.GetString(k_PrefsUserFontKey, GetDefaultFont()); // If the current is not available then fallback to the default font -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - if (!supportedFontNames.Contains(s_CurrentFontName)) -#pragma warning restore UA2001 + if (!supportedFonts.ContainsKey(s_CurrentFontName)) { s_CurrentFontName = GetDefaultFont(); EditorPrefs.DeleteKey(k_PrefsUserFontKey); diff --git a/Editor/Mono/EditorSceneManager.bindings.cs b/Editor/Mono/EditorSceneManager.bindings.cs index 5db5c55b83..1d2903d826 100644 --- a/Editor/Mono/EditorSceneManager.bindings.cs +++ b/Editor/Mono/EditorSceneManager.bindings.cs @@ -230,12 +230,11 @@ internal static void RemapAssetReferencesInScene(UnityEngine.SceneManagement.Sce [StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)] [NativeMethod("GetSceneManagerSetup", ThrowsException = true)] - [return: UnityMarshalAs(NativeType.ScriptingObjectPtr)] public extern static SceneSetup[] GetSceneManagerSetup(); [StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)] [NativeMethod("RestoreSceneManagerSetup", ThrowsException = true)] - public extern static void RestoreSceneManagerSetup([UnityMarshalAs(NativeType.ScriptingObjectPtr)] SceneSetup[] value); + public extern static void RestoreSceneManagerSetup(SceneSetup[] value); [StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)] [NativeMethod("LoadSceneManagerSetup")] diff --git a/Editor/Mono/GUI/AnimatedValues.cs b/Editor/Mono/GUI/AnimatedValues.cs index 6977257c67..138bfb94af 100644 --- a/Editor/Mono/GUI/AnimatedValues.cs +++ b/Editor/Mono/GUI/AnimatedValues.cs @@ -8,6 +8,7 @@ namespace UnityEditor.AnimatedValues { + [Serializable] public abstract class BaseAnimValueNonAlloc : BaseAnimValue where T : IEquatable { protected BaseAnimValueNonAlloc(T value) : base(value) @@ -24,6 +25,7 @@ protected override bool AreEqual(T a, T b) } } + [Serializable] public abstract class BaseAnimValue : ISerializationCallbackReceiver { T m_Start; diff --git a/Editor/Mono/GUI/LoadableReferenceDrawer.cs b/Editor/Mono/GUI/LoadableReferenceDrawer.cs deleted file mode 100644 index bb0439e54e..0000000000 --- a/Editor/Mono/GUI/LoadableReferenceDrawer.cs +++ /dev/null @@ -1,129 +0,0 @@ -// 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.UIElements; -using UnityEditor.UIElements; -using Object = UnityEngine.Object; - -namespace UnityEditor -{ - [CustomPropertyDrawer(typeof(LoadableReference))] - internal sealed class LoadableReferenceDrawer : PropertyDrawer - { - struct LoadableReferenceProperties - { - public SerializedProperty guidProperty; - public SerializedProperty typeProperty; - public SerializedProperty fileIDProperty; - public SerializedProperty objectIdHashProperty; - } - - private static LoadableReference ExtractLoadableRef(LoadableReferenceProperties props) - { - GUID guid = props.guidProperty.boxedValue != null ? (GUID)props.guidProperty.boxedValue : new GUID(); - FileIdentifierType type = (FileIdentifierType)props.typeProperty.intValue; - long fileID = props.fileIDProperty.longValue; - return LoadableReferenceEditorUtility.CreateLoadableReference(guid, type, fileID); - } - - // Override CreatePropertyGUI and OnGUI to support both UI tech. - public override VisualElement CreatePropertyGUI(SerializedProperty property) - { - ExtractLoadableReferenceProperties(property, out LoadableReferenceProperties props); - - LoadableReference loadableRef = ExtractLoadableRef(props); - Object currentObject = LoadableReferenceEditorUtility.LoadableReferenceToObject(loadableRef); - - var container = new VisualElement(); - - var objectField = new ObjectField(property.displayName) - { - allowSceneObjects = false, - objectType = typeof(Object), - value = currentObject - }; - objectField.SetEnabled(true); - objectField.AddToClassList(ObjectField.alignedFieldUssClassName); - objectField.labelElement.AddToClassList(PropertyField.labelUssClassName); - - container.Add(objectField); - - objectField.TrackPropertyValue(props.guidProperty, newProperty => - { - UpdateObjectFieldFromLoadableReferenceProperties(objectField, props); - }); - - objectField.TrackPropertyValue(props.typeProperty, newProperty => - { - UpdateObjectFieldFromLoadableReferenceProperties(objectField, props); - }); - - objectField.TrackPropertyValue(props.fileIDProperty, newProperty => - { - UpdateObjectFieldFromLoadableReferenceProperties(objectField, props); - }); - - objectField.RegisterCallback((ChangeEvent e) => - { - OnValueChanged(e.newValue, props); - }); - - return container; - } - - static void ExtractLoadableReferenceProperties(SerializedProperty property, out LoadableReferenceProperties props) - { - var guidPath = $"{property.propertyPath}.m_GUID"; - var typePath = $"{property.propertyPath}.m_Type"; - var fileIDPath = $"{property.propertyPath}.m_FileID"; - var objectIdHashPath = $"{property.propertyPath}.m_ObjectIdHash"; - - props.guidProperty = property.serializedObject.FindProperty(guidPath); - props.typeProperty = property.serializedObject.FindProperty(typePath); - props.fileIDProperty = property.serializedObject.FindProperty(fileIDPath); - props.objectIdHashProperty = property.serializedObject.FindProperty(objectIdHashPath); - - if (props.guidProperty == null || props.typeProperty == null || props.fileIDProperty == null) - throw new Exception("LoadableReference properties not found"); - } - - public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - { - ExtractLoadableReferenceProperties(property, out LoadableReferenceProperties props); - LoadableReference loadableRef = ExtractLoadableRef(props); - Object currentObject = LoadableReferenceEditorUtility.LoadableReferenceToObject(loadableRef); - - EditorGUI.BeginChangeCheck(); - label = EditorGUI.BeginProperty(position, label, property); - - var newObject = EditorGUI.ObjectField(position, label, currentObject, typeof(Object), false); - - if (EditorGUI.EndChangeCheck()) - OnValueChanged(newObject, props); - } - - private static void UpdateObjectFieldFromLoadableReferenceProperties(ObjectField objectField, LoadableReferenceProperties props) - { - LoadableReference loadableRef = ExtractLoadableRef(props); - objectField.value = LoadableReferenceEditorUtility.LoadableReferenceToObject(loadableRef); - } - - private static void OnValueChanged(Object newObject, LoadableReferenceProperties props) - { - LoadableReference loadableRef = LoadableReferenceEditorUtility.ObjectToLoadableReference(newObject); - if (newObject != null && !loadableRef.isValid) - { - Debug.LogWarning("Cannot create valid LoadableReference from object. Object may not be persistent."); - return; - } - - props.guidProperty.boxedValue = loadableRef.m_GUID; - props.typeProperty.intValue = (int)loadableRef.m_FileIdentifierType; - props.fileIDProperty.longValue = loadableRef.m_LocalIdentifierInFile; - props.guidProperty.serializedObject.ApplyModifiedProperties(); - } - } -} diff --git a/Editor/Mono/GUI/PackageExportTreeView.cs b/Editor/Mono/GUI/PackageExportTreeView.cs index e198aa7b03..4e1ee5ca24 100644 --- a/Editor/Mono/GUI/PackageExportTreeView.cs +++ b/Editor/Mono/GUI/PackageExportTreeView.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using UnityEditor.IMGUI.Controls; using UnityEditor.Utils; using UnityEngine; using UnityEditorInternal; using UnityEditor.Experimental; +using Unity.Collections; using TreeViewController = UnityEditor.IMGUI.Controls.TreeViewController; using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; @@ -144,9 +144,7 @@ void SelectionChanged(int[] selectedIDs) var visibleItems = m_TreeView.data.GetRows(); foreach (var visibleItem in visibleItems) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (selectedIDs.Contains(visibleItem.id)) -#pragma warning restore UA2001 { var pitem = visibleItem as PackageExportTreeViewItem; if (pitem != null) @@ -319,9 +317,7 @@ void DoToggle(PackageExportTreeViewItem pitem, Rect toggleRect) if (EditorGUI.EndChangeCheck()) { // Only change selection if we already have single selection (Keep multi-selection when toggling) -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (m_TreeView.GetSelection().Length <= 1 || !m_TreeView.GetSelection().Contains(pitem.id)) -#pragma warning restore UA2001 { m_TreeView.SetSelection(new int[] { pitem.id }, false); m_TreeView.NotifyListenersThatSelectionChanged(); diff --git a/Editor/Mono/GUI/PackageImportTreeView.cs b/Editor/Mono/GUI/PackageImportTreeView.cs index 33f2d8a357..b8b7815919 100644 --- a/Editor/Mono/GUI/PackageImportTreeView.cs +++ b/Editor/Mono/GUI/PackageImportTreeView.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using UnityEditor.IMGUI.Controls; using UnityEditor.Utils; using UnityEngine; using UnityEditorInternal; using UnityEditor.Experimental; +using Unity.Collections; using TreeViewController = UnityEditor.IMGUI.Controls.TreeViewController; using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; using TreeViewUtility = UnityEditor.IMGUI.Controls.TreeViewUtility; @@ -184,9 +184,7 @@ void SelectionChanged(int[] selectedIDs) var visibleItems = m_TreeView.data.GetRows(); foreach (var visibleItem in visibleItems) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (selectedIDs.Contains(visibleItem.id)) -#pragma warning restore UA2001 { var pitem = visibleItem as PackageImportTreeViewItem; if (pitem != null) @@ -517,9 +515,7 @@ void DoToggle(PackageImportTreeViewItem pitem, Rect toggleRect) if (EditorGUI.EndChangeCheck()) { // Only change selection if we already have single selection (Keep multi-selection when toggling) -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (m_TreeView.GetSelection().Length <= 1 || !m_TreeView.GetSelection().Contains(pitem.id)) -#pragma warning restore UA2001 { m_TreeView.SetSelection(new int[] { pitem.id }, false); m_TreeView.NotifyListenersThatSelectionChanged(); diff --git a/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs b/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs index 9ab8fe4719..d6950203d4 100644 --- a/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs +++ b/Editor/Mono/GUI/TreeView/MultiColumnHeader.cs @@ -540,9 +540,7 @@ protected virtual void AddColumnHeaderContextMenuItems(GenericMenu menu) var column = state.columns[i]; var menuText = !string.IsNullOrEmpty(column.contextMenuText) ? column.contextMenuText : column.headerContent.text; if (column.allowToggleVisibility) -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. menu.AddItem(new GUIContent(menuText), state.visibleColumns.Contains(i), ToggleVisibility, i); -#pragma warning restore UA2001 else menu.AddDisabledItem(new GUIContent(menuText)); } diff --git a/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestDragging.cs b/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestDragging.cs index 2cfdf95d77..a47094b61b 100644 --- a/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestDragging.cs +++ b/Editor/Mono/GUI/TreeView/TreeViewTests/TreeViewTestDragging.cs @@ -38,7 +38,7 @@ public TestDragging(TreeViewController treeView, BackendData data) public override void StartDrag(TreeViewItem draggedItem, List draggedItemIDs) { DragAndDrop.PrepareStartDrag(); - DragAndDrop.SetGenericData(k_GenericDragID, new FooDragData(GetItemsFromIDs(draggedItemIDs))); + DragAndDrop.SetGenericData(k_GenericDragID, new FooDragData(FindItemsFromIDs(draggedItemIDs))); string title = draggedItemIDs.Count + " Foo" + (draggedItemIDs.Count > 1 ? "s" : ""); // title is only shown on OSX (at the cursor) DragAndDrop.StartDrag(title); } @@ -81,7 +81,7 @@ bool ValidDrag(TreeViewItem parent, List draggedItems) return true; } - private List GetItemsFromIDs(IEnumerable draggedItemIDs) + private List FindItemsFromIDs(IReadOnlyList draggedItemIDs) { // Note we only drag visible items here... return TreeViewUtility.FindItemsInList(draggedItemIDs, m_TreeView.data.GetRows()); diff --git a/Editor/Mono/GUI/TreeView/TreeViewUtililty.cs b/Editor/Mono/GUI/TreeView/TreeViewUtililty.cs index febd3ef28e..400d1b4270 100644 --- a/Editor/Mono/GUI/TreeView/TreeViewUtililty.cs +++ b/Editor/Mono/GUI/TreeView/TreeViewUtililty.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Unity.Collections; namespace UnityEditor.IMGUI.Controls { @@ -40,7 +41,7 @@ internal static void SetDepthValuesForItems(TreeViewItem root) } } - internal static List> FindItemsInList(IEnumerable itemIDs, IList> treeViewItems) + internal static List> FindItemsInList(IReadOnlyList itemIDs, IList> treeViewItems) { #pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. return (from x in treeViewItems where itemIDs.Contains(x.id) select x).ToList(); diff --git a/Editor/Mono/GUIDebugger/StyleDrawInspectView.cs b/Editor/Mono/GUIDebugger/StyleDrawInspectView.cs index 7340d0dd76..20c5cfcf66 100644 --- a/Editor/Mono/GUIDebugger/StyleDrawInspectView.cs +++ b/Editor/Mono/GUIDebugger/StyleDrawInspectView.cs @@ -23,7 +23,9 @@ class StyleDrawInspectView : BaseInspectView [Serializable] class CachedInstructionInfo { + [NonSerialized] public SerializedObject styleContainerSerializedObject = null; + [NonSerialized] public SerializedProperty styleSerializedProperty = null; public readonly GUIStyleHolder styleContainer; diff --git a/Editor/Mono/Graphics/GraphicsStateCollectionSettingsUI.cs b/Editor/Mono/Graphics/GraphicsStateCollectionSettingsUI.cs new file mode 100644 index 0000000000..ed541acd85 --- /dev/null +++ b/Editor/Mono/Graphics/GraphicsStateCollectionSettingsUI.cs @@ -0,0 +1,77 @@ +// 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.UIElements; +using UnityEditor.UIElements; + +namespace UnityEditor.Rendering +{ + internal enum GraphicsStateCollectionStartupAction + { + None = 0, + BeginTrace = 1, + Warmup = 2 + } + + // UI for the GraphicsStateCollection-related settings inside Graphics Settings (also used in Build Profiles when overriding Graphics Settings) + internal static class GraphicsStateCollectionSettingsUI + { + public static void BindGraphicsStateCollection(VisualElement root, SerializedObject settingsDataStore) + { + // Group visibility based on collection startup action + var loadedGSCProperty = settingsDataStore.FindProperty("m_GraphicsStateCollection"); + var loadedGSCElement = root.MandatoryQ("GraphicsStateCollection"); + var warningElement = root.MandatoryQ("WarmupWithoutCollectionWarning"); + var startupProperty = settingsDataStore.FindProperty("m_CollectionStartupAction"); + var startupEnumElement = root.MandatoryQ("CollectionStartupAction"); + var traceElements = root.MandatoryQ("TraceCollectionSettings"); + var warmupElements = root.MandatoryQ("WarmupCollectionSettings"); + UIElementsEditorUtility.SetVisibility(traceElements, (GraphicsStateCollectionStartupAction)startupProperty.enumValueFlag == GraphicsStateCollectionStartupAction.BeginTrace); + UIElementsEditorUtility.SetVisibility(warmupElements, (GraphicsStateCollectionStartupAction)startupProperty.enumValueFlag == GraphicsStateCollectionStartupAction.Warmup); + UIElementsEditorUtility.BindSerializedProperty(startupEnumElement, startupProperty, mode => + { + UIElementsEditorUtility.SetVisibility(traceElements, mode == GraphicsStateCollectionStartupAction.BeginTrace); + UIElementsEditorUtility.SetVisibility(warmupElements, mode == GraphicsStateCollectionStartupAction.Warmup); + if (!loadedGSCProperty.objectReferenceValue) + UIElementsEditorUtility.SetVisibility(warningElement, mode == GraphicsStateCollectionStartupAction.Warmup); + }); + + // Warmup settings + loadedGSCElement.RegisterValueChangedCallback(evt => + { + loadedGSCProperty.objectReferenceValue = evt.newValue; + loadedGSCProperty.serializedObject.ApplyModifiedProperties(); + warmupElements.SetEnabled(loadedGSCProperty.objectReferenceValue); + if ((GraphicsStateCollectionStartupAction)startupProperty.enumValueFlag == GraphicsStateCollectionStartupAction.Warmup) + UIElementsEditorUtility.SetVisibility(warningElement, !loadedGSCProperty.objectReferenceValue); + }); + + var warmupAfterFirstSceneToggle = root.MandatoryQ("WarmupAfterFirstSceneToggle"); + var warmupProgressivelyElement = root.MandatoryQ("WarmupProgressivelyLimit"); + var warmupProgressivelyProperty = settingsDataStore.FindProperty("m_WarmupProgressivelyLimit"); + warmupAfterFirstSceneToggle.RegisterValueChangedCallback(evt => + { + warmupProgressivelyElement.SetEnabled(evt.newValue); + // Use the m_WarmupProgressivelyLimit property to represent both the limit and the warmupAfterFirstScene toggle value + var defaultLimit = evt.newValue ? 0 : -1; + if (warmupProgressivelyProperty.intValue != defaultLimit) + { + warmupProgressivelyProperty.intValue = defaultLimit; + warmupProgressivelyProperty.serializedObject.ApplyModifiedProperties(); + } + }); + + var cacheMissTracingToggle = root.MandatoryQ("CacheMissTracingToggle"); + var cacheMissCollectionProperty = settingsDataStore.FindProperty("m_EnableCacheMissTracing"); + var cacheMissCollectionPathElement = root.MandatoryQ("CacheMissCollectionPath"); + cacheMissTracingToggle.RegisterValueChangedCallback(evt => + { + cacheMissCollectionProperty.boolValue = evt.newValue; + cacheMissCollectionProperty.serializedObject.ApplyModifiedProperties(); + cacheMissCollectionPathElement.SetEnabled(cacheMissCollectionProperty.boolValue); + }); + } + } +} diff --git a/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs b/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs index ada319a53a..e208d72c85 100644 --- a/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs +++ b/Editor/Mono/ImportSettings/TextureImportPlatformSettings.cs @@ -11,6 +11,7 @@ namespace UnityEditor { + [Serializable] internal abstract class BaseTextureImportPlatformSettings { static class Styles @@ -239,7 +240,6 @@ public TextureImporterPlatformSettings platformTextureSettings set { m_PlatformSettings = value; } } - [SerializeField] private SerializedProperty m_SerializedPlatformSettings = null; public SerializedProperty platformTextureSettingsProp @@ -255,7 +255,7 @@ public bool overriddenIsDifferent set { m_OverriddenIsDifferent = value; } } - [SerializeField] private SerializedProperty m_OverriddenProperty = null; + private SerializedProperty m_OverriddenProperty = null; public SerializedProperty overriddenProperty { get { return m_OverriddenProperty; } @@ -279,7 +279,7 @@ public bool maxTextureSizeIsDifferent set { m_MaxTextureSizeIsDifferent = value; } } - [SerializeField] private SerializedProperty m_MaxTextureSizeProperty = null; + private SerializedProperty m_MaxTextureSizeProperty = null; public SerializedProperty maxTextureSizeProperty { get { return m_MaxTextureSizeProperty; } @@ -294,7 +294,7 @@ public bool resizeAlgorithmIsDifferent set { m_ResizeAlgorithmIsDifferent = value; } } - [SerializeField] private SerializedProperty m_ResizeAlgorithmProperty = null; + private SerializedProperty m_ResizeAlgorithmProperty = null; public SerializedProperty resizeAlgorithmProperty { get { return m_ResizeAlgorithmProperty; } @@ -309,7 +309,7 @@ public bool textureCompressionIsDifferent set { m_TextureCompressionIsDifferent = value; } } - [SerializeField] private SerializedProperty m_TextureCompressionProperty = null; + private SerializedProperty m_TextureCompressionProperty = null; public SerializedProperty textureCompressionProperty { get { return m_TextureCompressionProperty; } @@ -324,7 +324,7 @@ public bool compressionQualityIsDifferent set { m_CompressionQualityIsDifferent = value; } } - [SerializeField] private SerializedProperty m_CompressionQualityProperty = null; + private SerializedProperty m_CompressionQualityProperty = null; public SerializedProperty compressionQualityProperty { get { return m_CompressionQualityProperty; } @@ -339,7 +339,7 @@ public bool crunchedCompressionIsDifferent set { m_CrunchedCompressionIsDifferent = value; } } - [SerializeField] private SerializedProperty m_CrunchedCompressionProperty = null; + private SerializedProperty m_CrunchedCompressionProperty = null; public SerializedProperty crunchedCompressionProperty { get { return m_CrunchedCompressionProperty; } @@ -354,7 +354,7 @@ public bool textureFormatIsDifferent set { m_TextureFormatIsDifferent = value; } } - [SerializeField] private SerializedProperty m_TextureFormatProperty = null; + private SerializedProperty m_TextureFormatProperty = null; public SerializedProperty textureFormatProperty { get { return m_TextureFormatProperty; } @@ -369,7 +369,7 @@ public bool allowsAlphaSplitIsDifferent set { m_AlphaSplitIsDifferent = value; } } - [SerializeField] private SerializedProperty m_AlphaSplitProperty = null; + private SerializedProperty m_AlphaSplitProperty = null; public SerializedProperty alphaSplitProperty { get { return m_AlphaSplitProperty; } @@ -385,7 +385,7 @@ public bool androidETC2FallbackOverrideIsDifferent set { m_AndroidETC2FallbackOverrideIsDifferent = value; } } - [SerializeField] private SerializedProperty m_AndroidETC2FallbackOverrideProperty = null; + private SerializedProperty m_AndroidETC2FallbackOverrideProperty = null; public SerializedProperty androidETC2FallbackOverrideProperty { get { return m_AndroidETC2FallbackOverrideProperty; } diff --git a/Editor/Mono/ImportSettings/TextureImporterInspector.cs b/Editor/Mono/ImportSettings/TextureImporterInspector.cs index f4ee29c85e..04d812aed6 100644 --- a/Editor/Mono/ImportSettings/TextureImporterInspector.cs +++ b/Editor/Mono/ImportSettings/TextureImporterInspector.cs @@ -1791,7 +1791,7 @@ public override bool HasModified() } - [Obsolete("UnityUpgradeable () -> DiscardChanges")] + [Obsolete("Please use DiscardChanges.")] protected override void ResetValues() { DiscardChanges(); diff --git a/Editor/Mono/Inspector/CameraEditorUtils.cs b/Editor/Mono/Inspector/CameraEditorUtils.cs index 8ea04089a6..c4d6ee3a78 100644 --- a/Editor/Mono/Inspector/CameraEditorUtils.cs +++ b/Editor/Mono/Inspector/CameraEditorUtils.cs @@ -385,6 +385,19 @@ public void Dispose() } } + [InitializeOnLoadMethod] + static void ReleasePreviewTexture() + { + RenderPipelineManager.activeRenderPipelineAssetChanged += (_, __) => + { + if (s_PreviewTexture != null) + { + s_PreviewTexture.Release(); + s_PreviewTexture = null; + } + }; + } + static RenderTexture GetPreviewTexture(int width, int height, bool hdr) { if (s_PreviewTexture != null @@ -412,7 +425,6 @@ static RenderTexture GetPreviewTexture(int width, int height, bool hdr) // SRPs s_PreviewTexture.enableRandomWrite = true; } - return s_PreviewTexture; } diff --git a/Editor/Mono/Inspector/Core/AddComponent/NewScriptDropdownItem.cs b/Editor/Mono/Inspector/Core/AddComponent/NewScriptDropdownItem.cs index 387de106ab..3d2edd1ade 100644 --- a/Editor/Mono/Inspector/Core/AddComponent/NewScriptDropdownItem.cs +++ b/Editor/Mono/Inspector/Core/AddComponent/NewScriptDropdownItem.cs @@ -4,7 +4,6 @@ using System; using System.IO; -using System.Linq; using UnityEngine; using UnityEditorInternal; using Microsoft.CSharp; @@ -83,9 +82,7 @@ private bool InvalidTargetPath() { if (m_Directory.IndexOfAny(kInvalidPathChars) >= 0) return true; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (TargetDir().Split(kPathSepChars, StringSplitOptions.None).Contains(string.Empty)) -#pragma warning restore UA2001 return true; return false; } diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs index 56a8e2ce8c..2ccd80a8d0 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownGUI.cs @@ -27,6 +27,8 @@ private static class Styles margin = new RectOffset(5, 4, 4, 5) }; public static SVC searchBackgroundColor = new SVC("--theme-toolbar-background-color", Color.black); + public static GUIStyle helpBox; + public static GUIStyle helpBoxText; public static GUIContent checkMarkContent = new GUIContent("✔"); @@ -36,6 +38,16 @@ static Styles() { headerEllipsis.padding.left = 20; headerEllipsis.clipping = TextClipping.Ellipsis; + helpBox = new GUIStyle(EditorStyles.helpBox) + { + padding = new RectOffset(8, 8, 8, 8), + margin = new RectOffset(6, 6, 6, 6) + }; + + helpBoxText = new GUIStyle(EditorStyles.label) + { + wordWrap = true, + }; } } @@ -146,6 +158,46 @@ internal virtual void DrawLineSeparator() GUI.color = orgColor; } + internal virtual void DrawHelpBox(AdvancedDropdownItem.HelpBoxDropdownItem helpBoxItem) + { + // Height must be computed with the same style as the calculate height + float height = CalcHelpBoxHeight(helpBoxItem); + var rect = GUILayoutUtility.GetRect(GUIContent.none, Styles.helpBox, GUILayout.ExpandWidth(true), GUILayout.Height(height)); + + // Compute inner rect (respects helpbox padding) + var inner = Styles.helpBox.padding.Remove(rect); + + // Icon settings + const float iconSize = 24f; + const float gap = 6f; + + var icon = EditorGUIUtility.GetHelpIcon(helpBoxItem.type); + + // Center icon vertically within the inner rect + float iconY = inner.y + (inner.height - iconSize) * 0.5f; + var iconRect = new Rect(inner.x, iconY, iconSize, iconSize); + + // Text rect starts after icon + float textX = iconRect.xMax + gap; + var textRect = new Rect(textX, inner.y, inner.xMax - textX, inner.height); + + if (Event.current.type != EventType.Repaint) + return; + + // Background + GUI.Label(rect, GUIContent.none, Styles.helpBox); + + // Icon + Text + GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit, true); + GUI.Label(textRect, helpBoxItem.message, Styles.helpBoxText); + } + + internal float CalcHelpBoxHeight(AdvancedDropdownItem.HelpBoxDropdownItem helpBoxItem) + { + float contentWidth = EditorGUIUtility.currentViewWidth; + return Styles.helpBoxText.CalcHeight(new GUIContent(helpBoxItem.message), contentWidth) + Styles.helpBox.padding.vertical * 2; + } + internal void DrawHeader(AdvancedDropdownItem group, Action backButtonPressed, bool hasParent) { var content = group.content; @@ -294,6 +346,10 @@ private void CalculateTreeSize(AdvancedDropdownItem root, ref float maxWidth, re { maxHeight += Styles.lineSeparator.CalcHeight(content, maxWidth) + Styles.lineSeparator.margin.vertical; } + else if (child is AdvancedDropdownItem.HelpBoxDropdownItem helpBox) + { + maxHeight += CalcHelpBoxHeight(helpBox); + } else { maxHeight += CalcItemHeight(content, maxWidth); diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownItem.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownItem.cs index 3cedd6d607..6f5cf67ecd 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownItem.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownItem.cs @@ -124,11 +124,21 @@ public void AddSeparator() AddChild(k_SeparatorItem); } + internal void AddHelpBox(string message, MessageType type) + { + AddChild(new HelpBoxDropdownItem(message, type)); + } + internal bool IsSeparator() { return k_SeparatorItem == this; } + internal bool IsHelpBox(AdvancedDropdownItem item) + { + return item is HelpBoxDropdownItem; + } + public override string ToString() { return m_Name; @@ -151,5 +161,16 @@ public SeparatorDropdownItem() : base("SEPARATOR") { } } + + internal class HelpBoxDropdownItem : AdvancedDropdownItem + { + public string message { get; } + public MessageType type { get; } + public HelpBoxDropdownItem(string message, MessageType type) : base(message) + { + this.type = type; + this.message = message; + } + } } } diff --git a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs index f35487b70a..3e93106313 100644 --- a/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs +++ b/Editor/Mono/Inspector/Core/AdvancedDropdown/AdvancedDropdownWindow.cs @@ -425,6 +425,10 @@ private void DrawList(AdvancedDropdownItem item) { m_Gui.DrawLineSeparator(); } + else if (child is AdvancedDropdownItem.HelpBoxDropdownItem helpBox) + { + m_Gui.DrawHelpBox(helpBox); + } else { m_Gui.DrawItem(child, child.displayName, child.icon, child.enabled, child.hasChildren, selected, hasSearch); diff --git a/Editor/Mono/Inspector/Core/PropertyEditor.cs b/Editor/Mono/Inspector/Core/PropertyEditor.cs index 4bcd62c948..71f0e76355 100644 --- a/Editor/Mono/Inspector/Core/PropertyEditor.cs +++ b/Editor/Mono/Inspector/Core/PropertyEditor.cs @@ -21,6 +21,7 @@ using Object = UnityEngine.Object; using AssetImporterEditor = UnityEditor.AssetImporters.AssetImporterEditor; using JetBrains.Annotations; +using Unity.Collections; using Unity.Profiling; using UnityEditor.UIElements; using UnityEngine.Pool; @@ -102,7 +103,7 @@ class PropertyEditor : EditorWindow, IPropertyView, IHasCustomMenu [SerializeField] protected List m_ObjectsLockedBeforeSerialization = new List(); [SerializeField] protected List m_EntityIdsLockedBeforeSerialization = new List(); [SerializeField] protected PreviewResizer m_PreviewResizer = new PreviewResizer(); - [SerializeField] protected LabelGUI m_LabelGUI = new LabelGUI(); + protected LabelGUI m_LabelGUI = new LabelGUI(); [SerializeField] protected EntityId m_LastInspectedObjectEntityId = EntityId.None; [SerializeField] protected float m_LastVerticalScrollValue = 0; [SerializeField] protected string m_GlobalObjectId = ""; @@ -1045,9 +1046,7 @@ private void ExtractPrefabComponents() var removedComponentsList = PrefabOverridesUtility.GetRemovedComponentsForSingleGameObject(go); for (int i = 0; i < removedComponentsList.Count; i++) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (actuallyRemovedComponents.Contains(removedComponentsList[i].assetComponent)) -#pragma warning restore UA2001 m_RemovedComponents.Add(removedComponentsList[i].assetComponent); else m_SuppressedComponents.Add(removedComponentsList[i].assetComponent); diff --git a/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs b/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs index 5932999e5f..d9eb865e73 100644 --- a/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs +++ b/Editor/Mono/Inspector/Core/Utils/InspectorWindowUtils.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using UnityEngine; using Object = UnityEngine.Object; @@ -114,7 +115,7 @@ internal static bool IsExcludedClass(Object target) return ModuleMetadata.GetModuleIncludeSettingForObject(target) == ModuleIncludeSetting.ForceExclude; } - private static Dictionary s_ObsoleteTypes; + private static Dictionary s_ObsoleteTypeMessages; public static void DisplayDeprecationMessageIfNecessary(Editor editor) { @@ -123,24 +124,24 @@ public static void DisplayDeprecationMessageIfNecessary(Editor editor) return; } - if (s_ObsoleteTypes == null) + if (s_ObsoleteTypeMessages == null) { var obsoleteTypes = TypeCache.GetTypesWithAttribute(); - s_ObsoleteTypes = new Dictionary(obsoleteTypes.Count); + s_ObsoleteTypeMessages = new Dictionary(obsoleteTypes.Count); foreach (var type in obsoleteTypes) { - var attr = (ObsoleteAttribute)Attribute.GetCustomAttribute(type, typeof(ObsoleteAttribute)); - s_ObsoleteTypes[type] = attr; + var attr = type.GetCustomAttribute(); + var message = string.IsNullOrEmpty(attr.Message) ? "This component has been marked as obsolete." : attr.Message; + message = ObsoleteMessageHelper.StripVersionTags(message); + var messageType = attr.IsError ? MessageType.Error : MessageType.Warning; + s_ObsoleteTypeMessages[type] = (message, messageType); } } - if (!s_ObsoleteTypes.TryGetValue(editor.target.GetType(), out var obsoleteAttribute)) - { + if (!s_ObsoleteTypeMessages.TryGetValue(editor.target.GetType(), out var obsoleteMessage)) return; - } - var message = string.IsNullOrEmpty(obsoleteAttribute.Message) ? "This component has been marked as obsolete." : obsoleteAttribute.Message; - EditorGUILayout.HelpBox(message, obsoleteAttribute.IsError ? MessageType.Error : MessageType.Warning); + EditorGUILayout.HelpBox(obsoleteMessage.Item1, obsoleteMessage.Item2); } public static void DrawAddedComponentBackground(Rect position, Object[] targets, float adjust = 0) diff --git a/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs b/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs new file mode 100644 index 0000000000..1742be3cee --- /dev/null +++ b/Editor/Mono/Inspector/Core/Utils/ObsoleteMessageHelper.cs @@ -0,0 +1,23 @@ +// 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.RegularExpressions; + +namespace UnityEditor +{ + static class ObsoleteMessageHelper + { + static Regex s_VersionTagRegex; + // Matches version tags in the format #tagName(MAJOR.MINOR) where tagName is any latin letters. + // Examples: #from(2022.3), #breakingFrom(6000.5) + static Regex VersionTagRegex => s_VersionTagRegex ??= + new Regex(@"#[a-zA-Z]+\(\d+\.\d+\)", RegexOptions.Compiled | RegexOptions.CultureInvariant); + + internal static string StripVersionTags(string message) + { + var match = VersionTagRegex.Match(message); + return !match.Success ? message.Trim() : message.Substring(0, match.Index).Trim(); + } + } +} diff --git a/Editor/Mono/Inspector/Editor.cs b/Editor/Mono/Inspector/Editor.cs index ab43932f10..369bcbcbec 100644 --- a/Editor/Mono/Inspector/Editor.cs +++ b/Editor/Mono/Inspector/Editor.cs @@ -14,6 +14,7 @@ using UnityEngine.Rendering; using UnityEngine.Scripting; using UnityEngine.UIElements; +using Unity.Collections; using Component = UnityEngine.Component; using UnityObject = UnityEngine.Object; @@ -844,9 +845,7 @@ protected internal static void DrawPropertiesExcluding(SerializedObject obj, par { expanded = false; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (propertyToExclude.Contains(property.name)) -#pragma warning restore UA2001 continue; EditorGUILayout.PropertyField(property, true); diff --git a/Editor/Mono/Inspector/GraphicsSettingsInspector.cs b/Editor/Mono/Inspector/GraphicsSettingsInspector.cs index caf6c4faeb..ee38394b4b 100644 --- a/Editor/Mono/Inspector/GraphicsSettingsInspector.cs +++ b/Editor/Mono/Inspector/GraphicsSettingsInspector.cs @@ -16,6 +16,7 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UIElements; +using Unity.Collections; using Button = UnityEngine.UIElements.Button; using HelpBox = UnityEngine.UIElements.HelpBox; @@ -36,6 +37,10 @@ internal static class GraphicsSettingsData EditorGUIUtility.TrTextContent("A Scriptable Render Pipeline is in use. Settings in the Built-In Render Pipeline are not currently in use."); internal static readonly string k_BuildProfileGraphicsSettingsOverrideWarning = L10n.Tr("The current active build profile has overridden certain Graphics settings. To ensure that the correct settings are included in your build, see the Build Profiles..."); + internal static readonly string k_GraphicsSettingsBuiltinInfo = + L10n.Tr("The Built-In Render Pipeline is deprecated. Migrate your project to the Universal Render Pipeline instead."); + internal static readonly string k_GraphicsSettingsBuiltinWarning = + L10n.Tr("If you don't assign a render pipeline asset in your project, Unity uses the Built-In Render Pipeline which is deprecated. Migrate your project to the Universal Render Pipeline instead."); } internal IEnumerable globalSettings => m_GlobalSettings; @@ -45,6 +50,8 @@ internal static class GraphicsSettingsData ScrollView m_ScrollView; List m_GlobalSettings; HelpBox m_BuildProfileGraphicsSettingsOverrideWarning; + ObjectFieldWithPrompt m_DefaultRenderPipelineField; + HelpBox m_BiRPDeprecationInfoBox; internal static Action OnActiveProfileGraphicsSettingsChanged; readonly Dictionary> m_Labels = new(); @@ -120,10 +127,13 @@ void Setup(bool globalSettingsExist) UpdateBuildProfileGraphicsSettingsOverrideWarning(); OnActiveProfileGraphicsSettingsChanged += UpdateBuildProfileGraphicsSettingsOverrideWarning; + SetupBiRPDeprecationInfoBox(m_CurrentRoot); + BindEnumFieldWithFadeGroup(m_CurrentRoot, "Lightmap", ShaderUtil.CalculateLightmapStrippingFromCurrentScene); BindEnumFieldWithFadeGroup(m_CurrentRoot, "Fog", ShaderUtil.CalculateFogStrippingFromCurrentScene); BindEnumFieldToLightProbe(m_CurrentRoot); + GraphicsStateCollectionSettingsUI.BindGraphicsStateCollection(m_CurrentRoot, serializedObject); BindShaderPreload(m_CurrentRoot); m_ShaderBuildSettingsUI.Initialize(m_CurrentRoot, serializedObject, false); @@ -167,9 +177,12 @@ void BindShaderPreload(VisualElement root) //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")); if (EditorGUI.EndChangeCheck()) + { shaderPreloadProperty.serializedObject.ApplyModifiedProperties(); + UIElementsEditorUtility.SetVisibility(root.MandatoryQ("RecommendGSCInfoBox"), shaderPreloadProperty.arraySize > 0 && shaderPreloadProperty.GetArrayElementAtIndex(0).objectReferenceValue); + } }; - + var delayedShaderTimeLimitProperty = serializedObject.FindProperty("m_PreloadShadersBatchTimeLimit"); var shaderPreloadToggle = root.MandatoryQ("ShaderPreloadToggle"); var delayedShaderTimeLimitGroup = root.MandatoryQ("DelayedShaderTimeLimitGroup"); @@ -194,7 +207,7 @@ void BindShaderPreload(VisualElement root) shaderPreloadToggle.SetValueWithoutNotify(delayedShaderTimeLimitProperty.intValue >= 0); delayedShaderTimeLimit.SetValueWithoutNotify(Mathf.Max(0, delayedShaderTimeLimitProperty.intValue)); delayedShaderTimeLimitGroup.style.display = delayedShaderTimeLimitProperty.intValue >= 0 ? DisplayStyle.Flex : DisplayStyle.None; - + var shaderTracking = root.MandatoryQ("ShaderTrackingInfoBox"); shaderTracking.schedule.Execute(() => shaderTracking.text = @@ -384,6 +397,62 @@ void UpdateBuildProfileGraphicsSettingsOverrideWarning() m_BuildProfileGraphicsSettingsOverrideWarning.style.display = DisplayStyle.None; } + void SetupBiRPDeprecationInfoBox(VisualElement root) + { + m_BiRPDeprecationInfoBox = root.Q("BiRPDeprecationInfoBox"); + if (m_BiRPDeprecationInfoBox == null) + return; + +// Workaround, as there is a bug in the documentation forwarder that causes links containing a / to be broken: + m_BiRPDeprecationInfoBox.linkHref = $"https://docs.unity3d.com/{Application.unityVersionVer}.{Application.unityVersionMaj}/Documentation/Manual/urp/upgrading-from-birp.html"; + +// Use this once the documentation forwarder has been fixed +// Slack thread: https://unity.slack.com/archives/CTD5B2N7J/p1765805896918059 +// Ticket: https://jira.unity3d.com/browse/WEBDOCS-2894 +// m_BiRPDeprecationInfoBox.linkHref = System.IO.Path.Combine(Help.baseDocumentationUrl, "urp", "upgrading-from-birp"); + + m_DefaultRenderPipelineField = root.Q("DefaultRenderPipeline"); + if (m_DefaultRenderPipelineField != null) + m_DefaultRenderPipelineField.RegisterValueChangedCallback(evt => UpdateBiRPDeprecationInfoBox()); + + UpdateBiRPDeprecationInfoBox(); + } + + void UpdateBiRPDeprecationInfoBox() + { + if (m_BiRPDeprecationInfoBox == null) + return; + + bool srpInstalled = false; + foreach (var type in TypeCache.GetTypesDerivedFrom()) + { + if (!type.IsAbstract) + { + srpInstalled = true; + break; + } + } + + bool defaultSrpSelected = m_DefaultRenderPipelineField?.value != null; + + if (!srpInstalled) + { + m_BiRPDeprecationInfoBox.messageType = HelpBoxMessageType.Info; + m_BiRPDeprecationInfoBox.text = GraphicsSettingsData.k_GraphicsSettingsBuiltinInfo; + m_BiRPDeprecationInfoBox.style.display = DisplayStyle.Flex; + } + else if (!defaultSrpSelected) + { + m_BiRPDeprecationInfoBox.messageType = HelpBoxMessageType.Warning; + m_BiRPDeprecationInfoBox.text = GraphicsSettingsData.k_GraphicsSettingsBuiltinWarning; + m_BiRPDeprecationInfoBox.style.display = DisplayStyle.Flex; + } + else + { + m_BiRPDeprecationInfoBox.style.display = DisplayStyle.None; + } + } + [Serializable] class UserSettings { @@ -507,9 +576,7 @@ void RenderPipelineAssetChanged(RenderPipelineAsset previous, RenderPipelineAsse bool ShouldDisplayElement(Type currentRenderPipelineAssetType, Type[] renderPipelineAssetTypes) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. return renderPipelineAssetTypes.Contains(currentRenderPipelineAssetType) -#pragma warning restore UA2001 || Array.Exists(renderPipelineAssetTypes, t => t != null && t.IsAssignableFrom(currentRenderPipelineAssetType)); } @@ -638,6 +705,16 @@ internal GraphicsSettingsProvider(string path, SettingsScope scopes, IEnumerable { "m_VideoShadersIncludeMode" , "Video" }, { "m_AlwaysIncludedShaders" , "Always Included Shaders" }, { "m_LightProbeOutsideHullStrategy" , "Renderer Light Probe Selection" }, + { "m_GraphicsStateCollection" , "Load Graphics State Collection" }, + { "m_CollectionStartupAction" , "Collection Startup Behavior" }, + { "m_TraceSavePath" , "Save As" }, + { "m_TraceSendToEditor" , "Send to Editor" }, + { "m_AdditionalWarmupCollections" , "Additional Collections" }, + { "m_WarmupAsync" , "Warmup Asynchronously" }, + // Below: 1 serialized property is for 2 field of the inspector. Adding all to the search keys + { "m_WarmupProgressivelyLimit" , $"Warmup After Showing First Scene Progressive Count Limit Per Frame" }, + { "m_EnableCacheMissTracing" , "Enable Cache Miss Tracing" }, + { "m_CacheMissCollectionPath" , "Cache Miss Collection Save Path" }, { "m_PreloadedShaders" , "Preload Shaders" }, // Below: 1 serialized property is for 2 field of the inspector. Adding all to the search keys { "m_PreloadShadersBatchTimeLimit" , $"Preload Shaders After Showing First Scene Preload Time Limit Per Frame (ms)" }, diff --git a/Editor/Mono/Inspector/LightEditor.cs b/Editor/Mono/Inspector/LightEditor.cs index ccc2b75c2d..4856bfd3e2 100644 --- a/Editor/Mono/Inspector/LightEditor.cs +++ b/Editor/Mono/Inspector/LightEditor.cs @@ -7,9 +7,9 @@ using UnityEditor.AnimatedValues; using UnityEngine; using UnityEngine.Rendering; +using Unity.Collections; using System; using System.Linq; -using System.Collections.Generic; namespace UnityEditor { @@ -282,9 +282,7 @@ public void DrawLightType() EditorGUI.BeginChangeCheck(); int type; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (Styles.LightTypeValues.Contains(lightType.intValue)) -#pragma warning restore UA2001 { // ^ The currently selected light type is supported in the // current pipeline. @@ -313,9 +311,7 @@ public void DrawLightType() } EditorGUI.EndProperty(); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!Styles.LightTypeValues.Contains(lightType.intValue)) -#pragma warning restore UA2001 { EditorGUILayout.HelpBox( "This light type is not supported in the current active render pipeline. Change the light type or the active Render Pipeline to use this light.", diff --git a/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs b/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs index 5aff250259..30229b72cb 100644 --- a/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs +++ b/Editor/Mono/Inspector/LightProbeProxyVolumeEditor.cs @@ -16,6 +16,7 @@ namespace UnityEditor { + #pragma warning disable CS0618 // Type or member is obsolete [CustomEditor(typeof(LightProbeProxyVolume))] [CanEditMultipleObjects] internal class LightProbeProxyVolumeEditor : Editor diff --git a/Editor/Mono/Inspector/MaterialEditor.cs b/Editor/Mono/Inspector/MaterialEditor.cs index 9092c05af3..055b4550aa 100644 --- a/Editor/Mono/Inspector/MaterialEditor.cs +++ b/Editor/Mono/Inspector/MaterialEditor.cs @@ -16,7 +16,10 @@ using StackValidationResult = UnityEngine.Rendering.VirtualTexturing.EditorHelpers.StackValidationResult; using System.IO; using Unity.Collections.LowLevel.Unsafe; +using UnityEngine.Pool; +using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("UnityEditor.Shader.Tests")] namespace UnityEditor { [CustomEditor(typeof(Material))] @@ -32,6 +35,13 @@ private static class Styles public static int[] lightmapEmissiveValues = { (int)MaterialGlobalIlluminationFlags.RealtimeEmissive, (int)MaterialGlobalIlluminationFlags.BakedEmissive, (int)MaterialGlobalIlluminationFlags.None }; public static string propBlockInfo = EditorGUIUtility.TrTextContent("MaterialPropertyBlock is used to modify these values").text; + public static string builtInDeprecated = L10n.Tr("Built-in (Deprecated)/"); + public static string notSupported = L10n.Tr("\"Not supported/\""); + public static string failedToCompile = L10n.Tr("Failed to compile/"); + + public static string infoBuiltInBuiltinDeprecated = L10n.Tr("Some built-in shaders are deprecated.\nMigrate your project to the Universal Render Pipeline instead."); + public static string warningUsingSRPBuiltinDeprecated = L10n.Tr("A Scriptable Render Pipeline is active. Built-in shaders are deprecated."); + public const int kNewShaderQueueValue = -1; public const int kCustomQueueIndex = 4; public static readonly GUIContent queueLabel = EditorGUIUtility.TrTextContent("Render Queue"); @@ -519,6 +529,154 @@ private bool DoHierarchyButton() return clicked; } + internal static class ShaderDropdownDataBuilder + { + internal enum Category + { + Normal = 0, + Legacy = 1, + NotSupported = 2, + FailedToCompile = 3, + BuiltInDeprecated = 4, + Separator = 5, + } + + internal readonly struct ShaderSelectionEntry + { + public readonly Category category; + public readonly string fullShaderName; + public readonly string menuPath; + public readonly string prefix; + + public ShaderSelectionEntry(Category category, string fullShaderName, string menuPath, string prefix) + { + this.category = category; + this.fullShaderName = fullShaderName; + this.menuPath = menuPath; + this.prefix = prefix; + } + } + + private static readonly Dictionary s_IsBuiltInDeprecatedByName = new(); + + [InitializeOnLoadMethod] + public static void ClearShaderSelectionEntryCache() + { + Action action = () => Clear(); + EditorApplication.projectChanged += action; + AssemblyReloadEvents.afterAssemblyReload += Clear; + RenderPipelineManager.activeRenderPipelineTypeChanged += action; + } + + internal static void Clear() + { + s_IsBuiltInDeprecatedByName.Clear(); + } + + private static bool IsBuiltInByPath(string path) + { + return !(path.StartsWith("Assets") || path.StartsWith("Packages")); + } + + // White list of shaders that are still included in the built-in RP and should not be considered deprecated + // as they continue working in URP and HDRP + private static readonly List s_WhiteListBuiltInShaders = new List() + { + "GUI/Text Shader", + "Skybox/6 Sided", + "Skybox/Cubemap", + "Skybox/Panoramic", + "Skybox/Procedural", + "UI/Default", + "UI/Default Font", + "UI/DefaultETC1", + "UI/Unlit/Detail", + "UI/Unlit/Text", + "UI/Unlit/Text Detail", + "UI/Unlit/Transparent", + }; + + internal static bool IsBuiltInDeprecated(string shaderName) + { + if (s_IsBuiltInDeprecatedByName.TryGetValue(shaderName, out var v)) + return v; + + bool isBuiltInDeprecated = false; + + if (s_WhiteListBuiltInShaders.Contains(shaderName)) + { + isBuiltInDeprecated = false; + } + else + { + var sh = Shader.Find(shaderName); + if (sh != null) + { + var path = AssetDatabase.GetAssetPath(sh); + isBuiltInDeprecated = string.IsNullOrEmpty(path) || IsBuiltInByPath(path); + } + } + + s_IsBuiltInDeprecatedByName[shaderName] = isBuiltInDeprecated; + return isBuiltInDeprecated; + } + + internal static IEnumerable EnumerateShaders(bool usingSRP) + { + using (ListPool.Get(out var normal)) + using (ListPool.Get(out var unnested)) + using (ListPool.Get(out var builtInDeprecated)) + using (ListPool.Get(out var legacy)) + using (ListPool.Get(out var notSupported)) + using (ListPool.Get(out var failed)) + { + var shaders = ShaderUtil.GetAllShaderInfo(); + foreach (var shader in shaders) + { + var shaderName = shader.name; + if (shaderName.StartsWith("Deprecated") || shaderName.StartsWith("Hidden")) + continue; + + if (usingSRP && IsBuiltInDeprecated(shaderName)) { builtInDeprecated.Add(shaderName); continue; } + + if (shader.hasErrors) { failed.Add(shaderName); continue; } + if (!shader.supported) { notSupported.Add(shaderName); continue; } + if (shaderName.StartsWith("Legacy Shaders/")) { legacy.Add(shaderName); continue; } + + if (!shaderName.Contains("/")) { unnested.Add(shaderName); continue; } + + normal.Add(shader.name); + } + + normal.Sort(); + foreach (var s in normal) + yield return new ShaderSelectionEntry(Category.Normal, s, s, ""); + + unnested.Sort(); + foreach (var s in unnested) + yield return new ShaderSelectionEntry(Category.Normal, s, s, ""); + + yield return new ShaderSelectionEntry(Category.Separator, "", "", ""); + + builtInDeprecated.Sort(); + foreach (var s in builtInDeprecated) + yield return new ShaderSelectionEntry(Category.BuiltInDeprecated, s, Styles.builtInDeprecated + s, Styles.builtInDeprecated); + + legacy.Sort(); + foreach (var s in legacy) + yield return new ShaderSelectionEntry(Category.Legacy, s, s, ""); + + notSupported.Sort(); + foreach (var s in notSupported) + yield return new ShaderSelectionEntry(Category.NotSupported, s, Styles.notSupported + s, Styles.notSupported); + + failed.Sort(); + foreach (var s in failed) + yield return new ShaderSelectionEntry(Category.FailedToCompile, s, Styles.failedToCompile + s, Styles.failedToCompile); + } + } + } + private class ShaderSelectionDropdown : AdvancedDropdown { Action m_OnSelectedShaderPopup; @@ -554,56 +712,46 @@ protected override AdvancedDropdownItem FetchData() m_SearchableElements = new List(); var root = new AdvancedDropdownItem("Shaders"); - var shaders = ShaderUtil.GetAllShaderInfo(); - var shaderList = new List(); - var unnestedList = new List(); - var legacyList = new List(); - var notSupportedList = new List(); - var failedCompilationList = new List(); - - foreach (var shader in shaders) + bool usingSRP = GraphicsSettings.isScriptableRenderPipelineEnabled; + if (usingSRP) { - if (shader.name.StartsWith("Deprecated") || shader.name.StartsWith("Hidden")) - { - continue; - } - if (shader.hasErrors) - { - failedCompilationList.Add(shader.name); - continue; - } - if (!shader.supported) + bool firstBuiltInProcessed = false; + foreach (var e in ShaderDropdownDataBuilder.EnumerateShaders(usingSRP)) { - notSupportedList.Add(shader.name); - continue; - } - if (shader.name.StartsWith("Legacy Shaders/")) - { - legacyList.Add(shader.name); - continue; - } - if (!shader.name.Contains('/')) - { - unnestedList.Add(shader.name); - continue; + if (e.category == ShaderDropdownDataBuilder.Category.Separator) + { + root.AddSeparator(); + continue; + } + + if (!firstBuiltInProcessed) + { + if (e.category == ShaderDropdownDataBuilder.Category.BuiltInDeprecated) + { + firstBuiltInProcessed = true; + var builtInNode = FindOrCreateChild(root, Styles.builtInDeprecated); + builtInNode.AddHelpBox(Styles.warningUsingSRPBuiltinDeprecated, MessageType.Warning); + } + } + + AddShaderToMenu(e.prefix, root, e.fullShaderName, e.menuPath); } - shaderList.Add(shader.name); } + else + { + root.AddHelpBox(Styles.infoBuiltInBuiltinDeprecated, MessageType.Info); - shaderList.Sort(); - unnestedList.Sort(); - shaderList.AddRange(unnestedList); - - legacyList.Sort(); - notSupportedList.Sort(); - failedCompilationList.Sort(); + foreach (var e in ShaderDropdownDataBuilder.EnumerateShaders(usingSRP)) + { + if (e.category == ShaderDropdownDataBuilder.Category.Separator) + { + root.AddSeparator(); + continue; + } - shaderList.ForEach(s => AddShaderToMenu("", root, s, s)); - if (legacyList.Count > 0 || notSupportedList.Count > 0 || failedCompilationList.Count > 0) - root.AddSeparator(); - legacyList.ForEach(s => AddShaderToMenu("", root, s, s)); - notSupportedList.ForEach(s => AddShaderToMenu("Not supported/", root, s, "Not supported/" + s)); - failedCompilationList.ForEach(s => AddShaderToMenu("Failed to compile/", root, s, "Failed to compile/" + s)); + AddShaderToMenu(e.prefix, root, e.fullShaderName, e.menuPath); + } + } return root; } diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs index 80ef8553ec..c42361d9bf 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs @@ -11,7 +11,6 @@ using UnityEditorInternal; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Text; using System.Reflection; @@ -24,7 +23,7 @@ using UnityEngine.Scripting; using UnityEngine.Bindings; using UnityEditor.Build.Profile; -using UnityEditor.UIElements; +using Unity.Collections; // ************************************* READ BEFORE EDITING ************************************** // @@ -1750,9 +1749,7 @@ void OpenGLES31OptionsGUI(BuildTargetGroup targetGroup, BuildTarget targetPlatfo var apis = m_CurrentTarget.GetGraphicsAPIs_Internal(targetPlatform); // only available if we include ES3 -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. var hasMinES3 = apis.Contains(GraphicsDeviceType.OpenGLES3); -#pragma warning restore UA2001 if (!hasMinES3) return; @@ -2458,7 +2455,9 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, ISettingEditorExte api == GraphicsDeviceType.Metal || api == GraphicsDeviceType.Vulkan || api == GraphicsDeviceType.OpenGLES3 || - api == GraphicsDeviceType.Direct3D12) + api == GraphicsDeviceType.Direct3D12 || + api == GraphicsDeviceType.GameCoreXboxOne || + api == GraphicsDeviceType.GameCoreXboxSeries ) { platformSupportsBatching = true; break; @@ -2967,9 +2966,7 @@ private bool CheckIfWebGPUInGfxAPIList() { foreach (var target in k_WebGPUSupportedBuildTargets) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (m_CurrentTarget.GetGraphicsAPIs_Internal(target).Contains(GraphicsDeviceType.WebGPU)) -#pragma warning restore UA2001 { return true; } @@ -3660,7 +3657,7 @@ private void OtherSectionScriptCompilationGUI(BuildPlatform platform) if (GUILayout.Button(SettingsContent.scriptingDefineSymbolsCopyDefines, EditorStyles.miniButton)) { - EditorGUIUtility.systemCopyBuffer = PlayerSettings.GetScriptingDefineSymbols(platform.namedBuildTarget); + EditorGUIUtility.systemCopyBuffer = GetScriptingDefineSymbolsForGroup(platform.namedBuildTarget); } GUI.enabled = hasScriptingDefinesBeenModified; diff --git a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs index cc25d4426b..c474aa5965 100644 --- a/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs +++ b/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsIconsEditor.cs @@ -43,6 +43,9 @@ internal class SettingsContent // Required icons for platform. Provided by platform extension Dictionary m_RequiredIcons; + // Cache for icons when override is disabled + Dictionary m_DisabledOverrideIconsCache = new Dictionary(); + public PlayerSettingsIconsEditor(PlayerSettingsEditor owner) { m_Owner = owner; @@ -436,11 +439,27 @@ public void IconSectionGUI(BuildPlatform platform, ISettingEditorExtension setti var changed = EditorGUI.EndChangeCheck(); if (changed || (!overrideIcons && icons.Length > 0)) { - // Set the list of icons to correct length if overridden, otherwise to an empty list if (overrideIcons) - icons = new Texture2D[widths.Length]; + { + if (m_DisabledOverrideIconsCache.TryGetValue(platformName, out var cachedIcons) && + cachedIcons.Length == widths.Length) + { + icons = cachedIcons; + m_DisabledOverrideIconsCache.Remove(platformName); + } + else + { + icons = new Texture2D[widths.Length]; + } + } else + { + if (icons.Length == widths.Length) + { + m_DisabledOverrideIconsCache[platformName] = icons; + } icons = Array.Empty(); + } if (changed) SetLegacyPlatformIcons(platformName, icons, IconKind.Any, ref m_AllLegacyIcons); @@ -463,13 +482,13 @@ public void IconSectionGUI(BuildPlatform platform, ISettingEditorExtension setti // Texture slot if (overrideIcons) { - var slotWidth = kSlotSize; - var slotHeight = (int)((float)heights[i] / widths[i] * kSlotSize); // take into account the aspect ratio - icons[i] = (Texture2D)EditorGUI.ObjectField( - new Rect(rect.x + width - kMaxPreviewSize - kSlotSize - kIconSpacing, rect.y, slotWidth, slotHeight), - icons[i], - typeof(Texture2D), - false); + // Reset indent level to prevent IndentedRect from making the rect non-square + var slotSize = kSlotSize; + var slotRect = new Rect(rect.x + width - kMaxPreviewSize - kSlotSize - kIconSpacing, rect.y, slotSize, slotSize); + var oldIndentLevel = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + icons[i] = (Texture2D)EditorGUI.ObjectField(slotRect, icons[i], typeof(Texture2D), false); + EditorGUI.indentLevel = oldIndentLevel; } // Preview diff --git a/Editor/Mono/Inspector/QualitySettingsEditor.cs b/Editor/Mono/Inspector/QualitySettingsEditor.cs index cbd88e5bb5..a65c92b680 100644 --- a/Editor/Mono/Inspector/QualitySettingsEditor.cs +++ b/Editor/Mono/Inspector/QualitySettingsEditor.cs @@ -10,6 +10,7 @@ using UnityEditorInternal; using UnityEngine; using UnityEngine.Rendering; +using Unity.Collections; namespace UnityEditor { @@ -648,6 +649,57 @@ void CheckSameRenderPipelineAssetForOverridenQualityLevels() } } + void CheckBiRPDeprecationInfoBox(bool usingSRP) + { + if (usingSRP) + return; + + bool installedSRP = false; + foreach (var type in TypeCache.GetTypesDerivedFrom()) + { + if (!type.IsAbstract) + { + installedSRP = true; + break; + } + } + + // Workaround, as there is a bug in the documentation forwarder that causes links containing a / to be broken: + string linkHref = $"https://docs.unity3d.com/{Application.unityVersionVer}.{Application.unityVersionMaj}/Documentation/Manual/urp/upgrading-from-birp.html"; + + // Use this once the documentation forwarder has been fixed + // Slack thread: https://unity.slack.com/archives/CTD5B2N7J/p1765805896918059 + // Ticket: https://jira.unity3d.com/browse/WEBDOCS-2894 + // linkHref = System.IO.Path.Combine(Help.baseDocumentationUrl, "urp", "upgrading-from-birp"); + + using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) + { + var message = installedSRP ? "If you don't use a render pipeline asset, Unity uses the Built-In Render Pipeline which is deprecated. Migrate your project to the Universal Render Pipeline instead." : + "The Built-In Render Pipeline is deprecated. Migrate your project to the Universal Render Pipeline instead."; + var messageType = installedSRP ? MessageType.Warning : MessageType.Info; + // Copied from LabelField called by HelpBox - using so that label and button link are in the same helpbox + var infoLabel = EditorGUIUtility.TempContent(message, EditorGUIUtility.GetHelpIcon(messageType)); + Rect r = GUILayoutUtility.GetRect(infoLabel, EditorStyles.wordWrappedLabel); + int oldIndent = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + EditorGUI.LabelField(r, infoLabel, EditorStyles.wordWrappedLabel); + EditorGUI.indentLevel = oldIndent; + + // Right align the Link + using (new EditorGUILayout.HorizontalScope()) + { + GUILayout.FlexibleSpace(); + EditorGUI.indentLevel = 2; + if (EditorGUILayout.LinkButton("Learn more...")) + { + Help.BrowseURL(linkHref); + } + } + EditorGUI.indentLevel = oldIndent; + GUILayout.Space(3); + } + } + private void ResetQualityLevelRenameTracking() { m_QualityLevelRenameJustStarted = true; @@ -826,6 +878,9 @@ public override void OnInspectorGUI() if (!usingSRP && customRenderPipeline.objectReferenceValue != null) EditorGUILayout.HelpBox("Missing a Scriptable Render Pipeline in Graphics: \"Scriptable Render Pipeline Settings\" to use Scriptable Render Pipeline from Quality: \"Custom Render Pipeline\".", MessageType.Warning); + // Add Info Box for Built-In deprecation + CheckBiRPDeprecationInfoBox(usingSRP); + if (!usingSRP) EditorGUILayout.PropertyField(pixelLightCountProperty); @@ -1109,9 +1164,7 @@ void DrawTextureMipmapLimitGroupsHeader(Rect rect) { includePropertyMethod.Invoke(m_PresetEditor, new object[] { groupSettingsArrayPropertyPath }); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (m_QualitySettingsPreset.excludedProperties.Contains(groupNamesArrayPropertyPath)) -#pragma warning restore UA2001 { if (!System.Array.Exists(m_QualitySettingsPreset.excludedProperties, p => p == groupSettingsArrayPropertyPath || groupSettingsArrayPropertyPath.StartsWith(p + ".", System.StringComparison.Ordinal))) { @@ -1140,9 +1193,7 @@ void DrawTextureMipmapLimitGroupsHeader(Rect rect) // If the group names array was included (it can be manually excluded!), // then check if we've got all group settings arrays excluded. If that is // the case, exclude the group names array too as described earlier. -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!m_QualitySettingsPreset.excludedProperties.Contains(groupNamesArrayPropertyPath)) -#pragma warning restore UA2001 { bool areAllGroupSettingsExcluded = true; int counter = 0; diff --git a/Editor/Mono/Inspector/RectTransformEditor.cs b/Editor/Mono/Inspector/RectTransformEditor.cs index f88ce504cc..e95fd2c22f 100644 --- a/Editor/Mono/Inspector/RectTransformEditor.cs +++ b/Editor/Mono/Inspector/RectTransformEditor.cs @@ -8,8 +8,8 @@ using UnityEditorInternal; using System.Linq; using UnityEditor.AnimatedValues; -using System.Globalization; using Unity.Collections; +using System.Globalization; namespace UnityEditor { @@ -218,9 +218,7 @@ void DrawAnchorsOnSceneView(SceneView sceneView) if (!sceneView.drawGizmos || !EditorGUIUtility.IsGizmosAllowedForObject(target)) return; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (SceneView.activeEditors.Contains(this) || SceneView.activeEditors.Contains(target)) -#pragma warning restore UA2001 return; RectTransform gui = target as RectTransform; diff --git a/Editor/Mono/Inspector/RendererEditorBase.cs b/Editor/Mono/Inspector/RendererEditorBase.cs index 3417ff3b69..a93b346c55 100644 --- a/Editor/Mono/Inspector/RendererEditorBase.cs +++ b/Editor/Mono/Inspector/RendererEditorBase.cs @@ -69,6 +69,7 @@ internal bool IsUsingLightProbeProxyVolume(int selectionCount) return isUsingLightProbeVolumes; } + #pragma warning disable CS0618 // Type or member is obsolete internal void RenderLightProbeProxyVolumeWarningNote(Renderer renderer, int selectionCount) { if (IsUsingLightProbeProxyVolume(selectionCount)) @@ -89,6 +90,7 @@ internal void RenderLightProbeProxyVolumeWarningNote(Renderer renderer, int sele } } } + #pragma warning restore CS0618 internal void RenderReflectionProbeUsage(bool useMiniStyle, bool isDeferredRenderingPath, bool isDeferredReflections) { diff --git a/Editor/Mono/Inspector/SpeedTreeMaterialInspector.cs b/Editor/Mono/Inspector/SpeedTreeMaterialInspector.cs index 5e5c5b8f84..01856a2677 100644 --- a/Editor/Mono/Inspector/SpeedTreeMaterialInspector.cs +++ b/Editor/Mono/Inspector/SpeedTreeMaterialInspector.cs @@ -59,9 +59,7 @@ public override void OnInspectorGUI() geomTypes[i] = SpeedTreeGeometryType.Branch; for (int j = 0; j < speedTreeGeometryTypeString.Length; ++j) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (((Material)targets[i]).shaderKeywords.Contains(speedTreeGeometryTypeString[j])) -#pragma warning restore UA2001 { geomTypes[i] = (SpeedTreeGeometryType)j; break; @@ -128,9 +126,7 @@ public override void OnInspectorGUI() if (detailTex != null) { props.Remove(detailTex); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (geomTypes.Contains(SpeedTreeGeometryType.BranchDetail)) -#pragma warning restore UA2001 ShaderProperty(detailTex, detailTex.displayName); } diff --git a/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs b/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs index abf1e4e475..1e26170779 100644 --- a/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs +++ b/Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs @@ -16,6 +16,7 @@ internal class ObjectFieldWithPrompt : BaseField { static readonly BindingId titleProperty = nameof(title); static readonly BindingId messageProperty = nameof(message); + static readonly BindingId removalMessageProperty = nameof(removalMessage); static readonly BindingId objectTypeProperty = nameof(objectType); static readonly BindingId allowSceneObjectsProperty = nameof(allowSceneObjects); @@ -33,6 +34,7 @@ internal class ObjectFieldWithPrompt : BaseField new (nameof(objectType), "type", typeof(Object)), new (nameof(title), "title"), new (nameof(message), "message"), + new (nameof(removalMessage), "removal-message"), }, true); } @@ -46,6 +48,8 @@ internal class ObjectFieldWithPrompt : BaseField [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags title_UxmlAttributeFlags; [SerializeField] string message; [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags message_UxmlAttributeFlags; + [SerializeField] string removalMessage; + [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags removalMessage_UxmlAttributeFlags; #pragma warning restore 649 public override object CreateInstance() => new ObjectFieldWithPrompt(); @@ -62,6 +66,8 @@ public override void Deserialize(object obj) e.title = title; if (ShouldWriteAttributeValue(message_UxmlAttributeFlags)) e.message = message; + if (ShouldWriteAttributeValue(removalMessage_UxmlAttributeFlags)) + e.removalMessage = removalMessage; } } @@ -94,6 +100,20 @@ public string message } } + string m_RemovalMessage; + + [CreateProperty] + public string removalMessage + { + get => m_RemovalMessage; + set + { + if (m_RemovalMessage == value) return; + m_RemovalMessage = value; + NotifyPropertyChanged(removalMessageProperty); + } + } + Type m_objectType; [CreateProperty] @@ -176,6 +196,15 @@ private bool ChangeObject(Object newValue) if (value != newValue) { s_MessageBuilder.Clear(); + + // Use removal message if clearing the field, otherwise use the standard message + bool isRemoving = newValue == null && value != null; + + if (isRemoving && !string.IsNullOrEmpty(removalMessage)) + { + s_MessageBuilder.AppendLine(removalMessage); + } + s_MessageBuilder.AppendLine(message); s_MessageBuilder.AppendLine(); s_MessageBuilder.AppendLine($"Current Value: {(value ? value.name : "None")}."); diff --git a/Editor/Mono/InternalEditorUtility.bindings.cs b/Editor/Mono/InternalEditorUtility.bindings.cs index 39d34d390b..5ee8782a93 100644 --- a/Editor/Mono/InternalEditorUtility.bindings.cs +++ b/Editor/Mono/InternalEditorUtility.bindings.cs @@ -744,28 +744,24 @@ public static string TextifyEvent(Event evt) } [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("defaultScreenWidth", TargetType.Field)] extern public static float defaultScreenWidth { get; } [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("defaultScreenHeight", TargetType.Field)] extern public static float defaultScreenHeight { get; } [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("defaultWebScreenWidth", TargetType.Field)] extern public static float defaultWebScreenWidth { get; } [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("defaultWebScreenHeight", TargetType.Field)] extern public static float defaultWebScreenHeight { get; diff --git a/Editor/Mono/Menu.bindings.cs b/Editor/Mono/Menu.bindings.cs index 8f232f114f..137649c4ae 100644 --- a/Editor/Mono/Menu.bindings.cs +++ b/Editor/Mono/Menu.bindings.cs @@ -84,6 +84,7 @@ public sealed class Menu internal static extern void RemoveMenuItem(string name); [FreeFunction("MenuController::AddSeparator")] + [VisibleToOtherModules("UnityEditor.UIToolkitAuthoringModule")] internal static extern void AddSeparator(string name, int priority); [FreeFunction("MenuController::RebuildAllMenus")] diff --git a/Editor/Mono/Modules/PlatformSDK/PlatformSDK.cs b/Editor/Mono/Modules/PlatformSDK/PlatformSDK.cs new file mode 100644 index 0000000000..91a4c403cb --- /dev/null +++ b/Editor/Mono/Modules/PlatformSDK/PlatformSDK.cs @@ -0,0 +1,39 @@ +// 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 static UnityEditor.BuildTargetDiscovery; + +namespace UnityEditor.Modules; + +internal enum SDKPlatformType +{ + Derived = 0, + MultiTarget = 1 +} + +[Serializable] +internal class SDKPlatformFlags +{ + public SDKPlatformType platformType; +} + +[Serializable] +internal class SDKPlatformInfo +{ + public string guid; + public string[] supportedPlatformGuids; + public BuildTarget baseBuildTarget; + public string platformGroupName; + public string displayName; + public string description; + public string instructions; + public string keyFeatures; + public string resources; + public string iconName; + public string bannerBackgroundColorHex; + public PlatformPackageList internalPackages; + public PlatformPackageList partnerPackages; + public SDKPlatformFlags flags; +} diff --git a/Editor/Mono/ObjectSelector.cs b/Editor/Mono/ObjectSelector.cs index 4f5552c118..f7ba03181f 100644 --- a/Editor/Mono/ObjectSelector.cs +++ b/Editor/Mono/ObjectSelector.cs @@ -144,6 +144,7 @@ public static void SetSelection(ObjectSelector os, EntityId[] selection, bool do // Display state bool m_AllowSceneObjects; + bool m_AllowBuiltinResources; bool m_IsShowingAssets; bool m_SkipHiddenPackages; SavedInt m_StartGridSize = new SavedInt("ObjectSelector.GridSize", 64); @@ -171,7 +172,7 @@ public static void SetSelection(ObjectSelector os, EntityId[] selection, bool do Action m_OnObjectSelectorUpdated; ObjectListAreaState m_ListAreaState; - ObjectListArea m_ListArea; + internal ObjectListArea m_ListArea; ObjectTreeForSelector m_ObjectTreeWithSearch = new ObjectTreeForSelector(); UnityObject m_ObjectBeingEdited; SerializedProperty m_EditedProperty; @@ -544,12 +545,12 @@ static bool ShouldTreeViewBeUsed(String typeStr) return (String.Equals(typeof(AudioMixerGroup).Name, typeStr)); } - internal void Show(Type requiredType, SerializedProperty property, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null) + internal void Show(Type requiredType, SerializedProperty property, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool allowBuiltinResources = true) { - Show(new [] { requiredType }, property, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated); + Show(new [] { requiredType }, property, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, allowBuiltinResources); } - internal void Show(Type[] requiredTypes, SerializedProperty property, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null) + internal void Show(Type[] requiredTypes, SerializedProperty property, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool allowBuiltinResources = true) { if (requiredTypes == null) { @@ -566,15 +567,15 @@ internal void Show(Type[] requiredTypes, SerializedProperty property, bool allow UnityObject objectBeingEdited = property.serializedObject.targetObject; m_EditedProperty = property; - SharedShow(obj, new RequiredTypeList(requiredTypes, property), objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated); + SharedShow(obj, new RequiredTypeList(requiredTypes, property), objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, true, allowBuiltinResources); } - internal void Show(UnityObject obj, Type requiredType, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true) + internal void Show(UnityObject obj, Type requiredType, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true, bool allowBuiltinResources = true) { - Show(obj, new Type[] { requiredType }, objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, showNoneItem); + Show(obj, new Type[] { requiredType }, objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, showNoneItem, allowBuiltinResources); } - internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true) + internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true, bool allowBuiltinResources = true) { SharedShow( obj, @@ -584,11 +585,12 @@ internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBein allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, - showNoneItem + showNoneItem, + allowBuiltinResources ); } - void SharedShow(UnityObject obj, RequiredTypeList typeList, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true) + void SharedShow(UnityObject obj, RequiredTypeList typeList, UnityObject objectBeingEdited, bool allowSceneObjects, List allowedEntityIds = null, Action onObjectSelectorClosed = null, Action onObjectSelectedUpdated = null, bool showNoneItem = true, bool allowBuiltinResources = true) { // We can't rely on the fact that the window will always be closed when we call Show. For example, // if a user clicks on multiple object fields without closing the window first, there is no guarantee @@ -597,6 +599,7 @@ void SharedShow(UnityObject obj, RequiredTypeList typeList, UnityObject objectBe CloseOpenedWindow(); m_ObjectSelectorReceiver = null; m_AllowSceneObjects = allowSceneObjects; + m_AllowBuiltinResources = allowBuiltinResources; m_IsShowingAssets = true; m_SkipHiddenPackages = true; m_AllowedIDs = allowedEntityIds; @@ -818,7 +821,7 @@ void InitIfNeeded() m_ListArea.allowFocusRendering = false; m_ListArea.allowMultiSelect = false; m_ListArea.allowRenaming = false; - m_ListArea.allowBuiltinResources = true; + m_ListArea.allowBuiltinResources = m_AllowBuiltinResources; m_ListArea.repaintCallback += Repaint; m_ListArea.itemSelectedCallback += ListAreaItemSelectedCallback; m_ListArea.gridSize = m_StartGridSize.value; diff --git a/Editor/Mono/Overlays/OverlayCanvas.cs b/Editor/Mono/Overlays/OverlayCanvas.cs index 89c5adad75..d65dbe36fc 100644 --- a/Editor/Mono/Overlays/OverlayCanvas.cs +++ b/Editor/Mono/Overlays/OverlayCanvas.cs @@ -593,12 +593,10 @@ void DisplaceWindow() // Verify if the left and right dynamic panel overlay containers // are direct children of the vertical overlay container group. // If they are, the layout is already correct. -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. +#pragma warning disable UA2007 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (displaceContainer.Children().Contains(leftDynamicPanelOverlayContainer) -#pragma warning restore UA2001 -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. && displaceContainer.Children().Contains(rightDynamicPanelOverlayContainer)) -#pragma warning restore UA2001 +#pragma warning restore UA2007 return; displaceContainer.Add(leftDynamicPanelOverlayContainer); @@ -611,12 +609,10 @@ void DisplaceWindow() // Verify if the left and right dynamic panel overlay containers // are direct children of the overlay scene container. // If they are, the layout is already correct. -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. +#pragma warning disable UA2007 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (sceneContainers.Children().Contains(leftDynamicPanelOverlayContainer) -#pragma warning restore UA2001 -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. && sceneContainers.Children().Contains(rightDynamicPanelOverlayContainer)) -#pragma warning restore UA2001 +#pragma warning restore UA2007 return; var anchoredContainer = sceneContainers.Q(k_AnchoredContainerName); diff --git a/Editor/Mono/Overlays/OverlayPreferencesState.cs b/Editor/Mono/Overlays/OverlayPreferencesState.cs index 626020b1ab..b0c0e5ddd9 100644 --- a/Editor/Mono/Overlays/OverlayPreferencesState.cs +++ b/Editor/Mono/Overlays/OverlayPreferencesState.cs @@ -19,10 +19,21 @@ public class SettingsContent public void HandleUI(string searchContext) { + EditorGUI.indentLevel++; foreach (var windowType in OverlayPrefs.GetSupportedWindowTypes()) { + EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(ObjectNames.NicifyVariableName(windowType.Name), EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Use Default", GUILayout.Width(120))) + { + OverlayPrefs.RevertToDefaultColor(windowType); + OverlayPrefs.DeleteOverlayKey(windowType); + } + EditorGUILayout.EndHorizontal(); + Color currentColor = OverlayPrefs.GetBackgroundColor(windowType); EditorGUI.BeginChangeCheck(); Color newColor = EditorGUILayout.ColorField(SettingsContent.OverlayBackgroundColorContent, currentColor); @@ -31,14 +42,9 @@ public void HandleUI(string searchContext) OverlayPrefs.SetBackgroundColor(windowType, newColor); } - if (GUILayout.Button("Use Default", GUILayout.Width(120))) - { - OverlayPrefs.RevertToDefaultColor(windowType); - OverlayPrefs.DeleteOverlayKey(windowType); - } - EditorGUILayout.Space(); } + EditorGUI.indentLevel--; } } diff --git a/Editor/Mono/Overlays/OverlayUtilities.cs b/Editor/Mono/Overlays/OverlayUtilities.cs index 3639afa7ae..963fb9eb04 100644 --- a/Editor/Mono/Overlays/OverlayUtilities.cs +++ b/Editor/Mono/Overlays/OverlayUtilities.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using Unity.Collections; using UnityEditor.EditorTools; using UnityEngine; using UnityEngine.UIElements; @@ -285,25 +286,21 @@ internal static void ValidateName(Overlay overlay) overlay.displayName = $"{overlay.GetType().Name}"; } - internal static bool EnsureValidId(IEnumerable existing, Overlay overlay) + internal static bool EnsureValidId(IReadOnlyList existing, Overlay overlay) { if (overlay == null) return false; var id = string.IsNullOrEmpty(overlay.id) ? $"{overlay.GetType()}" : overlay.id; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - var ret = EnsureUniqueId(existing.Select(x => x.id), id); -#pragma warning restore UA2001 + var ret = EnsureUniqueId(existing, id); if (string.IsNullOrEmpty(ret)) return false; overlay.id = ret; return true; } - static string EnsureUniqueId(IEnumerable existing, string name) + static string EnsureUniqueId(IReadOnlyList existing, string name) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - if (!existing.Contains(name)) -#pragma warning restore UA2001 + if (!existing.Exists(e => e.id == name)) return name; // 256 has no special meaning, it's just a failsafe to prevent this method from locking up the editor @@ -313,9 +310,7 @@ static string EnsureUniqueId(IEnumerable existing, string name) for (int n = 0; n < 256; ++n) { var inc = $"{name} ({n})"; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - if (!existing.Contains(inc)) -#pragma warning restore UA2001 + if (!existing.Exists(e => e.id == inc)) return inc; } diff --git a/Editor/Mono/PlayerSettings.bindings.cs b/Editor/Mono/PlayerSettings.bindings.cs index cd4094e10e..26d3d9f260 100644 --- a/Editor/Mono/PlayerSettings.bindings.cs +++ b/Editor/Mono/PlayerSettings.bindings.cs @@ -1978,6 +1978,16 @@ internal void SetGraphicsAPIs_Internal(BuildTarget platform, UnityEngine.Renderi [VisibleToOtherModules] internal extern bool GetEnableFrameTimingStats_Internal(); + public static extern bool adjustIOSFPSUsingThermalState{ get; set; } + + [NativeMethod("SetAdjustIOSFPSUsingThermalState")] + [VisibleToOtherModules] + internal extern void SetAdjustIOSFPSUsingThermalState_Internal(bool value); + + [NativeMethod("GetAdjustIOSFPSUsingThermalState")] + [VisibleToOtherModules] + internal extern bool GetAdjustIOSFPSUsingThermalState_Internal(); + public static extern D3D12DeviceFilterLists d3D12DeviceFilterListAsset { get; set; } } } diff --git a/Editor/Mono/PlayerSettingsWSA.bindings.cs b/Editor/Mono/PlayerSettingsWSA.bindings.cs index 42a407ef66..4de79357ae 100644 --- a/Editor/Mono/PlayerSettingsWSA.bindings.cs +++ b/Editor/Mono/PlayerSettingsWSA.bindings.cs @@ -158,8 +158,7 @@ public struct WSAFileTypeAssociations public sealed partial class WSA { [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("wsaTransparentSwapchain", TargetType.Field)] - public static extern bool transparentSwapchain { get; set; } + public static extern bool transparentSwapchain { [NativeMethod("GetWsaTransparentSwapchain")] get; [NativeMethod("SetWsaTransparentSwapchain")] set; } public static extern string packageName { get; set; } @@ -295,8 +294,7 @@ public static bool enableIndependentInputSource } [StaticAccessor("GetPlayerSettings()", StaticAccessorType.Dot)] - [NativeProperty("metroInputSource", TargetType.Field)] - public static extern WSAInputSource inputSource { get; set; } + public static extern WSAInputSource inputSource { [NativeMethod("GetMetroInputSource")] get; [NativeMethod("SetMetroInputSource")] set; } [NativeProperty("metroSupportStreamingInstall", TargetType.Field)] public static extern bool supportStreamingInstall diff --git a/Editor/Mono/Prefabs/PrefabReplaceUtility.cs b/Editor/Mono/Prefabs/PrefabReplaceUtility.cs index 8837df214f..3616fadcea 100644 --- a/Editor/Mono/Prefabs/PrefabReplaceUtility.cs +++ b/Editor/Mono/Prefabs/PrefabReplaceUtility.cs @@ -4,8 +4,8 @@ using System; using System.Collections.Generic; -using System.Linq; using UnityEngine; +using Unity.Collections; namespace UnityEditor { @@ -226,9 +226,7 @@ internal static void FindGameObjectsToReplace(GameObject droppedUponGameObject, listOfPlainGameObjects = new List(); // Dropping on single -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (droppedUponGameObject != null && !Selection.gameObjects.Contains(droppedUponGameObject)) -#pragma warning restore UA2001 { if (PrefabUtility.IsOutermostPrefabInstanceRoot(droppedUponGameObject)) listOfInstanceRoots.Add(droppedUponGameObject); diff --git a/Editor/Mono/Prefabs/PropertyModification.bindings.cs b/Editor/Mono/Prefabs/PropertyModification.bindings.cs index bdd9d37e13..3562d1c3f5 100644 --- a/Editor/Mono/Prefabs/PropertyModification.bindings.cs +++ b/Editor/Mono/Prefabs/PropertyModification.bindings.cs @@ -42,5 +42,16 @@ internal void ApplyToObject(Object obj) [NativeMethod("ApplyPropertyModificationsToObject", IsFreeFunction = true)] [NativeHeader("Editor/Src/Prefabs/PropertyModification.h")] extern internal static void ApplyPropertyModificationsToObject([NotNull] Object target, PropertyModification[] value); + + [RequiredByNativeCode] + internal static PropertyModification CreateNew(Object target, string propertyPath, string value, Object objectReference) + { + var ret = new PropertyModification(); + ret.target = target; + ret.propertyPath = propertyPath; + ret.value = value; + ret.objectReference = objectReference; + return ret; + } } } diff --git a/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs b/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs index 7acf594664..567fa2bb77 100644 --- a/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs +++ b/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs @@ -3,7 +3,6 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using UnityEngine; -using UnityEditor.Analytics; using UnityEditor.Modules; using UnityEditorInternal; using System.Collections.Generic; @@ -12,6 +11,7 @@ using System.Linq; using JetBrains.Annotations; using Unity.CodeEditor; +using Unity.Collections; using UnityEngine.UIElements; using UnityEditor.Experimental; using UnityEditor.SceneManagement; @@ -54,7 +54,7 @@ class GeneralProperties 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"); + 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 useNewHierarchy = EditorGUIUtility.TrTextContent("Use new Hierarchy window"); public static readonly GUIContent hierarchyHeader = EditorGUIUtility.TrTextContent("Hierarchy window"); @@ -529,9 +529,13 @@ private void ShowGeneral(string searchContext) CodeOptimization codeOptimization = (CodeOptimization)EditorGUILayout.EnumPopup(ExternalProperties.codeOptimizationOnStartup, m_ScriptDebugInfoEnabled ? CodeOptimization.Debug : CodeOptimization.Release); m_ScriptDebugInfoEnabled = (codeOptimization == CodeOptimization.Debug ? true : false); - int newSkin = EditorGUILayout.Popup(GeneralProperties.editorSkin, !EditorGUIUtility.isProSkin ? 0 : 1, GeneralProperties.editorSkinOptions); - if ((!EditorGUIUtility.isProSkin ? 0 : 1) != newSkin) - InternalEditorUtility.SwitchSkinAndRepaintAllViews(); + using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode)) + { + int newSkin = EditorGUILayout.Popup(GeneralProperties.editorSkin, !EditorGUIUtility.isProSkin ? 0 : 1, + GeneralProperties.editorSkinOptions); + if ((!EditorGUIUtility.isProSkin ? 0 : 1) != newSkin) + InternalEditorUtility.SwitchSkinAndRepaintAllViews(); + } if (LocalizationDatabase.currentEditorLanguage == SystemLanguage.English) { @@ -893,8 +897,9 @@ private void ShowColors(string searchContext) GUILayout.Label(category.Key, EditorStyles.boldLabel); foreach (KeyValuePair kvp in category.Value) { + var displayName = ObjectNames.NicifyVariableName(kvp.Key); EditorGUI.BeginChangeCheck(); - Color c = EditorGUILayout.ColorField(EditorGUIUtility.TempContent(kvp.Key, kvp.Key), kvp.Value.Color); + Color c = EditorGUILayout.ColorField(EditorGUIUtility.TempContent(displayName, $"Custom overlay color for windows of {displayName} type"), kvp.Value.Color); if (EditorGUI.EndChangeCheck()) { ccolor = kvp.Value; @@ -1488,9 +1493,7 @@ private void FilePopup(GUIContent label, string selectedString, ref string[] nam EditorGUILayout.PrefixLabel(label, style); int[] selected = Array.Empty(); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (paths.Contains(selectedString)) -#pragma warning restore UA2001 selected = new[] { Array.IndexOf(paths, selectedString) }; GUIContent text = new GUIContent(selected.Length == 0 ? defaultString : names[selected[0]]); Rect r = GUILayoutUtility.GetRect(GUIContent.none, style); diff --git a/Editor/Mono/ProjectBrowser/ProjectBrowser.cs b/Editor/Mono/ProjectBrowser/ProjectBrowser.cs index 97b5e339d6..e88e421a16 100644 --- a/Editor/Mono/ProjectBrowser/ProjectBrowser.cs +++ b/Editor/Mono/ProjectBrowser/ProjectBrowser.cs @@ -114,7 +114,9 @@ class Styles public GUIContent m_FilterByLabel = EditorGUIUtility.TrIconContent("FilterByLabel", "Search by Label"); public GUIContent m_FilterByType = EditorGUIUtility.TrIconContent("FilterByType", "Search by Type"); - public GUIContent m_FilterByImportLog = EditorGUIUtility.TrIconContent("d_console.erroricon.inactive.sml", "Search by Import Log 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_PackageContentDefault = new GUIContent("", ""); @@ -884,7 +886,7 @@ public void EndRenaming() var shouldAcceptChanges = !Undo.isProcessing; if (m_AssetTree != null) m_AssetTree.EndNameEditing(shouldAcceptChanges); - + if (m_FolderTree != null) m_FolderTree.EndNameEditing(shouldAcceptChanges); @@ -2482,9 +2484,15 @@ void TypeDropDown() void LogTypeDropDown() { + var content = s_Styles.m_FilterByImportLogInactive; + if(m_SearchFilter.importLogFlags == ImportLogFlags.Error) + content = s_Styles.m_FilterByImportLogError; + if(m_SearchFilter.importLogFlags == ImportLogFlags.Warning) + content = s_Styles.m_FilterByImportLogWarning; + //Log type button - Rect r = GUILayoutUtility.GetRect(s_Styles.m_FilterByImportLog, EditorStyles.toolbarButton); - if (EditorGUI.DropdownButton(r, s_Styles.m_FilterByImportLog, FocusType.Passive, EditorStyles.toolbarButton)) + Rect r = GUILayoutUtility.GetRect(content, EditorStyles.toolbarButton); + if (EditorGUI.DropdownButton(r, content, FocusType.Passive, EditorStyles.toolbarButton)) { PopupWindow.Show(r, new PopupList(m_LogTypes)); } diff --git a/Editor/Mono/ProjectBrowser/ProjectWindowUtil.cs b/Editor/Mono/ProjectBrowser/ProjectWindowUtil.cs index 7004c9ad58..0956ecc859 100644 --- a/Editor/Mono/ProjectBrowser/ProjectWindowUtil.cs +++ b/Editor/Mono/ProjectBrowser/ProjectWindowUtil.cs @@ -269,6 +269,10 @@ public override void Action(EntityId entityId, string pathName, string resourceF { foreach (var toMovePath in m_Paths) { + // UUM-134783 - If the new folder is being created inside one of the folders being moved, skip. This can occur when the user has nothing selected in a Package or Project root. E.g "Assets/" + if (newFolderPath.Contains(toMovePath)) + continue; + var hasSelectedAncestor = false; var parent = Path.GetDirectoryName(toMovePath).ConvertSeparatorsToUnity(); diff --git a/Editor/Mono/SceneManagement/SceneSetup.cs b/Editor/Mono/SceneManagement/SceneSetup.cs index d3667418a7..2b862a7dff 100644 --- a/Editor/Mono/SceneManagement/SceneSetup.cs +++ b/Editor/Mono/SceneManagement/SceneSetup.cs @@ -5,6 +5,8 @@ using System; using System.Runtime.InteropServices; using UnityEngine; +using UnityEngine.Bindings; +using UnityEngine.Scripting; // The setup information for a scene in the SceneManager. @@ -12,15 +14,22 @@ namespace UnityEditor.SceneManagement { [StructLayout(LayoutKind.Sequential)] [Serializable] + [RequiredByNativeCode] + [NativeHeader("Editor/Src/SceneManager/SceneManagerSetup.h")] + [NativeAsStruct] public class SceneSetup { [SerializeField] + [NativeName("path")] private string m_Path = null; [SerializeField] + [NativeName("isLoaded")] private bool m_IsLoaded = false; [SerializeField] + [NativeName("isActive")] private bool m_IsActive = false; [SerializeField] + [NativeName("isSubScene")] private bool m_IsSubScene = false; public string path diff --git a/Editor/Mono/SceneManagement/StageManager/MainStageHierarchyState.cs b/Editor/Mono/SceneManagement/StageManager/MainStageHierarchyState.cs index 3e2015f340..b2466f24a0 100644 --- a/Editor/Mono/SceneManagement/StageManager/MainStageHierarchyState.cs +++ b/Editor/Mono/SceneManagement/StageManager/MainStageHierarchyState.cs @@ -4,10 +4,10 @@ using System; using System.Collections.Generic; -using System.Linq; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; +using Unity.Collections; namespace UnityEditor { @@ -59,9 +59,7 @@ public void LoadStateIntoHierarchy(SceneHierarchyWindow hierarchy, Stage stage) var currentSceneGUIDs = GetCurrentSceneGUIDs(); for (int i = 0; i < m_OpenSceneGUIDs.Length; i++) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!currentSceneGUIDs.Contains(m_OpenSceneGUIDs[i])) -#pragma warning restore UA2001 { anyOfScenesWereClosed = true; break; diff --git a/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs b/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs index 489dbfc060..89664c11a4 100644 --- a/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs +++ b/Editor/Mono/SceneModeWindows/DefaultLightingExplorerExtension.cs @@ -7,6 +7,7 @@ using UnityEngine.Rendering; using UnityEngine.U2D; using UnityEditor.SceneManagement; +using Unity.Collections; using Object = UnityEngine.Object; namespace UnityEditor @@ -298,9 +299,7 @@ protected virtual LightingExplorerTableColumn[] GetLightColumns() int selectedLightType = prop.intValue; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!Styles.LightTypeValues.Contains(prop.intValue)) -#pragma warning restore UA2001 { if (prop.intValue == (int)LightType.Disc) { @@ -325,9 +324,7 @@ protected virtual LightingExplorerTableColumn[] GetLightColumns() new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, Styles.Shape, "m_Type", 120, (r, prop, dep) => { // This is only appliable to the Area lights that have a shape. For the other lights, nothing will be shown -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (Styles.LightShapeValues.Contains(prop.intValue)) -#pragma warning restore UA2001 { EditorGUI.BeginProperty(r, GUIContent.none, prop); EditorGUI.BeginChangeCheck(); diff --git a/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs b/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs index bf5b9328e6..a0690f3796 100644 --- a/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs +++ b/Editor/Mono/SceneModeWindows/LightingExplorerWindow.cs @@ -5,6 +5,7 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEditor.Rendering; +using Unity.Collections; using System.Linq; using System; diff --git a/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs b/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs index 7eed2d82d1..d809fec757 100644 --- a/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs +++ b/Editor/Mono/SceneModeWindows/LightmapPreviewWindow.cs @@ -3,13 +3,10 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; -using System.Collections.Generic; -using System.Collections; using System.Linq; -using UnityEditor.AnimatedValues; -using UnityEditorInternal; using UnityEngine; using UnityEngineInternal; +using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; namespace UnityEditor @@ -219,22 +216,14 @@ public static void CreateLightmapPreviewWindow(EntityId lightmapId, bool realtim window.Show(); } - public static void CreateLightmapPreviewWindow(int lightmapId, bool realtimeLightmap, bool indexBased, bool useInteractiveLightBakingData, float exposure) + public static void CreateLightmapPreviewWindowIndexedWithExposure(int lightmapId, bool realtimeLightmap, bool useInteractiveLightBakingData, float exposure) { LightmapPreviewWindow window = EditorWindow.CreateInstance(); - window.exposure = exposure; - window.minSize = new Vector2(360, 390); + window.minSize = new Vector2(370, 390); window.isRealtimeLightmap = realtimeLightmap; - - if (indexBased) - window.lightmapIndex = lightmapId; - else - { - Debug.Assert(sizeof(int)==UnsafeUtility.SizeOf(), "EntityId is not the same size as int, update this code to use ulong"); - window.entityId = EntityId.FromULong((ulong)lightmapId); - } - + window.lightmapIndex = lightmapId; window.useInteractiveLightBakingData = useInteractiveLightBakingData; + window.exposure = exposure; window.Show(); } @@ -628,9 +617,7 @@ private void UpdateCachedTexture(GITextureType textureType) { Hash128[] mainHashes = Lightmapping.GetMainSystemHashes(); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!m_RealtimeTextureHash.isValid || !mainHashes.Contains(m_RealtimeTextureHash)) -#pragma warning restore UA2001 { #pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. m_RealtimeTextureHash = mainHashes.ElementAtOrDefault(m_LightmapIndex); diff --git a/Editor/Mono/SceneView/SceneView.cs b/Editor/Mono/SceneView/SceneView.cs index 5d402759ff..5e6cd21afa 100644 --- a/Editor/Mono/SceneView/SceneView.cs +++ b/Editor/Mono/SceneView/SceneView.cs @@ -297,7 +297,7 @@ internal static void SetActiveEditorsDirty(bool forceRepaint = false) static bool s_ActiveEditorsDirty; static bool s_SelectionCacheDirty; - internal static IEnumerable activeEditors + internal static IReadOnlyList activeEditors { get { @@ -1276,12 +1276,7 @@ static void FrameSelectedMenuItem(bool locked) var win = mouseOverWindow; var ret = win != null && win.SendEvent(EditorGUIUtility.CommandEvent(command)); - if (ret) - { - // In case the window under the mouse handle the Focus event, it should be focused on. - win.Focus(); - } - else + if (!ret) { // Otherwise get the current focused window to handle that event. win = focusedWindow; @@ -4094,7 +4089,9 @@ public bool Frame(Bounds bounds, bool instant = true) void CreateSceneCameraAndLights() { GameObject cameraGO = EditorUtility.CreateGameObjectWithHideFlags("SceneCamera", HideFlags.HideAndDontSave, typeof(Camera)); +#pragma warning disable CS0618 // Type or member is obsolete cameraGO.AddComponent(); +#pragma warning restore CS0618 m_Camera = cameraGO.GetComponent(); m_Camera.enabled = false; diff --git a/Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs b/Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs index f7871955b5..a5ed94b789 100644 --- a/Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs +++ b/Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs @@ -10,6 +10,7 @@ using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security.Cryptography; +using Unity.Collections; namespace UnityEditor.Scripting.APIUpdater { @@ -114,9 +115,7 @@ public void RemoveDependencies(string dependent, params string[] dependencies) if (entry == null) return; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. entry.m_Dependencies.RemoveAll(candidate => dependencies.Contains(candidate.m_Name)); -#pragma warning restore UA2001 } public void RemoveRoot(string tbr, bool updateDependents = false) diff --git a/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/PotentiallyUpdatableErrorMessages.cs b/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/PotentiallyUpdatableErrorMessages.cs index 346e36d70b..e190db47d9 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/PotentiallyUpdatableErrorMessages.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/PotentiallyUpdatableErrorMessages.cs @@ -9,6 +9,7 @@ using NiceIO; using UnityEditor.Scripting.Compilers; using UnityEngine; +using Unity.Collections; namespace UnityEditor.Scripting.ScriptCompilation { diff --git a/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/UnityScriptUpdater.cs b/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/UnityScriptUpdater.cs index 05ffc0c3af..fee0873f51 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/UnityScriptUpdater.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/BeeDriver/UnityScriptUpdater.cs @@ -3,7 +3,6 @@ // https://unity3d.com/legal/licenses/Unity_Reference_Only_License using System; -using System.IO; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -16,6 +15,7 @@ using UnityEditor.Scripting.Compilers; using UnityEditorInternal.APIUpdating; using Bee.BinLog; +using Unity.Collections; namespace UnityEditor.Scripting.ScriptCompilation { @@ -195,9 +195,7 @@ static Results CollectResultsIfAny(BeeDriverResult.Message[] messages, string no #pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. updates = updateLines.Select(ParseLineIntoUpdate).ToArray(); #pragma warning restore UA2001 -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (updates.Contains(null)) -#pragma warning restore UA2001 return ErrorResult($"Script updater for {nodeOutputFile} emitted an invalid line to {updateTxtFile}"); if (containsUpdatableCompilerMessage == CanUpdateAny.Certainly && updates.Length == 0) diff --git a/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs b/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs index dd6fe46a19..4c200bb289 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using UnityEditor.Scripting; using UnityEditor.Scripting.Compilers; @@ -14,6 +13,7 @@ using UnityEngine.Scripting; using sc = UnityEditor.Scripting.ScriptCompilation; using UnityEngine.Bindings; +using Unity.Collections; namespace UnityEditor.Compilation { @@ -679,9 +679,7 @@ static bool IsInternalPlugin(string fullReference) { if (AssemblyHelper.IsInternalAssembly(fullReference)) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (!Modules.ModuleUtils.GetAdditionalReferencesForEditorCsharpProject().Contains(fullReference)) -#pragma warning restore UA2001 return true; } return false; diff --git a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs index b90dfa468c..8f198eecd3 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/CustomScriptAssembly.cs @@ -6,11 +6,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using UnityEditor.Build; using UnityEditor.Compilation; using UnityEditor.Modules; -using UnityEditor.Scripting.Compilers; -using UnityEditorInternal; +using Unity.Collections; using DiscoveredTargetInfo = UnityEditor.BuildTargetDiscovery.DiscoveredTargetInfo; namespace UnityEditor.Scripting.ScriptCompilation @@ -390,9 +388,7 @@ public bool IsCompatibleWith(BuildTarget buildTarget, int subTarget, EditorScrip bool buildingForEditor = (options & EditorScriptCompilationOptions.BuildingForEditor) == EditorScriptCompilationOptions.BuildingForEditor; var isBuildingWithTestAssemblies = (options & EditorScriptCompilationOptions.BuildingIncludingTestAssemblies) == EditorScriptCompilationOptions.BuildingIncludingTestAssemblies; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. var isTestAssembly = DefineConstraints != null && DefineConstraints.Contains("UNITY_INCLUDE_TESTS"); -#pragma warning restore UA2001 var isTestFrameworkAssembly = DefineConstraints != null && Array.Exists(DefineConstraints, x => x == "UNITY_TESTS_FRAMEWORK"); if (!buildingForEditor && (isTestAssembly || isTestFrameworkAssembly) && !isBuildingWithTestAssemblies) { diff --git a/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs b/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs index 4584a38d2b..067e87456f 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs @@ -8,10 +8,8 @@ using System.Linq; using System.Runtime.InteropServices; using System.Threading; -using System.Threading.Tasks; using NiceIO; using Bee.BeeDriver; -using Bee.BinLog; using ScriptCompilationBuildProgram.Data; using Unity.Profiling; using UnityEditor.Compilation; @@ -28,6 +26,7 @@ using UnityEditor.Build; using UnityEngine.Pool; using UnityEngine.Bindings; +using Unity.Collections; namespace UnityEditor.Scripting.ScriptCompilation { diff --git a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs index 5172b96f91..538a3b052a 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/MsBuild/MsBuildCompilation.cs @@ -132,7 +132,7 @@ public EditorCompilation.CompileStatus TickCompilationPipeline(BuildTarget build UnityEditorMSBuildPropsTargetsGeneration.UpdateGeneratedMSBuildFileIfNeeded(buildTarget, compilationOptions); - var generateBinLog = (bool)UnityEngine.Debug.GetDiagnosticSwitch("ScriptCompilationMsBuildBinlog").value; + var generateBinLog = (bool)UnityEngine.Debug.GetDiagnosticSwitch("ScriptCompilationMsBuildBinlog").value || Application.HasARGV("generate-binlog"); var disableNugetRestore = Application.HasARGV("disable-nuget-restore"); _currentBuildTask = _currentBuildState.BuildAsync(_shouldRestore, generateBinLog, GetMsBuildConfiguration(target, buildTarget), !disableNugetRestore); diff --git a/Editor/Mono/Scripting/ScriptCompilation/RoslynAnalyzers.cs b/Editor/Mono/Scripting/ScriptCompilation/RoslynAnalyzers.cs index 99442f89bd..bd3488c7c2 100644 --- a/Editor/Mono/Scripting/ScriptCompilation/RoslynAnalyzers.cs +++ b/Editor/Mono/Scripting/ScriptCompilation/RoslynAnalyzers.cs @@ -45,9 +45,7 @@ private static string[] SetAnalyzers(ScriptAssembly scriptAssembly, IEnumerable< #pragma warning restore UA2001 .Where(a => a.scriptAssemblyFileName == null || a.scriptAssemblyFileName == scriptAssembly.Filename || -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - scanPrecompiledReferences && scriptAssembly.References.Select(Path.GetFileName).Contains(a.scriptAssemblyFileName)) -#pragma warning restore UA2001 + scanPrecompiledReferences && Array.Exists(scriptAssembly.References, b => Path.GetFileName(b) == a.scriptAssemblyFileName)) .Select(a => a.analyzerDll)) .Distinct() .ToArray(); diff --git a/Editor/Mono/Selection/Selection.bindings.cs b/Editor/Mono/Selection/Selection.bindings.cs index 45b040c155..0a0659e6a2 100644 --- a/Editor/Mono/Selection/Selection.bindings.cs +++ b/Editor/Mono/Selection/Selection.bindings.cs @@ -30,7 +30,7 @@ public enum SelectionMode // Return a selection that only contains top level selection of all visible assets //TopLevelAssets = 64, // Renamed to Editable - [Obsolete("'OnlyUserModifiable' is obsolete. Use 'Editable' instead. (UnityUpgradeable) -> Editable", true)] + [Obsolete("'OnlyUserModifiable' is obsolete. Use 'Editable' instead. (UnityUpgradable) -> Editable", true)] OnlyUserModifiable = 8 } diff --git a/Editor/Mono/SerializationDebug.bindings.cs b/Editor/Mono/SerializationDebug.bindings.cs index 03724cec4a..0542ed8ae4 100644 --- a/Editor/Mono/SerializationDebug.bindings.cs +++ b/Editor/Mono/SerializationDebug.bindings.cs @@ -163,6 +163,10 @@ private static string GetLogString(SerializedObject serializerObject) case SerializedPropertyType.EntityId: propertyValue = $"{property.entityIdValue}"; break; + + case SerializedPropertyType.LoadableReference: + propertyValue = $"{property.loadableReferenceValue}"; + break; } if (property.prefabOverride) diff --git a/Editor/Mono/SerializedObject.bindings.cs b/Editor/Mono/SerializedObject.bindings.cs index 21ee86b600..c023017e39 100644 --- a/Editor/Mono/SerializedObject.bindings.cs +++ b/Editor/Mono/SerializedObject.bindings.cs @@ -104,6 +104,7 @@ internal SerializedProperty FindPropertyIgnoreCase(string propertyPath) /// "c.nested" on a MonoBehaviour (declared in that order), then calling this method with /// "managedReferences[1].x" would return the SerializedProperty with property path "a.x". /// + [VisibleToOtherModules("UnityEditor.UIToolkitAuthoringModule")] internal SerializedProperty FindFirstPropertyFromManagedReferencePath(string propertyPath) { SerializedProperty i = GetIterator_Internal(); diff --git a/Editor/Mono/SerializedProperty.bindings.cs b/Editor/Mono/SerializedProperty.bindings.cs index c6edbf89ec..1769fcb544 100644 --- a/Editor/Mono/SerializedProperty.bindings.cs +++ b/Editor/Mono/SerializedProperty.bindings.cs @@ -92,7 +92,10 @@ public enum SerializedPropertyType EntityId = 27, // GUID value - GUID = 28 + GUID = 28, + + // LoadableReference value + LoadableReference = 29 } // This enum exposes extra detail, because SerializedPropertyType classifies all numeric types as Integer or Float @@ -368,6 +371,7 @@ public System.Object boxedValue case SerializedPropertyType.Hash128: return hash128Value; case SerializedPropertyType.GUID: return guidValue; case SerializedPropertyType.EntityId: return entityIdValue; + case SerializedPropertyType.LoadableReference: return loadableReferenceValue; default: throw new NotSupportedException(string.Format("The boxedValue property is not supported on \"{0}\" because it has an unsupported propertyType {1}.", propertyPath, propertyType)); @@ -456,6 +460,7 @@ public System.Object boxedValue case SerializedPropertyType.Hash128: hash128Value = (Hash128)value; break; case SerializedPropertyType.GUID: guidValue = (GUID)value; break; case SerializedPropertyType.EntityId: entityIdValue = (EntityId)value; break; + case SerializedPropertyType.LoadableReference: loadableReferenceValue = (LoadableReference)value; break; default: // FixedBufferSize is read-only throw new NotSupportedException(string.Format("Set on boxedValue property is not supported on \"{0}\" because it has an unsupported propertyType {1}.", propertyPath, propertyType)); @@ -1225,6 +1230,12 @@ public AnimationCurve animationCurveValue [NativeName("SetAnimationCurveValue")] private extern void SetAnimationCurveValueInternal(AnimationCurve value); + [NativeName("GetLoadableReferenceValue")] + private extern LoadableReference GetLoadableReferenceValueInternal(); + + [NativeName("SetLoadableReferenceValue")] + private extern void SetLoadableReferenceValueInternal(LoadableReference value); + // Value of a gradient property. public Gradient gradientValue { @@ -1808,6 +1819,20 @@ public GUID guidValue } } + internal LoadableReference loadableReferenceValue + { + get + { + Verify(VerifyFlags.IteratorNotAtEnd); + return (LoadableReference)GetLoadableReferenceValueInternal(); + } + set + { + Verify(VerifyFlags.IteratorNotAtEnd); + SetLoadableReferenceValueInternal(value); + } + } + [FreeFunction(Name = "SerializedPropertyBindings::GetHash128ValueInternal", HasExplicitThis = true)] private extern Hash128 GetHash128ValueInternal(); @@ -2105,6 +2130,15 @@ internal bool ValueEquals(string value) return StringValueEquals(value); } + [NativeName("LoadableReferenceValueEquals")] + extern private bool LoadableReferenceValueEquals(LoadableReference value); + + internal bool ValueEquals(LoadableReference value) + { + Verify(VerifyFlags.IteratorNotAtEnd); + return LoadableReferenceValueEquals(value); + } + internal bool unsafeMode {get; set; } [VisibleToOtherModules("UnityEditor.TextRenderingModule")] diff --git a/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs b/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs index b643f968c7..2a095e5ba3 100644 --- a/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs +++ b/Editor/Mono/SerializedProperty/SerializedPropertyTreeView.cs @@ -7,6 +7,7 @@ using UnityEngine; using UnityEditor.IMGUI.Controls; using UnityEngine.Profiling; +using Unity.Collections; namespace UnityEditor { diff --git a/Editor/Mono/Text/EditorTextSettings.cs b/Editor/Mono/Text/EditorTextSettings.cs index 1058b687c5..e7c807b3f5 100644 --- a/Editor/Mono/Text/EditorTextSettings.cs +++ b/Editor/Mono/Text/EditorTextSettings.cs @@ -12,6 +12,8 @@ using TextGenerationSettings = UnityEngine.TextCore.Text.TextGenerationSettings; using UnityEngine.Bindings; +#pragma warning disable CS0618 // emojiFallbackTextAssets is obsolete; internal usage + namespace UnityEditor { /// @@ -328,3 +330,5 @@ public static class RobotoMono } } } + +#pragma warning restore CS0618 diff --git a/Editor/Mono/Tools/EditorToolManager.cs b/Editor/Mono/Tools/EditorToolManager.cs index 08ba014dd4..a661631d02 100644 --- a/Editor/Mono/Tools/EditorToolManager.cs +++ b/Editor/Mono/Tools/EditorToolManager.cs @@ -101,9 +101,7 @@ internal static EditorToolContext activeToolContext // Make sure to get the active tool enum prior to setting the context, otherwise we'll be comparing // apples to oranges. Ie, the transform tools will be different despite being the same `Tool` enum value. var tool = Tools.current; -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. var wasAdditionalContextTool = tool == Tool.Custom && additionalContextToolTypesCache.Contains(activeTool.GetType()); -#pragma warning restore UA2001 var prev = instance.m_ActiveToolContext; if (prev != null) @@ -140,9 +138,9 @@ internal static EditorToolContext activeToolContext // when moving to that new context else if(wasAdditionalContextTool) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. +#pragma warning disable UA2007 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. var isAdditionalContextTool = instance.m_ActiveToolContext.GetAdditionalToolTypes().Contains(activeTool.GetType()); -#pragma warning restore UA2001 +#pragma warning restore UA2007 if(!isAdditionalContextTool) RestorePreviousPersistentTool(); @@ -245,8 +243,11 @@ struct ComponentToolCache : ISerializationCallbackReceiver [SerializeField] string m_ContextType; + [NonSerialized] public Type contextType; + [NonSerialized] public Type toolType; + public UnityObject targetObject; public UnityObject[] targetObjects; diff --git a/Editor/Mono/UIElements/BaseLiveReloadAssetTracker.cs b/Editor/Mono/UIElements/BaseLiveReloadAssetTracker.cs index e7c4ac94fb..95a9348616 100644 --- a/Editor/Mono/UIElements/BaseLiveReloadAssetTracker.cs +++ b/Editor/Mono/UIElements/BaseLiveReloadAssetTracker.cs @@ -17,6 +17,7 @@ class AssetTracking where T : ScriptableObject public int m_LastElementCount; public int m_LastInlinePropertiesCount; public int m_LastAttributePropertiesDirtyCount; + public int m_LastStyleSheetCount; public int m_ReferenceCount; } @@ -88,43 +89,6 @@ public bool IsTrackingAssets() return m_TrackedAssets.Count > 0; } - public bool CheckTrackedAssetsDirty() - { - // Early out: no assets being tracked. - if (m_TrackedAssets.Count == 0) - { - return false; - } - - bool isTrackedAssetDirty = false; - - foreach (var styleSheetAssetEntry in m_TrackedAssets) - { - var tracking = styleSheetAssetEntry.Value; - int currentDirtyCount = EditorUtility.GetDirtyCount(tracking.m_Asset); - - if (tracking.m_LastDirtyCount != currentDirtyCount) - { - tracking.m_LastDirtyCount = currentDirtyCount; - isTrackedAssetDirty = true; - } - } - - return isTrackedAssetDirty; - } - - public void UpdateAssetTrackerCounts(T asset, int newDirtyCount, int newElementCount, int newInlinePropertiesCount, int newAttributePropertiesDirtyCount) - { - if (m_TrackedAssets.TryGetValue(asset.GetEntityId(), out var assetTracking)) - { - assetTracking.m_LastDirtyCount = newDirtyCount; - assetTracking.m_LastElementCount = newElementCount; - assetTracking.m_LastInlinePropertiesCount = newInlinePropertiesCount; - assetTracking.m_LastAttributePropertiesDirtyCount = newAttributePropertiesDirtyCount; - assetTracking.m_LastDirtyCount = newDirtyCount; - } - } - public abstract bool OnAssetsImported(HashSet changedAssets, HashSet deletedAssets); public virtual void OnTrackedAssetChanged() {} diff --git a/Editor/Mono/UIElements/Controls/ColorField.cs b/Editor/Mono/UIElements/Controls/ColorField.cs index 6e3f1ec449..9ce1743fa3 100644 --- a/Editor/Mono/UIElements/Controls/ColorField.cs +++ b/Editor/Mono/UIElements/Controls/ColorField.cs @@ -394,17 +394,17 @@ void UpdateColorProperties(Color color) if (m_AlphaElement != null) m_AlphaElement.value = color.a * 100.0f; - color = new Color(color.r, color.g, color.b, 1.0f); + var colorWithoutAlpha = new Color(color.r, color.g, color.b); - if(Color.defaultColorNames.TryGetValue(color, out var name)) + if(Color.defaultColorNames.TryGetValue(colorWithoutAlpha, out var name)) m_ColorContainer.tooltip = $"{ObjectNames.CapitaliseFirstLetter(name)} {color.ToString()}"; else m_ColorContainer.tooltip = color.ToString(); if (hdr) { - color = color.gamma; - ColorMutator.DecomposeHdrColor(color.linear, out var baseColor, out _); + colorWithoutAlpha = colorWithoutAlpha.gamma; + ColorMutator.DecomposeHdrColor(colorWithoutAlpha.linear, out var baseColor, out _); Color gradientColor = ((Color)baseColor).gamma; if (m_LeftGradient != null) @@ -416,19 +416,19 @@ void UpdateColorProperties(Color color) { var leftAlphaTex = ColorPicker.GetGradientTextureWithAlpha0To1(); m_LeftAlphaGradient.style.backgroundImage = leftAlphaTex; - m_LeftAlphaGradient.style.unityBackgroundImageTintColor = color; + m_LeftAlphaGradient.style.unityBackgroundImageTintColor = colorWithoutAlpha; } if (m_RightAlphaGradient != null) { var rightAlphaTex = ColorPicker.GetGradientTextureWithAlpha1To0(); m_RightAlphaGradient.style.backgroundImage = rightAlphaTex; - m_RightAlphaGradient.style.unityBackgroundImageTintColor = color; + m_RightAlphaGradient.style.unityBackgroundImageTintColor = colorWithoutAlpha; } } if (m_ColorElement != null) - m_ColorElement.style.backgroundColor = color; + m_ColorElement.style.backgroundColor = colorWithoutAlpha; } void OnAttach(AttachToPanelEvent evt) diff --git a/Editor/Mono/UIElements/Controls/LoadableReferenceField.cs b/Editor/Mono/UIElements/Controls/LoadableReferenceField.cs new file mode 100644 index 0000000000..1ae6a800c7 --- /dev/null +++ b/Editor/Mono/UIElements/Controls/LoadableReferenceField.cs @@ -0,0 +1,93 @@ +// 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; +using UnityEngine.UIElements; +using Object = UnityEngine.Object; + +namespace UnityEditor.UIElements +{ + /// + /// Makes a field for editing a . + /// + [Icon("UIToolkit/Icons/ObjectField.png")] + [VisibleToOtherModules("UnityEditor.ContentLoadModule")] + internal class LoadableReferenceField : BaseField + { + private ObjectField m_ObjectField; + + /// + /// USS class name of elements of this type. + /// + public new static readonly string ussClassName = "unity-loadable-reference-field"; + + /// + /// USS class name of labels in elements of this type. + /// + public new static readonly string labelUssClassName = ussClassName + "__label"; + + /// + /// USS class name of input elements in elements of this type. + /// + public new static readonly string inputUssClassName = ussClassName + "__input"; + + /// + /// Initializes and returns an instance of LoadableReferenceField. + /// + public LoadableReferenceField() + : this((string)null) {} + + /// + /// Initializes and returns an instance of LoadableReferenceField. + /// + /// The text to use as a label. + public LoadableReferenceField(string label) + : this(label, null) {} + + /// + /// Initializes and returns an instance of LoadableReferenceField. + /// + /// The text to use as a label. + /// The type of objects that can be assigned. When null, any UnityEngine.Object is allowed. + public LoadableReferenceField(string label, Type objectType) + : base(label, null) + { + m_ObjectField = new ObjectField + { + allowSceneObjects = false, + objectType = objectType ?? typeof(Object) + }; + m_ObjectField.RegisterValueChangedCallback(OnObjectFieldValueChanged); + + visualInput.Add(m_ObjectField); + visualInput.AddToClassList(inputUssClassName); + labelElement.AddToClassList(labelUssClassName); + AddToClassList(ussClassName); + } + + private void OnObjectFieldValueChanged(ChangeEvent evt) + { + LoadableReference newLoadableRef = LoadableReferenceEditorUtility.ObjectToLoadableReference(evt.newValue); + if (evt.newValue != null && !newLoadableRef.isValid) + { + UnityEngine.Debug.LogWarning(L10n.Tr("The selected object cannot be used as a LoadableReference.")); + m_ObjectField.SetValueWithoutNotify(LoadableReferenceEditorUtility.LoadableReferenceToObject(value)); + return; + } + + value = newLoadableRef; + evt.StopImmediatePropagation(); + } + + public override void SetValueWithoutNotify(LoadableReference newValue) + { + base.SetValueWithoutNotify(newValue); + + var obj = LoadableReferenceEditorUtility.LoadableReferenceToObject(value); + m_ObjectField.SetValueWithoutNotify(obj); + } + } +} diff --git a/Editor/Mono/UIElements/Controls/ObjectField.cs b/Editor/Mono/UIElements/Controls/ObjectField.cs index c59652dc2f..58f598e458 100644 --- a/Editor/Mono/UIElements/Controls/ObjectField.cs +++ b/Editor/Mono/UIElements/Controls/ObjectField.cs @@ -21,6 +21,7 @@ public partial class ObjectField : BaseField { internal static readonly BindingId objectTypeProperty = nameof(objectType); internal static readonly BindingId allowSceneObjectsProperty = nameof(allowSceneObjects); + internal static readonly BindingId allowBuiltinResourcesProperty = nameof(allowBuiltinResources); private event Action m_OnObjectSelectorShow = () => { }; @@ -41,6 +42,7 @@ internal event Action onObjectSelectorShow UxmlDescriptionCache.RegisterType(typeof(UxmlSerializedData), new UxmlAttributeNames[] { new (nameof(allowSceneObjects), "allow-scene-objects"), + new (nameof(allowBuiltinResources), "allow-builtin-resources"), new (nameof(objectType), "type", typeof(Object)), }, true); } @@ -49,7 +51,9 @@ internal event Action onObjectSelectorShow [UxmlAttribute("type"), UxmlTypeReference(typeof(Object))] [SerializeField] string objectType; [SerializeField] bool allowSceneObjects; + [SerializeField] bool allowBuiltinResources; [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags allowSceneObjects_UxmlAttributeFlags; + [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags allowBuiltinResources_UxmlAttributeFlags; [SerializeField, UxmlIgnore, HideInInspector] UxmlAttributeFlags objectType_UxmlAttributeFlags; #pragma warning restore 649 @@ -62,6 +66,8 @@ public override void Deserialize(object obj) var e = (ObjectField)obj; if (ShouldWriteAttributeValue(allowSceneObjects_UxmlAttributeFlags)) e.allowSceneObjects = allowSceneObjects; + if (ShouldWriteAttributeValue(allowBuiltinResources_UxmlAttributeFlags)) + e.allowBuiltinResources = allowBuiltinResources; if (ShouldWriteAttributeValue(objectType_UxmlAttributeFlags)) e.objectType = UxmlUtility.ParseType(objectType, typeof(Object)); } @@ -131,6 +137,24 @@ public bool allowSceneObjects } } + bool m_AllowBuiltinResources = true; + + /// + /// Shows or hides built-in resources in the object selector popup. True by default to show built-in resources. + /// + [CreateProperty] + public bool allowBuiltinResources + { + get => m_AllowBuiltinResources; + set + { + if (m_AllowBuiltinResources == value) + return; + m_AllowBuiltinResources = value; + NotifyPropertyChanged(allowBuiltinResourcesProperty); + } + } + protected override void UpdateMixedValueContent() { m_ObjectFieldDisplay?.ShowMixedValue(showMixedValue); @@ -489,7 +513,7 @@ internal void OnObjectSelectorClosed(Object obj) internal void ShowObjectSelector() { // All the object changes will be notified through the OnObjectChanged and a "cancellation" (Escape key) on the ObjectSelector is calling the closing callback without any good object - ObjectSelector.get.Show(value, objectType, null, allowSceneObjects, null, OnObjectSelectorClosed, OnObjectChanged); + ObjectSelector.get.Show(value, objectType, null, allowSceneObjects, null, OnObjectSelectorClosed, OnObjectChanged, true, m_AllowBuiltinResources); m_OnObjectSelectorShow?.Invoke(); } diff --git a/Editor/Mono/UIElements/Controls/PropertyField.cs b/Editor/Mono/UIElements/Controls/PropertyField.cs index b23e0a1a5d..972d7107ff 100644 --- a/Editor/Mono/UIElements/Controls/PropertyField.cs +++ b/Editor/Mono/UIElements/Controls/PropertyField.cs @@ -842,6 +842,7 @@ private void DetachDebugCallbackFromPanel(DetachFromPanelEvent evt) } } + [VisibleToOtherModules("UnityEditor.ContentLoadModule")] internal static void ConfigureFieldStyles(TField field) where TField : BaseField { field.labelElement.AddToClassList(labelUssClassName); @@ -1211,6 +1212,9 @@ private VisualElement CreateOrUpdateFieldFromProperty(SerializedProperty propert case SerializedPropertyType.EntityId: return ConfigureField(originalField as EntityIdField, property, () => new EntityIdField()); + case SerializedPropertyType.LoadableReference: + return ConfigureField(originalField as LoadableReferenceField, property, () => new LoadableReferenceField()); + case SerializedPropertyType.Generic: if (property.type == nameof(ToggleButtonGroupState)) { @@ -1240,6 +1244,7 @@ private void RegisterPropertyChangesOnCustomDrawerElement(VisualElement customPr customPropertyDrawer.RegisterCallback>((changeEvent) => AsyncDispatchPropertyChangedEvent()); customPropertyDrawer.RegisterCallback>((changeEvent) => AsyncDispatchPropertyChangedEvent()); customPropertyDrawer.RegisterCallback>((changeEvent) => AsyncDispatchPropertyChangedEvent()); + customPropertyDrawer.RegisterCallback>((changeEvent) => AsyncDispatchPropertyChangedEvent()); // SerializedPropertyType.LayerMask -> int // SerializedPropertyType.Enum is handled either by string or customPropertyDrawer.RegisterCallback>((changeEvent) => AsyncDispatchPropertyChangedEvent()); diff --git a/Editor/Mono/UIElements/UIElementsEditorUtility.cs b/Editor/Mono/UIElements/UIElementsEditorUtility.cs index 0572bc6ab1..d1eee65f40 100644 --- a/Editor/Mono/UIElements/UIElementsEditorUtility.cs +++ b/Editor/Mono/UIElements/UIElementsEditorUtility.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; +using Unity.Scripting.LifecycleManagement; using UnityEditor.Experimental; using UnityEngine; using UnityEngine.Bindings; @@ -13,7 +14,7 @@ namespace UnityEditor.UIElements { [VisibleToOtherModules("UnityEditor.UIBuilderModule")] - internal static class UIElementsEditorUtility + internal static partial class UIElementsEditorUtility { internal static readonly string s_DefaultCommonDarkStyleSheetPath = "StyleSheets/Generated/DefaultCommonDark.uss.asset"; internal static readonly string s_DefaultCommonLightStyleSheetPath = "StyleSheets/Generated/DefaultCommonLight.uss.asset"; @@ -21,6 +22,18 @@ internal static class UIElementsEditorUtility static StyleSheet s_DefaultCommonDarkStyleSheet; static StyleSheet s_DefaultCommonLightStyleSheet; + [OnCodeLoaded] + static void RegisterUndoHandler() + { + Undo.undoRedoEvent += ClearStyleCacheAfterUndoIfTracked; + } + + [OnCodeUnloading] + static void UnregisterUndoHandler() + { + Undo.undoRedoEvent -= ClearStyleCacheAfterUndoIfTracked; + } + internal static string GetStyleSheetPathForFont(string sheetPath, string fontName) { return sheetPath.Replace(".uss", "_" + fontName.ToLowerInvariant() + ".uss"); @@ -280,5 +293,18 @@ internal static Action BindSerializedProperty(EnumField enumField, Serialized updateCallback?.Invoke(); return updateCallback; } + + static void ClearStyleCacheAfterUndoIfTracked(in UndoRedoInfo undo) + { + var iterator = UIElementsUtility.GetPanelsIterator(); + var shouldClearCache = false; + while (iterator.MoveNext()) + { + var panel = iterator.Current.Value; + shouldClearCache |= panel.liveReloadSystem.AnyStyleSheetMarkedDirtyAfterUndo(); + } + if (shouldClearCache) + StyleCache.ClearStyleCache(); + } } } diff --git a/Editor/Mono/UnityConnect/Services/ServicesConfiguration.cs b/Editor/Mono/UnityConnect/Services/ServicesConfiguration.cs index 1268de8a81..df6aed8e8e 100644 --- a/Editor/Mono/UnityConnect/Services/ServicesConfiguration.cs +++ b/Editor/Mono/UnityConnect/Services/ServicesConfiguration.cs @@ -249,7 +249,7 @@ void LoadDefaultConfigurations() ""asset_store_api"":""https://packages.unity.com"", ""asset_store_url"":""https://assetstore.unity.com"", ""packman_key"":""6357C523886E813D1500408F05B0D7A6"", - ""services-gateway"":""https://serivices.unity.com""}"; + ""services-gateway"":""https://services.unity.com""}"; LoadJsonConfiguration(hardCodedConfigs); } diff --git a/Editor/Mono/Utils/Paths.cs b/Editor/Mono/Utils/Paths.cs index b3e43ea280..5b8d3552eb 100644 --- a/Editor/Mono/Utils/Paths.cs +++ b/Editor/Mono/Utils/Paths.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using UnityEngine.Bindings; +using Unity.Collections; namespace UnityEditor.Utils { @@ -361,9 +362,7 @@ public static string MakeValidFileName(string unsafeFileName) while (charEnum.MoveNext()) { var c = charEnum.GetTextElement(); -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. if (c.Length == 1 && invalidFilenameChars.Contains(c[0])) -#pragma warning restore UA2001 continue; var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c, 0); if (unicodeCategory != UnicodeCategory.NonSpacingMark) diff --git a/Editor/Mono/View.cs b/Editor/Mono/View.cs index dd78d95563..e96c48cda3 100644 --- a/Editor/Mono/View.cs +++ b/Editor/Mono/View.cs @@ -50,7 +50,6 @@ internal string DebugHierarchy(int level) } // Can be used by concrete subclasses to store C++ objects - [SerializeField] MonoReloadableIntPtr m_ViewPtr; [SerializeField] View[] m_Children = Array.Empty(); diff --git a/External/NVUnityPlugin/Scripts/NVCommands.cs b/External/NVUnityPlugin/Scripts/NVCommands.cs index 43163ae56d..8460f95444 100644 --- a/External/NVUnityPlugin/Scripts/NVCommands.cs +++ b/External/NVUnityPlugin/Scripts/NVCommands.cs @@ -44,7 +44,9 @@ public enum DLSSPreset Preset_Default = 0, Preset_F = 1 << 0, Preset_J = 1 << 1, - Preset_K = 1 << 2 + Preset_K = 1 << 2, + Preset_L = 1 << 3, + Preset_M = 1 << 4 } ///////////////////////////////////////////////////////////////////////////////////// diff --git a/External/NiceIO/NiceIO.cs b/External/NiceIO/NiceIO.cs index 7649ef3a0d..b94736bceb 100644 --- a/External/NiceIO/NiceIO.cs +++ b/External/NiceIO/NiceIO.cs @@ -17,7 +17,7 @@ using Directory = NiceIO.Do_Not_Use_Directory_Directly_Use_FileSystem_Active_Instead; #nullable disable -#pragma warning disable UA2001 // Linq usages in external code won't be changed +#pragma warning disable UA2001, UA2007 // Linq usages in external code won't be changed namespace NiceIO { diff --git a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeGen/ClassAutoCleanup.cs b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeGen/ClassAutoCleanup.cs index 19a6b5df39..6ef3c6c62d 100644 --- a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeGen/ClassAutoCleanup.cs +++ b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeGen/ClassAutoCleanup.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Text; namespace Unity.Scripting.LifecycleManagement.CodeGen @@ -8,11 +9,16 @@ namespace Unity.Scripting.LifecycleManagement.CodeGen /// This class is not supposed to be used directly, but is supporting the codegen for the AutoStaticsCleanupAttribute. /// It is public to allow the code generator to be able to create subclassed of it in user code. /// - internal abstract class ClassAutoCleanup + public abstract class ClassAutoCleanup { public abstract void Cleanup(); - protected ClassAutoCleanup(Type scopeType, ScopeTransitionType cleanOn) + protected ClassAutoCleanup(Type scopeType) + { + LifecycleController.Instance.RegisterAutoCleanup(this, scopeType, ScopeTransitionType.Both); + } + + internal ClassAutoCleanup(Type scopeType, ScopeTransitionType cleanOn) { LifecycleController.Instance.RegisterAutoCleanup(this, scopeType, cleanOn); } diff --git a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeInitializedScope.cs b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeInitializedScope.cs index 6d2ec8841d..4a1ff012c5 100644 --- a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeInitializedScope.cs +++ b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeInitializedScope.cs @@ -12,12 +12,12 @@ namespace Unity.Scripting.LifecycleManagement { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - internal sealed class OnCodeInitializingAttribute : LifecycleAttributeBase + public sealed class OnCodeInitializingAttribute : LifecycleAttributeBase { } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - internal sealed class OnCodeDeinitializingAttribute : LifecycleAttributeBase + public sealed class OnCodeDeinitializingAttribute : LifecycleAttributeBase { } diff --git a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeLoadedScope.cs b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeLoadedScope.cs index df321a06b0..fb7787ac4a 100644 --- a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeLoadedScope.cs +++ b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/CodeLoadedScope.cs @@ -5,13 +5,13 @@ namespace Unity.Scripting.LifecycleManagement { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - internal sealed class OnCodeLoadedAttribute : LifecycleAttributeBase + public sealed class OnCodeLoadedAttribute : LifecycleAttributeBase { public OnCodeLoadedAttribute() { } } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - internal sealed class OnCodeUnloadingAttribute : LifecycleAttributeBase + public sealed class OnCodeUnloadingAttribute : LifecycleAttributeBase { public OnCodeUnloadingAttribute() { } } diff --git a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/LifecycleScopeBase.cs b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/LifecycleScopeBase.cs index b7214b69c4..5e3537d572 100644 --- a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/LifecycleScopeBase.cs +++ b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/LifecycleScopeBase.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using System.Linq; - namespace Unity.Scripting.LifecycleManagement { [System.Diagnostics.DebuggerDisplay("Scope Name = {Name}")] @@ -37,9 +34,7 @@ public LifecycleScopeBase(string name) public bool MustBeNestedInsideScope(string scopeName) { -#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. - return RequiredOuterScopes.Contains(scopeName); -#pragma warning restore UA2001 + return ExplicitRequiredOuterScopes.Contains(scopeName) || (Array.IndexOf(ImplicitOuterScopes, scopeName) != -1); } protected abstract void Enter(ScopeTransitionHelper scopeTransitionHelper); diff --git a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/StaticsCleanupAttributes.cs b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/StaticsCleanupAttributes.cs index 10c2086e90..f00e139a4e 100644 --- a/External/ScriptingCore/Unity.Scripting/LifecycleManagement/StaticsCleanupAttributes.cs +++ b/External/ScriptingCore/Unity.Scripting/LifecycleManagement/StaticsCleanupAttributes.cs @@ -33,25 +33,37 @@ internal enum CleanupStrategy /// On a field, property or event, it will override the default cleanup strategy. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = true)] - internal sealed class AutoStaticsCleanupAttribute : Attribute + public sealed class AutoStaticsCleanupAttribute : Attribute { /// /// Type of the scope that will trigger the cleanup. /// Null means inherit defaults or "PlayMode" scope (if no default value set). /// - public Type? ScopeType { get; set; } = null; + internal Type? ScopeType { get; set; } = null; /// /// Defines if the cleanup should be performed on entering or exiting the scope. /// Null means inherit defaults or "Both" (if no default value set). /// - public ScopeTransitionType TransitionType { get; set; } + internal ScopeTransitionType TransitionType { get; set; } /// /// Defines how field or property cleanup should be performed. /// Null means inherit defaults or "Auto" (if no default value set). /// - public CleanupStrategy CleanupStrategy { get; set; } + internal CleanupStrategy CleanupStrategy { get; set; } + + public AutoStaticsCleanupAttribute() + { + + } + + internal AutoStaticsCleanupAttribute(Type? scopeType = null, ScopeTransitionType transitionType = ScopeTransitionType.Unset, CleanupStrategy cleanupStrategy = CleanupStrategy.Unset) + { + ScopeType = scopeType; + TransitionType = transitionType; + CleanupStrategy = cleanupStrategy; + } } /// @@ -72,7 +84,7 @@ internal sealed class AutoStaticsCleanupOnCodeReloadAttribute : Attribute /// Applied on a field, property or event, it will override the default rule. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false)] - internal sealed class NoAutoStaticsCleanupAttribute : Attribute + public sealed class NoAutoStaticsCleanupAttribute : Attribute { } diff --git a/Modules/AdaptivePerformance/Indexer/AdaptivePerformanceIndexer.cs b/Modules/AdaptivePerformance/Indexer/AdaptivePerformanceIndexer.cs index e91b05cbc7..30ad9dd0ee 100644 --- a/Modules/AdaptivePerformance/Indexer/AdaptivePerformanceIndexer.cs +++ b/Modules/AdaptivePerformance/Indexer/AdaptivePerformanceIndexer.cs @@ -39,58 +39,68 @@ internal class ThermalStateTracker private float warningTemp = 1.0f; private float throttlingTemp = 1.0f; - public ThermalStateTracker() - { - } - public StateAction Update() { - // Do not perform action if thermal level is not supported. - if(!Holder.Instance.SupportedFeature(Provider.Feature.TemperatureLevel)) + var ap = Holder.Instance; + if (ap == null) return StateAction.Stale; - float thermalTrend = Holder.Instance.ThermalStatus.ThermalMetrics.TemperatureTrend; - - var thermalLevel = Holder.Instance.ThermalStatus.ThermalMetrics.TemperatureLevel; - var warning = Holder.Instance.ThermalStatus.ThermalMetrics.WarningLevel; - if (warning == WarningLevel.ThrottlingImminent && warningTemp == 1.0f) - warningTemp = thermalLevel; // remember throttling imminent level - - if (warning == WarningLevel.Throttling && throttlingTemp == 1.0f) - throttlingTemp = thermalLevel; // remember throttling level - - // Throttling needs to cool down a lot before changing to no warning - if (warning == WarningLevel.Throttling || thermalLevel >= throttlingTemp) - return StateAction.FastDecrease; - - // warm device - if (warning == WarningLevel.ThrottlingImminent || thermalLevel >= warningTemp) - { - // halfway to throttling? - if (thermalLevel > (warningTemp + throttlingTemp) / 2) - return StateAction.Decrease; - - if (thermalTrend <= 0) - return StateAction.Stale; - else if (thermalTrend > 0.5) - return StateAction.FastDecrease; - else - return StateAction.Decrease; - } - - - // normal operating conditions - if (warning == WarningLevel.NoWarning && thermalLevel < warningTemp) + if(ap.SupportedFeature(Provider.Feature.WarningLevel)) { - if (thermalTrend <= 0) - return StateAction.Increase; - else if (thermalTrend > 0.5) - return StateAction.FastDecrease; - else if (thermalTrend > 0.1) - return StateAction.Decrease; - } - + var thermalMetrics = ap.ThermalStatus.ThermalMetrics; + var warning = thermalMetrics.WarningLevel; + if(ap.SupportedFeature(Provider.Feature.TemperatureLevel)) + { + var thermalTrend = thermalMetrics.TemperatureTrend; + var thermalLevel = thermalMetrics.TemperatureLevel; + + + if (warning == WarningLevel.ThrottlingImminent && warningTemp == 1.0f) + warningTemp = thermalLevel; // remember throttling imminent level + + if (warning == WarningLevel.Throttling && throttlingTemp == 1.0f) + throttlingTemp = thermalLevel; // remember throttling level + + // Throttling needs to cool down a lot before changing to no warning + if (warning == WarningLevel.Throttling || thermalLevel >= throttlingTemp) + return StateAction.FastDecrease; + + // warm device + if (warning == WarningLevel.ThrottlingImminent || thermalLevel >= warningTemp) + { + // halfway to throttling? + if (thermalLevel > (warningTemp + throttlingTemp) / 2) + return StateAction.Decrease; + + if (thermalTrend <= 0) + return StateAction.Stale; + else if (thermalTrend > 0.5) + return StateAction.FastDecrease; + else + return StateAction.Decrease; + } + + + // normal operating conditions + if (warning == WarningLevel.NoWarning && thermalLevel < warningTemp) + { + if (thermalTrend <= 0) + return StateAction.Increase; + else if (thermalTrend > 0.5) + return StateAction.FastDecrease; + else if (thermalTrend > 0.1) + return StateAction.Decrease; + } + } else { + if (warning == WarningLevel.Throttling) + return StateAction.FastDecrease; + else if (warning == WarningLevel.ThrottlingImminent) + return StateAction.Decrease; + else if (warning == WarningLevel.NoWarning) + return StateAction.Increase; + } + } return StateAction.Stale; } } @@ -113,7 +123,11 @@ public PerformanceStateTracker(int sampleCapacity) public StateAction Update() { - var frameMs = Holder.Instance.PerformanceStatus.FrameTiming.AverageFrameTime; + var ap = Holder.Instance; + if (ap == null) + return StateAction.Stale; + + var frameMs = ap.PerformanceStatus.FrameTiming.AverageFrameTime; if (frameMs > 0) { var targetMs = 1f / GetEffectiveTargetFrameRate(); @@ -159,22 +173,35 @@ internal class AdaptivePerformanceScalerEfficiencyTracker private float m_LastAverageGpuFrameTime; private float m_LastAverageCpuFrameTime; private bool m_IsApplied; + private IAdaptivePerformance m_AP; + + public AdaptivePerformanceScalerEfficiencyTracker() + { + m_AP = Holder.Instance; + } public bool IsRunning { get => m_Scaler != null; } public void Start(AdaptivePerformanceScaler scaler, bool isApply) { Debug.Assert(!IsRunning, "AdaptivePerformanceScalerEfficiencyTracker is already running"); + if (m_AP == null) + return; m_Scaler = scaler; - m_LastAverageGpuFrameTime = Holder.Instance.PerformanceStatus.FrameTiming.AverageGpuFrameTime; - m_LastAverageCpuFrameTime = Holder.Instance.PerformanceStatus.FrameTiming.AverageCpuFrameTime; + m_LastAverageGpuFrameTime = m_AP.PerformanceStatus.FrameTiming.AverageGpuFrameTime; + m_LastAverageCpuFrameTime = m_AP.PerformanceStatus.FrameTiming.AverageCpuFrameTime; m_IsApplied = true; } public void Stop() { - var gpu = Holder.Instance.PerformanceStatus.FrameTiming.AverageGpuFrameTime - m_LastAverageGpuFrameTime; - var cpu = Holder.Instance.PerformanceStatus.FrameTiming.AverageCpuFrameTime - m_LastAverageCpuFrameTime; + if (m_AP == null) + { + m_Scaler = null; + return; + } + var gpu = m_AP.PerformanceStatus.FrameTiming.AverageGpuFrameTime - m_LastAverageGpuFrameTime; + var cpu = m_AP.PerformanceStatus.FrameTiming.AverageCpuFrameTime - m_LastAverageCpuFrameTime; var sign = m_IsApplied ? 1 : -1; m_Scaler.GpuImpact = sign * (int)(gpu * 1000); m_Scaler.CpuImpact = sign * (int)(cpu * 1000); diff --git a/Modules/AdaptivePerformance/Management/IAdaptivePerformanceSettings.cs b/Modules/AdaptivePerformance/Management/IAdaptivePerformanceSettings.cs index 0b24785d1f..a3182f8f73 100644 --- a/Modules/AdaptivePerformance/Management/IAdaptivePerformanceSettings.cs +++ b/Modules/AdaptivePerformance/Management/IAdaptivePerformanceSettings.cs @@ -750,7 +750,7 @@ public bool enableBoostOnStartup set { m_EnableBoostOnStartup = value; } } - [SerializeField, Tooltip("Logging Frequency (Development mode only)")] + [SerializeField, Min(1), Tooltip("Logging Frequency (Development mode only)")] int m_StatsLoggingFrequencyInFrames = 50; /// diff --git a/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralBuildProcessor.cs b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralBuildProcessor.cs index 0eafbb40c6..e9672347ae 100644 --- a/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralBuildProcessor.cs +++ b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralBuildProcessor.cs @@ -39,6 +39,12 @@ public void OnPreprocessBuild(BuildReport report) Debug.Log("Frame timing stats is not enabled for adaptive performance"); } + enabled = EditorUtilities.CheckEnableThermalState(activeProfile); + if (!enabled) + { + Debug.Log("Adjust iOS FPS based on thermal state is enabled for adaptive performance"); + } + Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets(); // Always remember to clean up preloaded assets after build to make sure we don't diff --git a/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralSettingsPerBuildTargetEditor.cs b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralSettingsPerBuildTargetEditor.cs new file mode 100644 index 0000000000..c52966bc7d --- /dev/null +++ b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceGeneralSettingsPerBuildTargetEditor.cs @@ -0,0 +1,15 @@ +// Unity C# reference source +// Copyright (c) Unity Technologies. For terms of use, see +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License + +namespace UnityEditor.AdaptivePerformance.Editor +{ + [CustomEditor(typeof(AdaptivePerformanceGeneralSettingsPerBuildTarget))] + internal class AdaptivePerformanceGeneralSettingsPerBuildTargetEditor : UnityEditor.Editor + { + public override void OnInspectorGUI() + { + // Intentionally empty - settings are managed via Project Settings > Adaptive Performance + } + } +} diff --git a/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceSettingsManager.cs b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceSettingsManager.cs index d8b04379c4..ba4f71b360 100644 --- a/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceSettingsManager.cs +++ b/Modules/AdaptivePerformanceEditor/Management/AdaptivePerformanceSettingsManager.cs @@ -21,7 +21,7 @@ struct Content { public static readonly GUIContent k_InitializeOnStart = new GUIContent(L10n.Tr("Initialize Adaptive Performance on Startup")); public static readonly GUIContent k_DocText = new GUIContent(L10n.Tr("View documentation")); - public static readonly Uri k_DocUri = new Uri("https://docs.unity3d.com/Packages/com.unity.adaptiveperformance@latest"); + public static readonly Uri k_DocUri = new Uri("https://docs.unity3d.com/Manual/adaptive-performance/adaptive-performance.html"); public static readonly GUIContent k_ExplanatoryText = new GUIContent(L10n.Tr("Selecting an Adaptive Performance provider below enables that provider for the corresponding build target. Unity will download and install the provider package if it is not already present. Disabling a provider will not automatically uninstall packages that are already installed. To uninstall a provider package, use the Package Manager.")); public static readonly GUIContent k_FrameTimingExplanatoryText = new GUIContent(L10n.Tr("Please enable Frame Timing Stats in the Player Settings. Adaptive Performance requires precise frame time information.")); } @@ -63,6 +63,7 @@ static AdaptivePerformanceGeneralSettingsPerBuildTarget currentSettings if (!string.IsNullOrEmpty(assetPath)) { assetPath = Path.Combine(assetPath, "AdaptivePerformanceGeneralSettings.asset"); + generalSettings.hideFlags = HideFlags.HideInInspector; AssetDatabase.CreateAsset(generalSettings, assetPath); } } @@ -206,7 +207,7 @@ private void DisplayLoaderSelectionUI() if (loaderProp.objectReferenceValue == null) { var adaptivePerformanceManagerSettings = ScriptableObject.CreateInstance() as AdaptivePerformanceManagerSettings; - //adaptivePerformanceManagerSettings.hideFlags = HideFlags.HideInInspector; + adaptivePerformanceManagerSettings.hideFlags = HideFlags.HideInInspector; adaptivePerformanceManagerSettings.name = $"{buildTargetGroup.ToString()} Providers"; AssetDatabase.AddObjectToAsset(adaptivePerformanceManagerSettings, AssetDatabase.GetAssetOrScenePath(currentSettings)); loaderProp.objectReferenceValue = adaptivePerformanceManagerSettings; @@ -328,6 +329,7 @@ void DisplayEnableToggle() if (s_EnableAdaptivePerformance) { EditorUtilities.CheckEnableFrameTimingState(); + EditorUtilities.CheckEnableThermalState(); } EditorUtilities.EnableAPModule(s_EnableAdaptivePerformance); SettingsService.NotifySettingsProviderChanged(); diff --git a/Modules/AdaptivePerformanceEditor/Management/EditorUtilities.cs b/Modules/AdaptivePerformanceEditor/Management/EditorUtilities.cs index a695e36b12..94e6f0af67 100644 --- a/Modules/AdaptivePerformanceEditor/Management/EditorUtilities.cs +++ b/Modules/AdaptivePerformanceEditor/Management/EditorUtilities.cs @@ -124,7 +124,7 @@ internal static bool DiaglogForForFrameTiming(BuildProfile profile) { if (!Application.isBatchMode) { - bool Ok = EditorUtility.DisplayDialog(L10n.Tr("Enable Framing Timing Stats "), L10n.Tr("Adaptive Performance requires Frame Timing Stats to be enabled. Ok to enable"), + bool Ok = EditorUtility.DisplayDialog(L10n.Tr("Enable Framing Timing Stats "), L10n.Tr("Adaptive Performance requires Frame Timing Stats to be enabled. \"Ok\" to enable"), L10n.Tr("Ok"), L10n.Tr("Cancel")); if (Ok) @@ -142,12 +142,40 @@ internal static bool DiaglogForForFrameTiming(BuildProfile profile) } else { - Debug.Log("Frame timing manager is not enabled in batch mode"); + Debug.Log("Frame timing manager is not enabled for Adaptive Performance in batch mode"); } return false; } + internal static bool DiaglogForThermalStats(BuildProfile profile) + { + if (!Application.isBatchMode) + { + bool Ok = EditorUtility.DisplayDialog(L10n.Tr("Disable adjust IOS FPS Using Thermal State"), L10n.Tr("\"Adjust iOS FPS based on thermal state\" should be disabled in the Player Settings to ensure thermal mitigation works properly in the Adaptive Performance Apple Provider. Ok to disable"), + L10n.Tr("Ok"), L10n.Tr("Cancel")); + + if (Ok) + { + if (profile != null) + { + profile.playerSettings.SetAdjustIOSFPSUsingThermalState_Internal(false); + } + else + { + PlayerSettings.adjustIOSFPSUsingThermalState = false; + } + return false; + } + } + else + { + Debug.Log("Adjust IOS FPS Using Thermal State is not disabled for Adaptive Performance in batch mode"); + } + + return true; + } + internal static bool CheckEnableFrameTimingState(BuildProfile profile = null) { if (profile != null && profile.playerSettings != null) @@ -165,6 +193,23 @@ internal static bool CheckEnableFrameTimingState(BuildProfile profile = null) return true; } + internal static bool CheckEnableThermalState(BuildProfile profile = null) + { + if (profile != null && profile.playerSettings != null) + { + if (profile.playerSettings.GetAdjustIOSFPSUsingThermalState_Internal() == true) + { + return DiaglogForThermalStats(profile); + } + } + else if (PlayerSettings.adjustIOSFPSUsingThermalState == true) + { + return DiaglogForThermalStats(null); + } + + return false; + } + internal static void AddToPreloadedAssetList(UnityEngine.Object settings) { UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets(); diff --git a/Modules/AdaptivePerformanceEditor/Management/Metadata/AdaptivePerformanceKnownPackages.cs b/Modules/AdaptivePerformanceEditor/Management/Metadata/AdaptivePerformanceKnownPackages.cs index 483c273336..071984b3cf 100644 --- a/Modules/AdaptivePerformanceEditor/Management/Metadata/AdaptivePerformanceKnownPackages.cs +++ b/Modules/AdaptivePerformanceEditor/Management/Metadata/AdaptivePerformanceKnownPackages.cs @@ -114,6 +114,31 @@ static List InitKnownPackages() } } }); + + packages.Add(new KnownPackage() { + metadata = new KnownPackageMetadata(){ + packageName = "Adaptive Performance Apple", + packageId = "com.unity.adaptiveperformance.apple", + settingsType = "UnityEngine.AdaptivePerformance.Apple.AppleProviderSettings", + licenseURL = "https://docs.unity3d.com/Packages/com.unity.adaptiveperformance.apple@latest?subfolder=/license/LICENSE.html", + isDefaultPlatformProvider = "true", + isDeprecated = "false", + loaderMetadata = new List() + { + new KnownLoaderMetadata() { + loaderName = "Apple Provider", + loaderType = "UnityEngine.AdaptivePerformance.Apple.AppleProviderLoader", + supportedBuildTargets = new List() + { + BuildTargetGroup.iOS, + BuildTargetGroup.tvOS, + BuildTargetGroup.VisionOS + }, + priority = Int32.MaxValue, + }, + } + } + }); packages.Add(new KnownPackage() { @@ -141,7 +166,11 @@ static List InitKnownPackages() BuildTargetGroup.PS5, BuildTargetGroup.XboxOne, BuildTargetGroup.GameCoreXboxSeries, - BuildTargetGroup.GameCoreXboxOne + BuildTargetGroup.GameCoreXboxOne, + BuildTargetGroup.Switch, + BuildTargetGroup.Switch2, + BuildTargetGroup.QNX, + BuildTargetGroup.EmbeddedLinux }, priority = 5, }, diff --git a/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceProviderUI.cs b/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceProviderUI.cs index cf3caa0ea3..fabc454a82 100644 --- a/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceProviderUI.cs +++ b/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceProviderUI.cs @@ -461,6 +461,7 @@ void CreateAdaptivePerformanceProviderSettings(LoaderInformation loaderInfo) if (adaptivePerformanceProviderContainer == null) { adaptivePerformanceProviderContainer = ScriptableObject.CreateInstance(); + adaptivePerformanceProviderContainer.hideFlags = HideFlags.HideInHierarchy; m_BuildProfile.AddComponent(adaptivePerformanceProviderContainer); } @@ -515,6 +516,7 @@ void CreateAdaptivePerformanceManagerSettings() if (managerSetting == null) { managerSetting = ScriptableObject.CreateInstance(); + managerSetting.hideFlags = HideFlags.HideInHierarchy; var generalSettings = m_BuildProfile.GetComponent(); if (generalSettings != null) { diff --git a/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceToggle.cs b/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceToggle.cs index 52d962ede0..d6aff47632 100644 --- a/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceToggle.cs +++ b/Modules/AdaptivePerformanceEditor/UI/BuildProfileAdaptivePerformanceToggle.cs @@ -147,6 +147,7 @@ void UpdataProvider(ChangeEvent evt) public void InitializeSettingsAndUI() { EditorUtilities.CheckEnableFrameTimingState(m_BuildProfile); + EditorUtilities.CheckEnableThermalState(m_BuildProfile); AddAdaptivePerformanceGeneralSettingsObject(m_BuildProfile); m_AdaptivePerformanceProviderUI.CreateUI(); m_AdaptivePerformanceProviderUI.SelectDefaultProvider(); @@ -159,6 +160,7 @@ public static void AddAdaptivePerformanceGeneralSettingsObject(BuildProfile prof if (generalSetting == null) { generalSetting = ScriptableObject.CreateInstance(); + generalSetting.hideFlags = HideFlags.HideInInspector; profile.AddComponent(generalSetting); } } diff --git a/Modules/AndroidJNI/AndroidAssetPacks.bindings.cs b/Modules/AndroidJNI/AndroidAssetPacks.bindings.cs index c69e79f1bd..cb599a2294 100644 --- a/Modules/AndroidJNI/AndroidAssetPacks.bindings.cs +++ b/Modules/AndroidJNI/AndroidAssetPacks.bindings.cs @@ -96,6 +96,16 @@ internal AndroidAssetPackUseMobileDataRequestResult(bool allowed) public bool allowed { get; } } + public class AndroidAssetPackConfirmationDialogResult + { + internal AndroidAssetPackConfirmationDialogResult(bool consentGiven) + { + this.consentGiven = consentGiven; + } + + public bool consentGiven { get; } + } + public class DownloadAssetPackAsyncOperation : CustomYieldInstruction { Dictionary m_AssetPackInfos; @@ -322,6 +332,49 @@ internal void OnResult(AndroidAssetPackUseMobileDataRequestResult result) } } + public class ConfirmationDialogAsyncOperation : CustomYieldInstruction + { + AndroidAssetPackConfirmationDialogResult m_ConfirmationDialogResult; + readonly object m_OperationLock; + + public override bool keepWaiting + { + get + { + lock (m_OperationLock) + { + return m_ConfirmationDialogResult == null; + } + } + } + + public bool isDone => !keepWaiting; + + public AndroidAssetPackConfirmationDialogResult result + { + get + { + lock (m_OperationLock) + { + return m_ConfirmationDialogResult; + } + } + } + + internal ConfirmationDialogAsyncOperation() + { + m_OperationLock = new object(); + } + + internal void OnResult(AndroidAssetPackConfirmationDialogResult result) + { + lock (m_OperationLock) + { + m_ConfirmationDialogResult = result; + } + } + } + [NativeHeader("Modules/AndroidJNI/Public/AndroidAssetPacksBindingsHelpers.h")] [StaticAccessor("AndroidAssetPacksBindingsHelpers", StaticAccessorType.DoubleColon)] public static class AndroidAssetPacks @@ -340,8 +393,12 @@ public static void GetAssetPackStateAsync(string[] assetPackNames, Action callback) {} public static DownloadAssetPackAsyncOperation DownloadAssetPackAsync(string[] assetPackNames) { return null; } + [Obsolete("RequestToUseMobileDataAsync is deprecated. Use ShowConfirmationDialogAsync instead.", false)] public static void RequestToUseMobileDataAsync(Action callback) {} + [Obsolete("RequestToUseMobileDataAsync is deprecated. Use ShowConfirmationDialogAsync instead.", false)] public static RequestToUseMobileDataAsyncOperation RequestToUseMobileDataAsync() { return null; } + public static void ShowConfirmationDialogAsync(Action callback) {} + public static ConfirmationDialogAsyncOperation ShowConfirmationDialogAsync() { return null; } public static string GetAssetPackPath(string assetPackName) { return ""; } public static void CancelAssetPackDownload(string[] assetPackNames) {} public static void RemoveAssetPack(string assetPackName) {} diff --git a/Modules/AssetDatabase/Editor/V2/Managed/ArtifactInfo.deprecated.cs b/Modules/AssetDatabase/Editor/V2/Managed/ArtifactInfo.deprecated.cs index 1ea57b7462..a0f378aa65 100644 --- a/Modules/AssetDatabase/Editor/V2/Managed/ArtifactInfo.deprecated.cs +++ b/Modules/AssetDatabase/Editor/V2/Managed/ArtifactInfo.deprecated.cs @@ -8,7 +8,7 @@ namespace UnityEditor { internal partial class ArtifactInfo : IDisposable { - [Obsolete("artifactID is deprecated. Use importResultID instead (UnityUpgradeable) -> importResultID", true)] + [Obsolete("artifactID is deprecated. Use importResultID instead.", true)] internal string artifactID => m_ImportResultID; } } diff --git a/Modules/AssetDatabase/Editor/V2/Managed/ImportActivityWindow.cs b/Modules/AssetDatabase/Editor/V2/Managed/ImportActivityWindow.cs index ceaba894c0..d496f16c1b 100644 --- a/Modules/AssetDatabase/Editor/V2/Managed/ImportActivityWindow.cs +++ b/Modules/AssetDatabase/Editor/V2/Managed/ImportActivityWindow.cs @@ -145,7 +145,6 @@ internal struct ProjectOverviewContainer public (IMGUIContainer container, ArtifactBrowserTreeView treeView) importProcessAnalysis; } - [Serializable] internal struct ToolBarContainer { public (IMGUIContainer container, ArtifactBrowserToolbar toolbar) options; @@ -1848,7 +1847,7 @@ private static MultiColumnHeaderState.Column[] CreateColumns(params Column[] col { headerContent = EditorGUIUtility.TrTextContent(col.Name), headerTextAlignment = TextAlignment.Left, - sortingArrowAlignment = TextAlignment.Right, + sortingArrowAlignment = TextAlignment.Center, autoResize = false, width = col.Width, }; diff --git a/Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs b/Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs index feda48f5f4..f3db028823 100644 --- a/Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs +++ b/Modules/AssetPipelineEditor/ImportSettings/AssetImporterEditor.cs @@ -12,6 +12,7 @@ using UnityEngine.Scripting.APIUpdating; using UnityEngine.UIElements; using UnityEditor.UIElements; +using Unity.Collections; namespace UnityEditor.AssetImporters { @@ -561,7 +562,7 @@ public override void SaveChanges() } } - [Obsolete("UnityUpgradeable () -> SaveChanges")] + [Obsolete("Please use SaveChanges.")] protected internal void ApplyAndImport() { SaveChanges(); @@ -579,7 +580,7 @@ public override void DiscardChanges() serializedObject.Update(); } - [Obsolete("UnityUpgradeable () -> DiscardChanges")] + [Obsolete("Please use DiscardChanges.")] protected virtual void ResetValues() { DiscardChanges(); diff --git a/Modules/AssetPipelineEditor/ImportSettings/AssetImporterTabbedEditor.cs b/Modules/AssetPipelineEditor/ImportSettings/AssetImporterTabbedEditor.cs index 1a81bfe2e2..0f374e6005 100644 --- a/Modules/AssetPipelineEditor/ImportSettings/AssetImporterTabbedEditor.cs +++ b/Modules/AssetPipelineEditor/ImportSettings/AssetImporterTabbedEditor.cs @@ -50,7 +50,7 @@ void OnDestroy() } } - [Obsolete("UnityUpgradeable () -> DiscardChanges")] + [Obsolete("Please use DiscardChanges.")] protected override void ResetValues() { DiscardChanges(); diff --git a/Modules/AssetPipelineEditor/ImportSettings/AudioImporterInspector.cs b/Modules/AssetPipelineEditor/ImportSettings/AudioImporterInspector.cs index 19d3272118..b5af774fc4 100644 --- a/Modules/AssetPipelineEditor/ImportSettings/AudioImporterInspector.cs +++ b/Modules/AssetPipelineEditor/ImportSettings/AudioImporterInspector.cs @@ -34,6 +34,11 @@ static class Style public static GUIContent SharedSettingInformation = EditorGUIUtility.TrTextContent("* Shared setting between multiple platforms."); } +#pragma warning disable UAC1001 + // These fields are public and as such candidates for Serialization + // but SerializaProperty can't be serialized, consider making them private + // and add a property getter/setter or use NonSerialized attribute + // https://jira.unity3d.com/browse/UUM-132885 public SerializedProperty m_ForceToMono; public SerializedProperty m_Normalize; public SerializedProperty m_Ambisonic; @@ -41,6 +46,7 @@ static class Style public SerializedProperty m_OrigSize; public SerializedProperty m_CompSize; public SerializedProperty m_DefaultSampleSettings; +#pragma warning restore UAC1001 bool m_SelectionContainsTrackerFile; diff --git a/Modules/AssetPipelineEditor/ImportSettings/PluginImporterInspector.cs b/Modules/AssetPipelineEditor/ImportSettings/PluginImporterInspector.cs index 517542373e..50f1361300 100644 --- a/Modules/AssetPipelineEditor/ImportSettings/PluginImporterInspector.cs +++ b/Modules/AssetPipelineEditor/ImportSettings/PluginImporterInspector.cs @@ -11,10 +11,9 @@ using UnityEditorInternal; using UnityEditor.Modules; using UnityEditor.Build; -using UnityEditor.Callbacks; -using UnityEditor.Compilation; using UnityEditor.AssetImporters; using UnityEditor.Scripting.ScriptCompilation; +using Unity.Collections; namespace UnityEditor { @@ -174,9 +173,7 @@ private static int GetPlatformGroupArraySize() private static bool IsStandaloneTarget(BuildTarget buildTarget) { - #pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible. return BuildTargetDiscovery.StandaloneBuildTargets.Contains(buildTarget); -#pragma warning restore UA2001 } private Compatibility compatibleWithStandalone @@ -314,7 +311,7 @@ private void ResetCompatability(ref Compatibility value, Func DiscardChanges")] + [Obsolete("Please use DiscardChanges.")] protected override void ResetValues() { DiscardChanges(); diff --git a/Modules/Audio/Public/SampleProvider/ScriptBindings/SampleProvider.bindings.cs b/Modules/Audio/Public/SampleProvider/ScriptBindings/SampleProvider.bindings.cs new file mode 100644 index 0000000000..0e790c6a25 --- /dev/null +++ b/Modules/Audio/Public/SampleProvider/ScriptBindings/SampleProvider.bindings.cs @@ -0,0 +1,18 @@ +// 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 Unity.Collections.LowLevel.Unsafe; +using UnityEngine.Bindings; +using UnityEngine.Scripting; + +namespace UnityEngine.Audio +{ + [NativeHeader("Modules/Audio/Public/SampleProvider/ScriptBindings/SampleProvider.bindings.h")] + static class SampleProviderBindings + { + [NativeMethod(Name = "audio::CreateSampleProviderGeneratorHeader", IsFreeFunction = true, ThrowsException = true)] + internal static extern unsafe void* CreateGeneratorHeader(AudioClip audioClip, void* resourceHeader, AudioConfiguration* nestedConfiguration); + } +} diff --git a/Modules/Audio/Public/ScriptBindings/Audio.bindings.cs b/Modules/Audio/Public/ScriptBindings/Audio.bindings.cs index 7774a14f0e..16ccaade0f 100644 --- a/Modules/Audio/Public/ScriptBindings/Audio.bindings.cs +++ b/Modules/Audio/Public/ScriptBindings/Audio.bindings.cs @@ -105,6 +105,9 @@ public static int ChannelCount(this AudioSpeakerMode speakerMode) throw new ArgumentException($"{nameof(speakerMode)}"); } + + [NativeMethod(Name = "AudioSpeakerModeBindings::InternaIAudioSpeakerModeIsCapped", IsFreeFunction = true)] + internal static extern bool InternalAudioSpeakerModeIsCapped(AudioSpeakerMode speakerMode); } public enum AudioDataLoadState @@ -528,6 +531,7 @@ private AudioClip() {} extern private string GetName(); extern private void CreateUserSound(string name, int lengthSamples, int channels, int frequency, bool stream); + extern private bool IsLegacyFormat(); // The length of the audio clip in seconds (read-only) [NativeProperty("LengthSec")] @@ -706,13 +710,58 @@ private void InvokePCMSetPositionCallback_Internal(int position) #region Generator.IAudioGenerator - bool GeneratorInstance.ICapabilities.isRealtime => throw new NotImplementedException(); - bool GeneratorInstance.ICapabilities.isFinite => throw new NotImplementedException(); - DiscreteTime? GeneratorInstance.ICapabilities.length => throw new NotImplementedException(); + void CheckIsNotPersistent() + { + if (IsLegacyFormat()) + throw new NotSupportedException($"AudioClip {name} is not a valid {nameof(IAudioGenerator)}. Only persistent {nameof(AudioClip)} can be used, not runtime created ones."); + } - GeneratorInstance IAudioGenerator.CreateInstance(ControlContext context, AudioFormat? nestedFormat, ProcessorInstance.CreationParameters parameters) + bool GeneratorInstance.ICapabilities.isRealtime { - throw new NotImplementedException(); + get + { + CheckIsNotPersistent(); + return false; + } + } + + bool GeneratorInstance.ICapabilities.isFinite + { + get + { + CheckIsNotPersistent(); + return true; + } + } + + DiscreteTime? GeneratorInstance.ICapabilities.length + { + get + { + CheckIsNotPersistent(); + return DiscreteTime.FromTicks(GeneratorInstance.Configuration.FramesAndSampleRateToDiscreteTimeTicks(samples, (uint)frequency)); + } + } + + public GeneratorInstance CreateInstance(ControlContext context, AudioFormat? nestedFormat, ProcessorInstance.CreationParameters creationParameters) + { + CheckIsNotPersistent(); + + unsafe + { + AudioConfiguration* configPtr = null; + + if (nestedFormat.HasValue) + { + var config = nestedFormat.Value.audioConfiguration; + configPtr = &config; + } + + var header = (GeneratorInstance.GeneratorHeader*) + SampleProviderBindings.CreateGeneratorHeader(this, context.Header, configPtr); + + return new GeneratorInstance(header); + } } #endregion diff --git a/Modules/Audio/Public/ScriptableProcessors/ScriptBindings/ScriptableGenerator.bindings.cs b/Modules/Audio/Public/ScriptableProcessors/ScriptBindings/ScriptableGenerator.bindings.cs index bd72a75ff9..a24a3fd6ee 100644 --- a/Modules/Audio/Public/ScriptableProcessors/ScriptBindings/ScriptableGenerator.bindings.cs +++ b/Modules/Audio/Public/ScriptableProcessors/ScriptBindings/ScriptableGenerator.bindings.cs @@ -262,6 +262,24 @@ public struct Configuration /// /// public DiscreteTime? length => HasKnownLength ? ReportedLength : null; + + static internal Int64 FramesAndSampleRateToDiscreteTimeTicks(Int64 lengthFrames, UInt32 sampleRate) + { + switch (sampleRate) + { + case 8000: return lengthFrames * DiscreteTime.Tick8Khz; + case 16000: return lengthFrames * DiscreteTime.Tick16Khz; + case 22050: return lengthFrames * DiscreteTime.Tick22Khz; + case 44100: return lengthFrames * DiscreteTime.Tick44Khz; + case 48000: return lengthFrames * DiscreteTime.Tick48Khz; + case 88200: return lengthFrames * DiscreteTime.Tick88Khz; + case 96000: return lengthFrames * DiscreteTime.Tick96Khz; + case 192000: return lengthFrames * DiscreteTime.Tick192Khz; + default: + // For non-standard sample rates, we can still calculate the ticks by using the ratio of ticks per second to the sample rate. + return (lengthFrames * DiscreteTime.TicksPerSecond) / sampleRate; + } + } } /// diff --git a/Modules/BuildProfileEditor/BuildProfileWindow.cs b/Modules/BuildProfileEditor/BuildProfileWindow.cs index 79297cb313..1afe75f3d5 100644 --- a/Modules/BuildProfileEditor/BuildProfileWindow.cs +++ b/Modules/BuildProfileEditor/BuildProfileWindow.cs @@ -19,6 +19,7 @@ namespace UnityEditor.Build.Profile /// Build Settings window in 'File > Build Settings'. /// Handles creating and editing of assets. /// + [EditorWindowTitle(title = "Build Profiles", icon = "BuildProfileWindow")] internal class BuildProfileWindow : EditorWindow { const string k_DevOpsUrl = "https://unity.com/products/unity-devops?utm_medium=desktop-app&utm_source=unity-editor-window-menu&utm_content=buildsettings"; @@ -69,14 +70,14 @@ internal class BuildProfileWindow : EditorWindow [UsedImplicitly, RequiredByNativeCode] public static void ShowBuildProfileWindow() { - var window = GetWindow(TrText.buildProfilesName); + var window = GetWindow(); window.minSize = new Vector2(725, 400); } [UsedImplicitly, RequiredByNativeCode] public static void ShowBuildProfileWindowAndRequireActiveProfile() { - var window = GetWindow(TrText.buildProfilesName); + var window = GetWindow(); window.minSize = new Vector2(725, 400); // Activate the first buildable profile if none is active. diff --git a/Modules/BuildProfileEditor/Elements/BuildProfileCard.cs b/Modules/BuildProfileEditor/Elements/BuildProfileCard.cs index 2ec33abef0..ec75ecae38 100644 --- a/Modules/BuildProfileEditor/Elements/BuildProfileCard.cs +++ b/Modules/BuildProfileEditor/Elements/BuildProfileCard.cs @@ -21,8 +21,24 @@ internal struct BuildProfileCard /// public GUID platformId { get; set; } + /// + /// Description of a platform. + /// public string description { get; set; } + /// + /// Key features of a platform. + /// + public string keyFeatures { get; set; } + + /// + /// Resources and links related to a platform. + /// + public string resources { get; set; } + + /// + /// Hex string for the background color of the platform banner. + /// public string platformBannerBgColorHex { get; set; } /// @@ -35,6 +51,9 @@ internal struct BuildProfileCard /// public PlatformPackageList partnerPackages { get; set; } + /// + /// Preconfigured settings variants for a platform. + /// public PreconfiguredSettingsVariant[] preconfiguredSettingsVariants { get; set; } public BuildProfileCard() @@ -45,6 +64,8 @@ public BuildProfileCard() partnerPackages = new PlatformPackageList(); preconfiguredSettingsVariants = Array.Empty(); description = string.Empty; + keyFeatures = string.Empty; + resources = string.Empty; platformBannerBgColorHex = "#00000000"; } } diff --git a/Modules/BuildProfileEditor/PlatformDiscoveryWindow.cs b/Modules/BuildProfileEditor/PlatformDiscoveryWindow.cs index fba837793e..72575f187b 100644 --- a/Modules/BuildProfileEditor/PlatformDiscoveryWindow.cs +++ b/Modules/BuildProfileEditor/PlatformDiscoveryWindow.cs @@ -50,6 +50,10 @@ internal class PlatformDiscoveryWindow : EditorWindow Button m_PackageSelectAll; Button m_PackageDeselectAll; + VisualElement m_KeyFeaturesContainer; + Label m_KeyFeaturesContentLabel; + VisualElement m_ResourcesContainer; + Label m_ResourcesContentLabel; VisualElement m_PlatformConfigs; VisualElement m_NameLinks; @@ -147,6 +151,8 @@ static BuildProfileCard[] FindAllVisiblePlatforms(GUID[] platforms) displayName = BuildProfileModuleUtil.GetClassicPlatformDisplayName(platformId), platformId = platformId, description = BuildProfileModuleUtil.BuildPlatformDescription(platformId), + keyFeatures = BuildProfileModuleUtil.BuildPlatformKeyFeatures(platformId), + resources = BuildProfileModuleUtil.BuildPlatformResources(platformId), platformBannerBgColorHex = BuildProfileModuleUtil.GetPlatformColorString(platformId), internalPackages = internalPackages, partnerPackages = partnerPackages, @@ -199,6 +205,16 @@ public void CreateGUI() m_BuildProfileNameLabel = rootVisualElement.Q