$ show GlitchEnzo/NuGetForUnity
NuGetForUnity is a NuGet client built specifically for the Unity Editor, enabling package management directly within Unity projects. It provides an interactive editor window for browsing, installing, updating, and uninstalling NuGet packages, as well as a headless CLI tool for CI/CD pipelines. The system integrates with Unity's asset pipeline to configure imported DLLs (analyzers, native runtimes, player-only assemblies) and supports both NuGet V2 (OData) and V3 (JSON) API protocols. It also offers a plugin API for third-party extensibility through custom buttons, file handlers, and uninstall hooks. The architecture is modular, with clear separation between configuration, models, package sources, UI, and plugin support, all within the Unity Editor's asmdef framework.
The LLM identified 3 files worth highlighting for reuse:
A collection of stub/fake classes (e.g., Debug, Application, AssetDatabase, EditorUtility) that mimic Unity's static APIs, allowing the CLI tool to run NuGet operations outside the Unity Editor. This pattern is highly reusable for any project that needs to test or run Unity-dependent code without a full Unity installation.
A well-implemented SemVer2 struct with parsing, comparison operators, range matching (e.g., [1.0,2.0]), and pre-release support. It encapsulates version logic cleanly and can be extracted as a standalone versioning library for any .NET project.
A set of interfaces (INugetPlugin, IPackageButtonsHandler, IPackageInstallFileHandler, IPackageUninstallHandler, IFoundInstalledPackageHandler) defining a clean plugin registry pattern. Third-party assemblies can register handlers to extend NuGetForUnity's behavior without modifying core code. This pattern is a textbook example of the strategy pattern for extensible applications.