Unity发布WebGL,访问MySQL,在浏览器打开报错.

最近做Unity发布WebGL,访问MySQL数据库时遇到了一些问题,记录一下.

报错

An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort(163) at jsStackTrace (02.asm.work.unityweb:2:27460)
stackTrace (02.asm.work.unityweb:2:27631)
abort (02.asm.work.unityweb:4:38580)
NCu (02.asm.code.unityweb:38:1)
Lql (02.asm.code.unityweb:10:1)
iku (02.asm.code.unityweb:38:1)
qej (02.asm.code.unityweb:12:1)
Psu (02.asm.code.unityweb:38:1)
invoke_iiiii (02.asm.work.unityweb:2:348461)
OFt (02.asm.code.unityweb:28:1)
uQt (02.asm.code.unityweb:28:1)
gIa (02.asm.code.unityweb:11:1)
aIa (02.asm.code.unityweb:11:1)
WEc (02.asm.code.unityweb:17:1)
GEc (02.asm.code.unityweb:17:1)
fhd (02.asm.code.unityweb:29:1)
ehd (02.asm.code.unityweb:29:1)
ZLc (02.asm.code.unityweb:17:1)
qHc (02.asm.code.unityweb:17:1)
eHc (02.asm.code.unityweb:17:1)
Jtu (02.asm.code.unityweb:38:1)
browserIterationFunc (02.asm.work.unityweb:2:213135)
runIter (02.asm.work.unityweb:2:195189)
Browser_mainLoop_runner (02.asm.work.unityweb:2:214682)

If this abort() is unexpected build with -s ASSERTIONS=1 which can give more information.

打开浏览器控制台,看到具体信息

Unity发布WebGL,访问MySQL,在浏览器打开报错.

解决方案

查了一些资料,发现WebGL不能直接连接到数据库,这也是报错的原因所在.
可以看这篇博客:https://blog.csdn.net/sinat_39291423/article/details/103385706
可以看到博客的博主也有相关的其他博客:
https://blog.csdn.net/sinat_39291423/article/details/103402825