Hello !
I’m currently writing a Save System, while JSON has been recommended to me, I still wonder if my own system wouldn’t be… more innovative.
Sooo, I’m using Binary Serialization, like
var b = new BinaryFormatter();
b.Serialize (myFile, myData);
Data like GameObjects for example cannont be serialized like this, so I simply tried to serialize objects, but, if my object has the value for example of a GameObject, its throwing again the error that GameObjects cant be serialized.
Ok, alright, tried a little harder way.
To avoid the message of not being able to cast from source to destination type contains this example a list.
List<object> objs = new List<object>();
object obj = myGameObject; // I'm not going to write down all declarations, you know there is a GameObject extisting if I write myGameObject ;)
objs.Add ( ((Enumerable) obj).Cast<object>()) );
Anndd, its still throwing the error, myGameObject wouldn’t be serializeable.
Does somebody knows a workaroung for this ?
The main thought is simply to save everything as Object, but it seems like, though I convert it to object, it recognizes it as the type the value has been before converting it to object…