unity3D 连接mysql数据库 之 MissingMethodException: Method not found: 'System.Threading.Monitor.Enter'.

unity3D连接mysql数据库:

1.下载安装mysql-connector-net-5.0.6,完成后将C:\Program Files (x86)\MySQL\MySQL Connector Net 5.0.6\Binaries\.NET 2.0下的MySql.Data.dll拷贝到unity工程的assets文件夹下

2.同时将unity安装路径E:\softset\unity4.6.3\Editor\Data\MonoBleedingEdge\lib\mono\2.0下的System.Data.dll拷贝到unity工程的assets文件夹下

3.在连接数据库的脚本中引入命名空间:using MySql.Data.MySqlClient;

可能会出现的问题:

1. Internal compiler error. See the console log for more information. output was:
Unhandled Exception: Mono.CSharp.InternalErrorException: Assets/Sctipts/Ui/Register.cs(8,14): Register ---> Mono.CSharp.InternalErrorException: Assets/Sctipts/Ui/Register.cs(14,39): Register.dbConnection ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

File name: 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

解决方法:项目工程缺少System.Drawing.dll将unity安装路径E:\softset\unity4.6.3\Editor\Data\MonoBleedingEdge\lib\mono\2.0下的System.Drawing.dll拷贝到unity工程的assets文件夹下

2. 运行时可能会出现:MissingMethodException: Method not found: 'System.Threading.Monitor.Enter'.

这是由于连接mysql的dll文件与平台版本不匹配引起的,我的unity版本为unity4.6.3,与mysql-connector-net-5.0.6是兼容的

资源分享:

mysql-connector-net-5.0.6下载:https://yunpan.cn/cY89e4BvYc395  访问密码 23df

mysql-connector-net-6.6.7下载:https://yunpan.cn/cY89XkhzYhgfB  访问密码 4753

unity4.6.3 下载:https://yunpan.cn/cY89bfiEgnWD8  访问密码 a315


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值