Saving no longer works on iOS

I released a Unity (4.6) game for iOS last year, and saved the player’s level progression using a binary formatter. Everything worked fine, but this past week I’ve been working on an update and am seeing a strange breaking of the saving system (which I have not touched).

When I build/run the project in Xcode, if the game is not yet on the device (whether iPad or iPhone), saving works properly. If I build it again, saving no longer works. If I run the game from the device, saving no longer works.

I haven’t been able to determine if the problem is with my Xcode project, or with the game itself (because maybe something has changed in recent iOS updates?).

Here’s some of the code to show how I handle things. These are all from a “ManagerLevels” class attached to a game object in the level selection screen (it isn’t a child of anything so shouldn’t be getting destroyed).

public static ManagerLevels levelControl;
public static bool [] completedLevels = new bool[35];	// 35 so can use 1-34

class LevelData {
	public bool [] completedLevels;

void Awake () {                                          // Simple Singleton
	if (levelControl == null) {
		levelControl = this;
	else if (levelControl != this) {

public static void Load() {
	if (File.Exists(Application.persistentDataPath + "/levelInfo.dat")) {
		BinaryFormatter bf = new BinaryFormatter();
		FileStream file = File.Open(Application.persistentDataPath + "/levelInfo.dat", FileMode.Open);
		LevelData data = (LevelData) bf.Deserialize(file);

		completedLevels = data.completedLevels;
	else {
		// If no save data, set all completed level bools false (to be safe)
		for (int i=1; i<(completedLevels.Length); i++) {
			completedLevels *= false;*


  • }*
    public static void Save() {

  • BinaryFormatter bf = new BinaryFormatter();*

  • FileStream file = File.Create(Application.persistentDataPath + “/levelInfo.dat”);*

  • LevelData data = new LevelData();*

  • data.completedLevels = completedLevels;*

  • bf.Serialize(file, data);*

  • file.Close();*

Yes, I did solve it. I was missing the following line in the Awake method (before anything else inside):

Environment.SetEnvironmentVariable(“MONO_REFLECTION_SERIALIZER”, “yes”);

Worked fine after adding that.