- Home /
Deserialization not working on Webgl
I am trying to deserialize an object sent with UNET using this code:
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream ms = new MemoryStream(recBuffer);
try
{
Net_Message msg = (Net_Message)formatter.Deserialize(ms);
OnData(connectionId, channelID, recHostId, msg);
}
catch (Exception e)
{
Debug.LogException(e);
}
It actually worked on the unity editor but when I tried it on the webgl build got this:
System.Runtime.Serialization.SerializationException: Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00000] in :0 (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Your answer
Follow this Question
Related Questions
JSON invalid value 1 Answer
Deserialize Json into list.,how to deserialize a list via .FromJson 1 Answer
[JsonUtility] cannot deserialize json to new instances of type X 2 Answers
New Assembly breaks Deserializer, but all custom objects are in the same Assembly. 1 Answer
Problems with webgl 1 Answer