Skip to content

Commit

Permalink
move the 'NuGet For Unity' settings to the Project settings (#686)
Browse files Browse the repository at this point in the history
move the 'NuGet For Unity' settings to the Project settings window instead of User settings
  • Loading branch information
JoC0de authored Dec 28, 2024
1 parent 16d624d commit b0256f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/NuGetForUnity/Editor/Ui/NugetPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class NugetPreferences : SettingsProvider
/// </summary>
public const string NuGetForUnityVersion = "4.2.0";

/// <summary>
/// The location where the settings are placed in the menu of the Unity Editor.
/// </summary>
public const string MenuItemLocation = "Project/NuGet For Unity";

private const float LabelPading = 5;

private readonly GUIContent deleteX = new GUIContent("\u2716");
Expand Down Expand Up @@ -75,7 +80,7 @@ public class NugetPreferences : SettingsProvider
/// Path of packages.config file is checked here as well in case it was manually changed.
/// </summary>
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);
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetForUnity/Editor/Ui/NugetWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand Down Expand Up @@ -932,7 +932,7 @@ private void DrawMandatoryButtons()

if (GUILayout.Button("Preferences", EditorStyles.toolbarButton, GUILayout.Width(80)))
{
SettingsService.OpenUserPreferences("Preferences/NuGet For Unity");
DisplayPreferences();
GetWindow<NugetWindow>().Close();
}
}
Expand Down

0 comments on commit b0256f7

Please sign in to comment.