public void Save() { BinaryFormatter bf = new BinaryFormatter (); FileStream file = File.Create (Application.persistentDataPath + "/playerInfo.dat"); Debug.Log (Application.persistentDataPath); // Creates the plain class and writes the data to be saved to it PlayerInfo info = new PlayerInfo (); // Saves stats info.health = health; info.experience = experience; // Saves position position = transform.position; info.setPosition(position); // Saves data to the a file and closes it bf.Serialize (file, info); file.Close (); }