Skip to content

Tool for Unity NuGet packages - Tool fOr unITy NUget PackageS

License

Notifications You must be signed in to change notification settings

tomzorz/toitnups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toitnups

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!

platform-any nuget-yes license-MIT

You must have .NET Core 2.1 SDK or higher installed.

⚠ 👉 Yes, the SDK, not just the runtime, as toitnups relies on the dotnet ... commands.

Use the pre-built toitnups

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?

1️⃣ 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.

2️⃣ 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 Assets folder.

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.

4️⃣ 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.

Anything else?

You can push a specific integration or all of them

If you specify an integration name after push, e.g. toitnups push sample it'll only update that integration. If the name is omitted then all the integrations are updated.

There's also a remove command

It removes an integration, essentially the opposite of add.

⚠ 👉 Important to note, that this does not remove any files from the Unity project.

Why not use the NuGet package manager from the Asset Store or other method XYZ?

There are multiple factors here.

  1. 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.
  2. 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.
  3. This tool automates the hurdles with link.xml.

Why toitnups?

Tool fOr unITy NUget PackageS

Future features

See issues tagged with enhancements.