虽然这个方法解决了导入dll引发的报错,但由于我使用的mysql版本是8.0,一旦连接数据库,使用低版本的Mysql.Data.dll会报错

Client does not support authentication protocol requested by server; consider upgrading MySQL client

试着用8.0.24的Mysql.Data.dll去连接,就不会报这个错误,可能是导入的dll与mysql的版本不匹配,如果mysql是5.x版本的,应该不会报错,可以接着看下去,如果是8.0版本,可以点击进去看这篇文章

最近在做的一个Unity项目需要连接Mysql数据库,而这需要导入dll,如下图
在这里插入图片描述
导入成功后,会引发报错:

Assembly ‘Assets/Plugins/MySql.Data.dll’ will not be loaded due to errors:
Unable to resolve reference ‘Google.Protobuf’. Is the assembly missing or incompatible with the current platform?
Unable to resolve reference ‘BouncyCastle.Crypto’. Is the assembly missing or incompatible with the current platform?
Unable to resolve reference ‘Renci.SshNet’. Is the assembly missing or incompatible with the current platform?

该错误是版本太高,得需要低点的版本,下面是6.3的版本

链接: https://pan.baidu.com/s/1Pit00O2s5nak60XfUHfeoA
提取码: ycsq

还有个错误
Microsoft ® Visual C# Compiler version 2.9.1.65535 (9d34608e)
这需要在Player Setting中设置脚本的运行环境与dll的环境相同(上图中红框中的部分)
解决办法如下图
在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐