- Home /
Need some helps
I added some DLLs to my assets/plugins folder and I use them in my code. The code works fine and the DLLs work when I play it inside the editor. But as soon as I compile the build into google native client or web player. I'll come across this two errors. But the optimization for the api level is already set to .NET 2.0. Any helper out there is able to help me out?
Here is the following two errors.
1) Error building Player: Extracting referenced dlls failed.
2) ArgumentException: The Assembly System.Configuration is referenced by System.Data. But the dll is not allowed to be included or could not be found. UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/AssemblyHelper.cs:114) UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/AssemblyHelper.cs:117) UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/AssemblyHelper.cs:117) UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/AssemblyHelper.cs:149) UnityEditor.HostView:OnGUI()
Here is my code :
using UnityEngine;
using system;
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel.DataAnnotations;
using MySql.Data.MySqlClient;
public class NewBehaviourScript : MonoBehaviour {
//Public variables
string weather;
int seatAvailability;
void Start () {
string connectionString ="server=127.0.0.1;uid=****;pwd=********;database=pecdb;";
MySqlConnection conn = new MySqlConnection(connectionString);
conn.Open();
MySqlCommand dbcmd = conn.CreateCommand();
string sql =
"SELECT weather,seatAvailability " +
"FROM location WHERE idlocation=21";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
weather = (string) reader["weather"];
seatAvailability = (int) reader["seatAvailability"];
print("Weather: " +
weather + "SeatAvailability: " + seatAvailability);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
conn.Close();
conn = null;
}
void Update()
{
}
void OnGUI()
{
GUI.color = Color.black;
GUI.Label (new Rect (10, 10, 200, 20), "Weather : " +weather);
GUI.Label (new Rect (10, 30, 400, 30), "SeatAvailability : " +seatAvailability);
}
}
Not sure these will solve your problem, but take a look at:
http://answers.unity3d.com/questions/541474/missing-namespaces.html
http://answers.unity3d.com/questions/517264/unity-and-the-dlls.html
Answer by Mathieu_Dossmann · Oct 31, 2014 at 11:58 AM
Careful you wrote :
using system;
instead of :
using System;
Case sensitive is important!
Thank you. I have edited my codes but i'm still having the same errors.
Answer by fffMalzbier · Nov 05, 2014 at 08:39 AM
System.Data is not available in any of .net / mono profile unity uses. So your using System.Data; and using System.Data.SqlClient; will not work.
In this list you can find what available and whats not: http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html