NuGet packages in Unity

前端 未结 5 918
粉色の甜心
粉色の甜心 2020-12-31 06:21

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

相关标签:
5条回答
  • 2020-12-31 06:38

    There is NuGet2Unity that allows to convert any Nuget package to a '.unitypackage'. I've used it to convert "SpecFlow" and i was able to import the resulting Unity Package. Check out their Examples.

    It worked for me with:

    dotnet.exe run -n specflow --version 3.0.225

    Note that you might need to skip dependecies that are deliverd by the NugetPackage which are already deliverd by unity itself.

    0 讨论(0)
  • 2020-12-31 06:54

    You really don't wanna go down the path of configuring Unity to work with Nuget automatically. That article is rather old. With Unity 2018, you get a .net standard 2.0 compatibility level, which should be perfect for Nuget packages. Simply download the package using a separate VS project (as mentioned in the article), then take the netstandard20 version of the DLL and place it in your Unity project.

    0 讨论(0)
  • 2020-12-31 07:01

    Here are the details,

    1. go to your desired NuGet package webpage.
    2. on the right side **Download Package** option click it.
    3. your package **.nupkg** file will be downloaded.
    4. change its extension to .zip and extract it
    5. go to lib and copy your package dll file from net or any netstandard folder. For [your unity project compatibility purposes][2] view this:
    

        6. open unity workspace and create plugin folder 
        7. paste your dll file here.
    

    Here is the video guide, i have imported newtonsoft.json pacakge in unity

    0 讨论(0)
  • 2020-12-31 07:02

    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

    0 讨论(0)
  • 2020-12-31 07:02

    You have to set up the downloaded nuget /is in packages folder/ plugins manually. Nuget doesn't know which plugin can use unity and how. You can set their parameters in inspector: editor, standalone ... x86,x64 ...

    0 讨论(0)
提交回复
热议问题