问题描述
我想使用在 .NET Framework v4.5 中实现的一组功能.因为 Unity3D 在 Mono 运行时(相当于 .NET 3.5)上工作,我认为使用 .NET4.5 程序集作为外部插件.
I want to use set of features, implemented in .NET Framework v4.5. Cause Unity3D works on Mono runtime(equivalent to .NET 3.5), i think to use .NET4.5 assemblies as external plugin.
有可能吗?如果可能,该库将使用哪个运行时 - Mono 或程序集的目标运行时(在我的情况下为 .NET 4.5)?
Is it possible? If it possible, which runtime will be used for this libraries - Mono or assembly's target runtime (.NET 4.5 in my case)?
推荐答案
据我所知你不能,因为 unity 在单声道上运行.看看这里 http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html
As far as I know you can't because unity runs on mono. Have a look here http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html
基本上,Unity 升级到 .NET 3.5 或更高版本,具有一些类似于 c# 4.0 的功能,例如可选参数.
Basically, Unity goes upto .NET 3.5 or there about, with some features similar to c# 4.0 like optional parameters.
要记住的主要一点是,尽管您在构建设置中看到了什么,但 Unity3d 并未使用 .NET 2.0.
The main thing to keep in mind is that Unity3d is not using .NET 2.0 despite what you see in the build settings.
编辑 2:
我在某处看到您绝对不能直接引用 4.5 程序集.现在找不到资源了.
I've seen somewhere that you definitely can't reference 4.5 assemblies directly. Cant' find the resource now.
无论如何,我想有可能制作一个调用 4.5 程序集的 C++ 包装器.问题是即使你编写了一个以这种方式工作的包装器,它也只能在 Windows 机器上工作.基本上是因为单声道无法在任何其他平台上支持它们.再次在理论上.
In any case, I suppose it may be possible to make a C++ wrapper that would call 4.5 assemblies. The thing is even if you wrote a wrapper that worked this way, it would only work on windows machines. Basically due to the fact that mono isn't able to support them on any other platform. Again in theory.
免责声明:单声道支持部分只是一个有根据的猜测.我不是 100% 的.
DISCLAIMER : The mono support part is just an educated guess. I'm not 100 % on that.
这也是一个很好的阅读C#的正确版本号是什么?
这篇关于Unity3D - 我可以使用 .NET 4.5 程序集作为外部库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!