- Home /
Error Using DataContractSerializer
I am getting this error when trying to create a DataContractSerializer in my Unity script.
TypeLoadException: Could not load type 'System.Runtime.Serialization.DiagnosticUtility' from assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. System.Runtime.Serialization.DataContractSerializer..ctor (System.Type type, IEnumerable`1 knownTypes, Int32 maxItemsInObjectGraph, Boolean ignoreExtensionDataObject, Boolean preserveObjectReferences, IDataContractSurrogate dataContractSurrogate) System.Runtime.Serialization.DataContractSerializer..ctor (System.Type type, IEnumerable`1 knownTypes) System.Runtime.Serialization.DataContractSerializer..ctor (System.Type type)
In order to even get the script to compile in the editor I had to import the System.Runtime.Serialization.dll directly into my assets. Of course, I am pretty sure that is the problem. But I am clueless as to actually make this work the correct way.
Can someone please clue me in? I am using the DataContractSerializer as my primary serialization class and would like to continue doing so.
Thanks.
Answer by RogueDeus · Oct 15, 2011 at 04:14 PM
Apparently its a pro only feature, to use external DLL.s in your scripts.
http://unity3d.com/support/documentation/Manual/Plugins.html
This link isn't actually related. Plugins are written in C, C++, or Objective-C, just as it says in the link. Your particular problem seems to be the same as this guy's:
http://answers.unity3d.com/questions/8798/interop-with-other-c-assemblies.html