首页 > 解决方案 > How to create a Winform in Unity and display it?

问题描述

I am having a released unity game with its Assembly-CSharp.dll already decompeiled by DnSpy.I want to add something that can display information. Due to difficulty to edit UI without the visual editor of Unity, I decided to make a winform by Visual Studio then copy the UI layout code to DnSpy. I know how to add reference, and using those namespaces, then create an instance of Form. But I can't get it displayed by calling Form.show() of the newly created instance. Can any one help me to solve this?

added on 2021/1/26: this question was asked long time ago and I didn't know how to ask good answer, as a result I never give any furthur detail such as stack trace or error message. But such info cannot be retrieved any more. Here by informing readers.

标签: c#.netunity3d

解决方案


我已经解决了这个问题。问题是我复制到GameDirectory\GameName_Data\Managed 的​​System.Windows.Forms.dll 和System.Drawing.dll 是错误的。我不应该从系统文件夹中复制它。相反,它应该是位于 UnityDirectory\Editor\Data\Mono\lib\mono\2.0 的那个。使用其他dll会导致很多错误。


推荐阅读