简体   繁体   English

如何将Visual Studio项目移植到Unity?

[英]How to port a Visual Studio project to Unity?

I have a C# project I created with Visual Studio that contains a form and I want to port it to Unity. 我有一个使用Visual Studio创建的C#项目,其中包含一个表单,我想将其移植到Unity。 I have googled it, but I have only seen the reverse, building a Unity project to a Visual Studio solution for UWP. 我已经用谷歌搜索过,但是我只看到相反的情况,为UWP构建一个Visual Studio解决方案的Unity项目。

How can I do this? 我怎样才能做到这一点?

You either have to recreate the form using a GUI framework such as Unitys built-in or a third party framework such as Noesis Engine which supports Xaml, data binding and MVVM. 您必须使用GUI框架(例如内置的Unitys)或第三方框架(例如支持Xaml,数据绑定和MVVM的Noesis Engine)重新创建表单。

Unity does not support Windows Forms or WPF, so UI-wise this is a near complete rewrite. Unity不支持Windows窗体或WPF,因此在UI方面这几乎是完全重写。

To clarify a bit: Unity runs on a limited version of .Net based on Mono. 澄清一下:Unity在基于Mono的.Net受限版本上运行。 It has a custom compile pipeline separate from Visual Studio and C# projects. 它具有独立于Visual Studio和C#项目的自定义编译管道。 Unity compiles to many platforms and takes care of the implementation details for you. Unity可以编译到许多平台,并为您解决实施细节。 This means that Windows-only frameworks such as Windows Forms and WPF can't be used, since they rely on the Windows API. 这意味着不能使用仅Windows框架,例如Windows Forms和WPF,因为它们依赖Windows API。 Other code can however be shared, so with a proper presentation layer separation (ie MVC or MVVM) much of the code can be shared. 但是,其他代码也可以共享,因此,通过适当的表示层分隔(即MVC或MVVM),可以共享许多代码。

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

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