繁体   English   中英

如何在 Unity 5 中使用 .NET 框架 4.5

[英]How can I use .NET framework 4.5 in Unity 5

我正在使用unity3D 5 我想导入外部我的KinectDB.dll (包括我的 sql server db 函数和 entityframework。它符合.NET 4.5 框架)类库统一。 但是统一控制台给了我如下错误。 我搜索了这个问题很多小时。 但我无法达到完整的解决方案。 我该如何解决这个问题? 你有什么建议? 提前致谢。

提示:我用.NET 3.5 框架创建了一个示例项目。 我将它导入到 unity 中。 在这种情况下,Unity 不会给我一个错误。

  Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

Missing method .ctor in assembly -------\Assets\KinectDB.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
The class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in KinectDB
Can't find custom attr constructor image: Assets\KinectDB.dll mtoken: 0x0a00000e

您只能等到 Unity 将其捆绑的 Mono 更新为 4.x。 这已经在他们的路线图上。 随着 Microsoft 将 Mono 运行时从 LGPL 许可给 MIT,并且 Unity 加入 .NET Foundation,这样的平台升级可能会更快到来。

http://unity3d.com/unity/roadmap

是的。 这一切都始于阅读文档 - 并意识到 Unity 使用了一个相当过时的 .NET 版本。 您不能在 Unity 中使用 4.5 库。 您可以做的是在单独的程序中运行它们并通过网络等与该程序通信 - 但这是很多工作。

将来Unity会升级。 但他们还没有。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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