简体   繁体   English

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

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

I'm working with unity3D 5 .我正在使用unity3D 5 And I wanna import external my KinectDB.dll (includes my sql server db functions with entityframework. And it was complied with .NET 4.5 framework ) class library to unity.我想导入外部我的KinectDB.dll (包括我的 sql server db 函数和 entityframework。它符合.NET 4.5 框架)类库统一。 But unity console gives me an error like below.但是统一控制台给了我如下错误。 I searched for this problem many hours.我搜索了这个问题很多小时。 But I can't reach to complete solution.但我无法达到完整的解决方案。 How can I solve this?我该如何解决这个问题? What are your advices?你有什么建议? Thanks in advance.提前致谢。

Hint : I created an example project with .NET 3.5 framework .提示:我用.NET 3.5 框架创建了一个示例项目。 And I import it to unity.我将它导入到 unity 中。 Unity doesnt give me an error in this case.在这种情况下,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

You can only wait till Unity updates its bundled Mono to 4.x.您只能等到 Unity 将其捆绑的 Mono 更新为 4.x。 It is already on their roadmap.这已经在他们的路线图上。 With Microsoft licenses Mono runtime from LGPL to MIT and Unity joined .NET Foundation, it is likely that such a platform upgrade might come sooner.随着 Microsoft 将 Mono 运行时从 LGPL 许可给 MIT,并且 Unity 加入 .NET Foundation,这样的平台升级可能会更快到来。

http://unity3d.com/unity/roadmap http://unity3d.com/unity/roadmap

Yeah.是的。 It all starts with reading the documentation - and realizing that Unity uses a quite outdated version of .NET.这一切都始于阅读文档 - 并意识到 Unity 使用了一个相当过时的 .NET 版本。 You CAN NOT use 4.5 libraries in Unity.您不能在 Unity 中使用 4.5 库。 What you CAN do is run them in a separate program and communicate with this program via network etc. - but that is a LOT of work.您可以做的是在单独的程序中运行它们并通过网络等与该程序通信 - 但这是很多工作。

Once in the future Unity will upgrade.将来Unity会升级。 But they have not yet.但他们还没有。

暂无
暂无

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

相关问题 Unity3D - 我可以使用.NET 4.5程序集作为外部库吗? - Unity3D - can I use .NET 4.5 assembly as external library? 我可以在 AWS Lambda 上使用 .Net Framework 4.5 部署 RESTful API 吗? - Can I deploy a RESTful API with .Net Framework 4.5 on AWS Lambda? NET Framework 4.5中如何使用System.Configuration.DpapiProtectedConfigurationProvider版本2? - How to use System.Configuration.DpapiProtectedConfigurationProvider version 2 in .net framework 4.5? 如何使用.Net Framework 3.5或4.5取决于哪些可用 - How to use .Net Framework 3.5 or 4.5 depending on which ever is available 我可以在.NET 4.5中使用Windows Identity Foundation 3.5吗? - Can I use Windows Identity Foundation 3.5 with .NET 4.5? 我如何在 .Net 4.5 中的两个不同解决方案中使用相同的变量会话? - How I can use the same variable Session in two different Solution in .Net 4.5? 如何对.Net 4.5上的任务使用自定义TaskAwaiter? - How do I use a custom TaskAwaiter for tasks on .Net 4.5? 如何在.NET 4.5中“同时”运行这两种方法? - How can I run both of these methods 'at the same time' in .NET 4.5? Eazfuscator.NET 3.3不支持.NET 4.5,但我仍然可以模糊我的.NET 4.5目标框架项目。 我不明白的是什么? - Eazfuscator.NET 3.3 does not support .NET 4.5, but I can still obfuscate my project that has .NET 4.5 target framework. What am I not understanding? 如何在 .NET Framework 4.8 中使用 TimeOnly 和 DateOnly - How can I use TimeOnly and DateOnly in .NET Framework 4.8
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM