Assign a variable using BinaryFormatter

Hi!

I have a few variables I need to be set using a binaryformatter when I deserialize. I just don’t know how to do it. This is currently my code for this.

BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(loadLocation + lvlName, FileMode.Append);

author = (string)bf.Deserialize(file);
name = (string)bf.Deserialize(file);

Thanks in advance!

So I found a way of doing all this. I followed this tutorial: http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/persistence-data-saving-loading

It was that easy.