- Home /
BinaryFormatter Deserialization Problem
I have this class :
public class Entity {
public EntityType Type;
public float X;
public float Y;
public float Z;
public float EULERX;
public float EULERY;
public float EULERZ;
[NonSerialized]
public GameObject gameObject;
ArrayList m_Enity = new ArrayList();
private void SetEntityBuffer(byte[] buffer) {
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream ms = new MemoryStream(buffer);
m_Entity = (ArrayList)formatter.Deserialize(ms);
}
}
When i try to deserialize my class i have this error message :
FileNotFoundException: Could not load file or assembly 'a35e27168eb1bf1419a211d3cc6c4ef1' or one of its dependencies. The system cannot find the file specified.
Irrelevant: gameObject is a bad name for a variable. And you "}"'s didn't quite match up so I fixed them.
Looks same as this forum thread discussion -- http://forum.unity3d.com/threads/16281-Unity-BinaryFormatter-Deserialization-Problem -- problem is due to regeneration of serialization assemblies with different versions == mismatch == error. $$anonymous$$gested solution is to move your code to an external assembly. You might also try setting formatter.AssemblyFormat = FormatterAssemblyStyle.Simple ... according to $$anonymous$$SDN, "In simple mode, the assembly used during deserialization need not match exactly the assembly used during serialization."
I am trying to connect between Unity3D (C#) and ASP.NET (C#) and get the same error. Can I share assemblies between $$anonymous$$ONO and .NET?
Your answer
![](https://koobas.hobune.stream/wayback/20220613103050im_/https://answers.unity.com/themes/thub/images/avi.jpg)