Answer the question
In order to leave comments, you need to log in
Why does the serialization of Vector3 and the like in the unit not work?
There is a class whose object I need to save to a binary file. For a field class of type float (saves normally), and types Vector3, Quaterion, Matrix4x4, etc. (does not save them) writes an error: "SerializationException: Type 'UnityEngine.Vector3' in Assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture =neutral, PublicKeyToken=null' is not marked as serializable."
This is how I save:
FileStream fs = new FileStream("DataFile.dat", FileMode.Create);
Binary.BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, obj);
fs.Close();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question