c# - 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.
解决方案
我已经解决了这个问题。问题是我复制到GameDirectory\GameName_Data\Managed 的System.Windows.Forms.dll 和System.Drawing.dll 是错误的。我不应该从系统文件夹中复制它。相反,它应该是位于 UnityDirectory\Editor\Data\Mono\lib\mono\2.0 的那个。使用其他dll会导致很多错误。
推荐阅读
- javascript - 找不到模块“socket.io”
- openlayers-3 - FeatureServer 是否有 Esri API 调用来检索图例
- wix - Wix 工具集 3.11.2 - 本地化标识符“xx”已在多个位置重复。请解决冲突
- sql - 如何使用 DoCmd.RunSQL
- php - PHP - 如何将 Cookie 的优先级值设置为高、低或中?
- c - 如何在 C 程序运行期间添加线程?
- asana - 防止通过 API 意外删除或更新任务
- python - 使用 Python 将 .csv 文件加载到 Apache Cassandra 的问题
- html - 是否可以在另一个 z 索引元素中独立设置 z 索引?
- javascript - 如何在javascript中使图片再次可拖动?