简体   繁体   中英

Unity can't find package installed with Nuget in Visual Studio

I installed some ASP.NET packages ( FirebaseStorage.net if it matters) via Nuget in my game's project in Visual Studio.

Visual Studio itself shows no errors, as it probably understands using Firebase.Storage internally, but when it comes to Unity, it says

The type or namespace name 'Firebase' could not be found (are you missing a using directive or an assembly reference?)

I believe this happens because I installed this package through the Nuget Package Manager, inside Visual Studio, and it probably has nothing to do with Unity, so Unity doesn't find it.

How can I make Unity understand packages from Nuget?

If you want to use a Nuget package in Unity you have to add it manually.

How you can do this:

  • create a separate temporary Visual Studio project

  • install the Nuget package

  • copy the dll's from the temporary project to a "plugins" folder in the Assets folder of Unity.

  • Unity now builds the project with the dll's of the Nuget package

  • However, now comes the hard part of having to do it manually: if the dll has dependencies on other dll's, these will also have to be added manually. That is the big advantage of Nuget package manager.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM