NuGet packages in Unity

krumbi picture krumbi · Nov 23, 2018 · Viewed 47.1k times · Source

I want to use some NuGet packages inside Unity. I achieved that Unity finds the downloaded DLLs according to this article (https://www.what-could-possibly-go-wrong.com/unity-and-nuget/). The nuget.config file can be configured to download the packages into the Plugins folder inside the Assets folder. The Problem is that NuGet downloads multiple versions of each DLL (eg net46, netcore50, netstandard21, so forth) and Unity doesn't like multiple DLLs with the same name. I know I could simply put the DLL inside the Plugins folder by hand, but unfortunately that is not a solution which would please me.

Do you have any idea how I could work around this problem? Is it possible to configure NuGet to just download one DLL for each dependency?

Answer

FearlessHyena picture FearlessHyena · Aug 4, 2019

Just thought I'd add this in case it helps anyone

I used the Nuget for Unity asset (free) to import a package (websocketsharp) and it was really easy and painless. The references in VS worked immediately as well

The package you're trying to import naturally has to be compatible with Unity but that's the same even if you import it manually. So I'd recommend giving this a try