NuGet Integrator
Integrate NuGet dependencies directly into Unity projects without complex workarounds. NuGet Integrator uses a lightweight .csproj file to manage your NuGet packages and automatically copies resolved DLLs into your Assets folder. Requires .NET Core SDK 2.1 or later.
com.bassarisse.nuget-integrator 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/nuget-integrator.git README Markdown
Copy this to your project's README.md
## Installation
Add **NuGet Integrator** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/nuget-integrator.git
```
[](https://www.pkglnk.dev/pkg/nuget-integrator)README
NuGet Integrator for Unity
A lightweight way of referencing NuGet dependencies in Unity projects. Basic idea borrowed from toitnups.
Basically, we keep an integration.csproj (targeting netstandard2.0) inside the Unity project, add the needed dependencies to it and, when it is published, the DLL's are copied to the Assets folder.
Requirements
Installation options
- Via OpenUPM (recommended):
openupm add com.bassarisse.nuget-integrator
- Via git reference (how-to)
Basic usage
- After installing, run the menu item
NuGet > Create Integration Projectso you can add your dependencies to it. - To add a new dependency, run via command-line, from the project root:
dotnet add NuGetIntegration/integration.csproj package [package-id]
- Every time a new NuGet dependency is added, you should run the menu item
NuGet > Restore Dependencies. That's it!
Extra configuration
- Update versioning settings
- The folder where the dependencies are placed (Assets/NuGetPackages) should be ignored from versioning.
- Normally *.csproj files are already ignored in Unity projects, so you need to make an exception for the integration file.
.gitignoreexample:
# NuGet integration proj
!**/NuGetIntegration/integration.csproj
# NuGet packages in Unity
**/[Aa]ssets/NuGetPackages/*
**/[Aa]ssets/NuGetPackages.meta
Caveats & CI/CD considerations
- Since Unity knows nothing about the integration, before opening (or building) your project you should restore the NuGet dependencies "manually" by running:
dotnet publish NuGetIntegration/integration.csproj -c Release
- On macOS, I could not run the
dotnetcommand via Unity, so the executable location is hard-coded, considering the default installation path.
To-do
- Detect changes & restore the packages when needed, automatically
- UI for adding & searching for dependencies via Unity
- UI to add custom package sources
No comments yet. Be the first!