这两天在做一个unity打开文件选择框的功能。网上找到两种方法,

第一种是调用win32打开对话框,这个挺好,但是有个致命的问题,没办法多选!!!多选的话返回的是根目录的路径,文件名返回不了,找了半天答案,自己改了半天也搞不定。所以就放弃了。

第二种就是引用System.Windows.Forms,这个遇到的坑更多,首先是引用老是报错,然后在unity里运行正常,打包出去不是oops奔溃,就是失效。网上找了半天效果都不是太好,最后自己研究半天终于搞定了,把容易遇到的坑总结下把~

1、关于System.Windows.Forms这个dll,必须引用这个路径下的:X:\Unity安装目录\Editor\Data\Mono\lib\mono\2.0,其他的统统不行,因为在Unity安装目录下有好多个System.Windows.Forms,必须是这个目录下的!!!!其他目录下的dll或许能运行,但是打包出去会各种报错!!!

2、dll必须得放在工程根目录下,网上别人说都要放在plugins文件夹下,但是我放在里面会报错,运行都运行不了。

3、Player Settings-Optimization的API Compatibilty level必须选择.Net 2.0,否则也会报错。

Unity引用System.Windows.Forms遇到的一些坑的更多相关文章

  1. Unity 读取、写入自定义路径文件,调用System.Windows.Forms

    调用System.Windows.Forms DLL 首先在Unity新建Plugins文件夹添加System.Windows.Forms.dll 然后代码中添加引用 using System; us ...

  2. 命名空间“System.Windows.Forms”中不存在类型或命名空间名称“DataVisualization”。是否缺少程序集引用?

    using System.Windows.Forms.DataVisualization.Charting; 编译时报警:命名空间"System.Windows.Forms"中不存 ...

  3. c#或者C#.net中的“ToolTip”是“System.Windows.Forms.ToolTip”和“DevComponents.DotNetBar.ToolTip”之间的不明确的引用

    “ToolTip”是“System.Windows.Forms.ToolTip”和“DevComponents.DotNetBar.ToolTip”之间的不明确的引用 ,在编程时,有时候会编译出现不明 ...

  4. 找不到命名空间命名空间:System.Windows.Forms

    System.Windows.Forms在system.windows.forms.dll中.需要添加引用.在解决方案资源管理器中的引用上单击右键,选择添加引用.找到System.windows.fo ...

  5. .net chart(图表)控件的使用-System.Windows.Forms.DataVisualization.dll

    这个案例指在介绍微软这套免费又功能强大的图表控件Microsoft Chart Controls for Microsoft .NET Framework 3.5,通过它,可让您的项目及报表,轻松套用 ...

  6. System.Windows.Forms.Control : Component, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject....

    #region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  7. ArgumentException: The Assembly Mono.WebBrowser is referenced by System.Windows.Forms ('Assets/Plugins/System.Windows.Forms.dll'). But the dll is not allowed to be included or could not be found.

    最近有个项目要用到System.Windows.Forms.dll,在Unity编辑器里用着还好好的,但是一导出就给我报错,让我十分不爽. 于是请教百度,搜出了五花八门的答案,没一个能解决我的问题的, ...

  8. WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常

    WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...

  9. 用户控件的设计要点 System.Windows.Forms.UserControl

    用户控件的设计要点 最近的项目中有一个瀑布图(彩图)的功能,就是把空间和时间上的点量值以图的形式呈现出来,如下图: X坐标为空间,水平方向的一个像素代表一个空间单位(例如50米) Y坐标为时间,垂直方 ...

随机推荐

  1. JS调用函数的两种方式

    <script type="text/javascript"> window.onload = init; //onload 表示页面全部加载完毕后,再调用init() ...

  2. 微服务读取不到config配置中心配置信息,Spring Boot无法找到PropertySource:找不到标签Could not locate PropertySource: label not found

    服务出现报这个错, o.s.c.c.c.ConfigServicePropertySourceLocator - Could not locate PropertySource: label not ...

  3. Oracle11g配置监听

    步骤 1.在windows系统上安装好Oracle后,点击右下角开始菜单Oracle目录下选择Net Manager进行配置,也可以使用Net Configuration Assistant(建议使用 ...

  4. format的使用

    v="敬爱可亲的{0},最喜欢在{1}地方干{2}" name1=input("名字>") lang=input("地点>") ...

  5. 【资源分享】Gmod日志记录脚本

    *----------------------------------------------[下载区]----------------------------------------------* ...

  6. Centos7添加软链接

    1.pycharm添加软连接: 命令行模式中输入命令: ln -s /root/pycharm-2018.1/bin/pycharm.sh /usr/bin/pycharm ps:代码中/root/p ...

  7. TD - setAttribute()

    添加指定的属性,并为其赋指定的值 this.sltLevelType.setAttribute("height", "100px");

  8. sql查询 ——聚合函数

    --聚合函数 -- sum() -- 求和 select sum(age) from student; -- count() -- 求数量 -- 数据量 select count(*) as '数量' ...

  9. 如何去官网上下载tomcat的linux版本

    1.首先进入官网,进入如下位置 2.进入bin文件夹中下载: 原文链接:https://blog.csdn.net/zdb292034/article/details/82433072

  10. MonoBehaviour单例的另外一种省事的写法

    using UnityEngine; public class CommSystem: SingletonGeneric<CommSystem> { public static strin ...