在 Unity 5 中使用 .NET 4.5 代码

编程入门 行业动态 更新时间:2024-10-09 08:26:17
本文介绍了在 Unity 5 中使用 .NET 4.5 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一款使用 Unity3D 版本 5 的游戏.该游戏应使用已在 C# .NET4.5 引擎中编程的严格业务规则.使用 Xamarin/Mono,我们希望它可以在 windows、android 和其他平台上使用...

I am working on a game using Unity3D version 5. The game should use strict business rules already programmed in a C# .NET4.5 engine. Using Xamarin/Mono, we hope to make this usable on windows, android, others...

我尝试将引擎构建到 dll 中,并将其用作 Unity 中的托管插件.但是 Unity 使用旧版本的 Mono 来编译整个游戏,并且拒绝使用 .NET 4.5 dll.

I tried building the engine into a dll and use it as a managed plugin in Unity. But Unity uses an old version of Mono to compile the whole game and refuses to use .NET 4.5 dlls.

我真的需要使用这段代码,我考虑将其降级到 .NET 3.5,但鉴于引擎上已经完成的工作,这不是一个可接受的解决方案.

I really need to use this code, I looked into downgrading it to .NET 3.5 but it is not an acceptable solution given the work already done on the engine.

关于android,我想用Xamarin来获取android原生代码,作为Unity中的原生插件使用.现在我需要一个适用于 Windows 的解决方案.我正在寻找在 C++ 中使用 C# 代码来制作非托管 dll 的方法,但我正在努力理解哪种方法适用于 COM 互操作、C++/CLI 或其他方法.

Concerning android, I think to use Xamarin to get native android code and use it as a native plugin in Unity. Now I need a solution for Windows. I am looking into ways to use the C# code in C++ to make an unmanaged dll but I am struggling understanding which way is applicable here between COM interop, C++/CLI or other methods.

有没有人知道一种无需/很少努力就可以在 Unity 中包含来自 .NET 4.5 的代码的方法?

Does any one knows a way to include code from .NET 4.5 in Unity with no/little effort ?

推荐答案

使用 Visual Studio 插件:unmanaged导出,我已经能够将 C# .NET 4.5 导出到我可以在 Unity 引擎中使用的非托管/本机 dll.这迫使我只能调用简单的函数,但只需很少的工作,我就可以包装我的引擎的核心.

Using a visual studio plugin: unmanaged exports, I have been able to export the C# .NET 4.5 to an unmanaged/native dll which I can use in Unity Engine. This forces to call only simple functions, but with little work, it was possible for me to wrap the core of my engine.

更多推荐

在 Unity 5 中使用 .NET 4.5 代码

本文发布于:2023-11-13 02:38:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   Unity   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!