[英]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 的游戏项目中通过 Nuget 安装了一些 ASP.NET 包(如果重要,则为
FirebaseStorage.net
)。
Visual Studio itself shows no errors, as it probably understands using Firebase.Storage
internally, but when it comes to Unity, it says Visual Studio 本身没有显示任何错误,因为它可能理解在内部
using Firebase.Storage
,但是当涉及到 Unity 时,它说
The type or namespace name 'Firebase' could not be found (are you missing a using directive or an assembly reference?)
找不到类型或命名空间名称“Firebase”(您是否缺少 using 指令或程序集引用?)
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.我相信这是因为我在 Visual Studio 中通过 Nuget Package 管理器安装了这个 package,它可能与 Unity 无关,所以 Unity 找不到它。
How can I make Unity understand packages from Nuget?如何让 Unity 理解来自 Nuget 的包?
If you want to use a Nuget package in Unity you have to add it manually.如果你想在 Unity 中使用 Nuget package,你必须手动添加它。
How you can do this:如何做到这一点:
create a separate temporary Visual Studio project创建一个单独的临时 Visual Studio 项目
install the Nuget package安装 Nuget package
copy the dll's from the temporary project to a "plugins" folder in the Assets folder of Unity.将临时项目中的 dll 复制到 Unity 的 Assets 文件夹中的“plugins”文件夹中。
Unity now builds the project with the dll's of the Nuget package Unity 现在使用 Nuget package 的 dll 构建项目
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.然而,现在遇到了必须手动完成的困难部分:如果 dll 依赖于其他 dll,这些也必须手动添加。 That is the big advantage of Nuget package manager.
这就是 Nuget package 管理器的一大优势。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.