I'm trying to serialize an object like this:
public void SaveHighscore()
{
string fname = Application.loadedLevelName + "_score.dat";
using (Stream stream = File.Open(fname, FileMode.Create))
{
BinaryFormatter bin = new BinaryFormatter();
bin.Serialize(stream, this);
}
}
Highscore only has data type members and one object of type Replay, with again only has data type members as well as two lists of serializable objects.
I'm getting
SerializationException: Type GameController is not marked as Serializable.
Gamecontroller is the class that calls object.SaveHighscore(). It's not referenced anywhere within the highscore object itself.
edit: solved. I had an event in the class which was registered by gameController