MySQL connector doesnt work when the game is build in WebGL
I have developed a game in unity3d version 2019.1.1 which uses SQLconnector to establish connection to (localhost) DB , get and transfer data back and fourth. When im running the game from the platform everything works fine , but when i build the game for WEBGL and run it from the browser i get this exception from the browser's console :
System.TypeInitializationException: The type initializer for
'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an
exception. ---> System.TypeInitializationException: The type initializer
for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. --->
System.NotSupportedException:
System.Configuration.ConfigurationManager::GetSection
also i get this error:
MySql.Data.MySqlClient.MySqlException (0x80004005): Exception of type
'MySql.Data.MySqlClient.MySqlException' was thrown. --->
System.Net.Sockets.SocketException (0x80004005): Success
at System.Net.Sockets.Socket..ctor (System.Net.Sockets.AddressFamily
addressFamily, System.Net.Sockets.SocketType socketType,
System.Net.Sockets.ProtocolType protocolType) [0x00000] in
<00000000000000000000000000000000>:0
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in
<00000000000000000000000000000000>:0
I have downloaded mysql connector dll's from mysql site. "mysql-connector-net-8.0.16-noinstall" also tried older version just to check , still same.
I have also included the files :
"all I18N" in my plugins , as been stated from various answers in this subject".
Scripting runtime version : 4.X net API compatible : 4.X v2 net
What am i missing ? I working on these games 1 month or so , kind of bigginer.
i know that i can use php and wwwForm for the db connection and that its not safe programming , but its just a training project .
I have checked every article in the web for this kind of errors and i cant get what im doing wrong.
Answer by dhindman · Aug 11, 2020 at 04:47 PM
Anything in the System.Net.Sockets namespace is unsupported in WebGL. See the docs here for more info.
Your answer
Follow this Question
Related Questions
Is there any tutorials on using MySQL and Unity? 0 Answers
Insert and Retrieve image from Database in Unity3d 0 Answers
C# safe connect to MySQL database. Download and upload data via PHP script. 1 Answer
Can I add a table to a mySQL database using C#? 0 Answers
Unity3D connection to MySQL error 1 Answer