The surefire and easy way to get NuGet packages into your Unity projects!
This tiny command line tool lets you use a "dummy" .NET Standard 2.0 library to pull the required NuGet libraries and their dependencies together, and move them over to your Unity project. Featuring...
- automatic link.xml generation for IL2CPP builds!
- use Visual Studio to manage NuGet packages!
- no need to add any additional files into your Unity project!
You must have .NET Core 2.1 SDK or higher installed.
dotnet ... commands.
Use the pre-built
You can quickly install and try toitnups from nuget.org using the following commands:
dotnet tool install -g toitnups [navigate to your Unity project directory] toitnups init toitnups add sample Plugins\Sample [add your nuget packages] toitnups push
Note: You may need to open a new command/terminal window the first time you install the tool.
How does it work?
init makes sure everything is in the right place
This wouldn't be strictly necessary, but I think it's best to validate the project version and folder structure. If everything is in order the
.tn folder is created.
add adds a "dummy" project and some congfiguration
The dotnet toolchain runs to create a .NET Standard 2.0 project and a config file is created that stores the location of the plugins inside the
3️⃣ you open the
integration.NAME.csproj file that was just created
... and add the needed NuGet references via Visual Studio as you normally would.
push migrates the required files to the Unity project
The dotnet toolchain runs again, publishing the project in release mode. This copies all the necessary files to one folder. Then these files are gathered, copied over to the target folder, and the
link.xml file is created/updated, ensuring that none of the code is removed by the sometimes too eager IL2CPP backend.
push a specific integration or all of them
If you specify an integration name after
toitnups push sample it'll only update that integration. If the name is omitted then all the integrations are updated.
There's also a
It removes an integration, essentially the opposite of
Why not use the NuGet package manager from the Asset Store or other method XYZ?
There are multiple factors here.
- The asset store NuGet package manager is separately maintained/implemented, therefore it's always going to lag behind any official implementation and have more bugs/issues.
- I strongly believe that Unity's way to extend the editor is wrong. I shouldn't have to add assets/packages to my project to extend the editor.
- This tool automates the hurdles with
Tool fOr unITy NUget PackageS