0
votes

So I try to load my dependencies into my code, and then I get this:

TypeLoadException: Could not load type 'System.Data.SqlClient.SqlConnection' from assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:59) System.Reflection.MonoMethodInfo.GetAttributes (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:75) System.Reflection.MonoMethod.get_Attributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:245) System.Reflection.MethodBase.get_IsSpecialName () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:184) UnityEditor.Build.BuildPipelineInterfaces.InitializeBuildCallbacks (Boolean findBuildProcessors, Boolean findSceneProcessors) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:149)y

I'm using mono, so that may be the reason? I don't really know, since it's the first time I try to work with a database on Unity.

What could I do to make it work?

1
A SqlConnection won't work for for mySql anywaystuartd
so what should I use then? it's been a while since i last worked with a mysql database on .net frameworkGabriel Drevis Ende
The dependencies i've loaded into the script are - using System.Data; - using MySql.Data.MySqlClient;Gabriel Drevis Ende
You'd want to use a MySqlConnectionstuartd
I'm using MySqlConnection, but it still gives me the same issue. private static MySqlConnection dbConnection; then i call this function just at the beggining private static void openSqlConnection() { string connectionString = "Server='nameoftheserver';" + "Database='nameofthedb';" + "User ID='username;" + "Password='password';"; dbConnection = new MySqlConnection(connectionString); dbConnection.Open(); Debug.Log("Connected to database."); } Am i doing something i shouldn't do?Gabriel Drevis Ende

1 Answers

0
votes

Did you use System.Data.dll from one of {ProgramFilesDir/x86}\Reference Assemblies\Microsoft\Framework.NETFramework\v3.5\Profile\ Unity profiles (e.g., Unity "Subset v3.5") folders?

Did you put it in "Assets/**/Plugins" folder?

Error tells you that you'r developing with other assembly version that you build / run (in other enviroment) your app.