如何为NuGet软件包添加Unity支持? [英] How do I add Unity support to a NuGet package?

查看:610
本文介绍了如何为NuGet软件包添加Unity支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将软件包发布到支持Unity(游戏引擎)的NuGet?

How do I publish a package to NuGet that supports Unity (the game engine)?

此外,我是否需要安装Unity才能对其进行编译,或者是否已针对特定的框架版本进行了调试?

Also, do I need to have Unity installed to compile it, or is targeting a specific framework version enough?

推荐答案

如何将软件包发布到支持Unity(游戏引擎)的NuGet?

How do I publish a package to NuGet that supports Unity (the game engine)?

只需按照文档中的说明进行操作. Unity3D的类库与常规.NET类库没有什么不同.它只是使用了来自 Unity3D的Mono分支的另一种运行时.

Just follow the instructions in the doc. Class library for Unity3D is nothing different from regular .NET Class library. It just uses a different runtime comes from Unity3D's fork of mono.

此外,我是否需要安装Unity才能对其进行编译,或者是否已针对特定的框架版本进行了调试?

Also, do I need to have Unity installed to compile it, or is targeting a specific framework version enough?

是的.如果您的库使用Unity3D类型,则项目需要引用Unity3D中的程序集,例如UnityEngine.dllUnityEditor.dll.如果您的库不使用Unity3D类型,则仍然需要使用Unity3D对其进行测试.因为较早的Unity3D面向.NET 2.0和.NET 3.5的子集.因此,如果您的库使用仅在.NET 4+中可用的功能,则它不适用于Unity3D.另请参见使用dll .

Yes. If your library uses Unity3D types, the project needs to reference assemblies, such as UnityEngine.dll and UnityEditor.dll, from Unity3D. If your library doesn't use Unity3D types, you still need to test it with Unity3D. Because older Unity3D targets .NET 2.0 and a subset of .NET 3.5. So if your library uses features only available in .NET 4+, it won't work with Unity3D. See also Using dll.

最好安装用于VS2015的Unity3D的Visual Studio工具( VS2017,

It's better to install Visual Studio Tools for Unity3D for VS2015 (for VS2017, install VSTU in the VS installer instead) and then you can target one of the Unity3D targets:

关于软件包的发布,我认为您最好在Unity3D上发布软件包资产商店,因为它得到了官方支持.将包发布到资产时,您可能要尝试 Unity3D资产存储工具的改进版本商店.

As for the publishment of your package, I think you'd better publish your package on Unity3D asset store since it is officially supported. You may want to try this improved version of Unity3D asset store tools when publishing your package to the asset store.

这篇关于如何为NuGet软件包添加Unity支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆