From b27cd76eb57cdfd84cedb244084d0a9eb48d7232 Mon Sep 17 00:00:00 2001 From: JoC0de <53140583+JoC0de@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:47:28 +0100 Subject: [PATCH] move the 'NuGet For Unity' settings to the Project settings window instead of User settings --- src/NuGetForUnity/Editor/Ui/NugetPreferences.cs | 7 ++++++- src/NuGetForUnity/Editor/Ui/NugetWindow.cs | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs b/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs index 0b143fd4..d3f0846c 100644 --- a/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs +++ b/src/NuGetForUnity/Editor/Ui/NugetPreferences.cs @@ -37,6 +37,11 @@ public class NugetPreferences : SettingsProvider /// public const string NuGetForUnityVersion = "4.2.0"; + /// + /// The location where the settings are placed in the menu of the Unity Editor. + /// + public const string MenuItemLocation = "Project/NuGet For Unity"; + private const float LabelPading = 5; private readonly GUIContent deleteX = new GUIContent("\u2716"); @@ -75,7 +80,7 @@ public class NugetPreferences : SettingsProvider /// Path of packages.config file is checked here as well in case it was manually changed. /// private NugetPreferences() - : base("Preferences/NuGet For Unity", SettingsScope.User) + : base(MenuItemLocation, SettingsScope.Project, new[] { "NuGet", "Packages" }) { shouldShowPackagesConfigPathWarning = ConfigurationManager.NugetConfigFile.InstallLocation == PackageInstallLocation.CustomWithinAssets && !UnityPathHelper.IsPathInAssets(ConfigurationManager.NugetConfigFile.PackagesConfigDirectoryPath); diff --git a/src/NuGetForUnity/Editor/Ui/NugetWindow.cs b/src/NuGetForUnity/Editor/Ui/NugetWindow.cs index b277a1c4..5c63034a 100644 --- a/src/NuGetForUnity/Editor/Ui/NugetWindow.cs +++ b/src/NuGetForUnity/Editor/Ui/NugetWindow.cs @@ -320,7 +320,7 @@ protected static void RestorePackages() [MenuItem("NuGet/Preferences", false, 9)] protected static void DisplayPreferences() { - SettingsService.OpenUserPreferences("Preferences/NuGet For Unity"); + SettingsService.OpenProjectSettings(NugetPreferences.MenuItemLocation); } /// @@ -932,7 +932,7 @@ private void DrawMandatoryButtons() if (GUILayout.Button("Preferences", EditorStyles.toolbarButton, GUILayout.Width(80))) { - SettingsService.OpenUserPreferences("Preferences/NuGet For Unity"); + DisplayPreferences(); GetWindow().Close(); } }