Not saving files!

Android doesnt save my files,so everytime i open game again,it resets.I tested on few devices and all have the same mistake.Please help,here is code,the load and save function is called trough other scripts on the end of every level!

using System.Collections.Generic;
using UnityEngine;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

[System.Serializable]
class PlayerData
{
public int level1 = 0;
public int level2 = 0;
public int level3 = 0;
}
public class GameManager : MonoBehaviour {

public static GameManager manager;
public int level1=0;
public int level2=0;
public int level3=0;
// Use this for initialization
void Awake () {
if (manager == null) {
DontDestroyOnLoad (gameObject);
} else if (manager != this) {
Destroy (gameObject);
}
Load ();

}
public void Save()
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + “/playerInfo.dat”);

PlayerData data = new PlayerData ();
data.level1 = level1;
data.level2 = level2;
data.level3 = level3;
bf.Serialize (file, data);
file.Close ();
}
public void Load()
{
Debug.Log (“ItsWorking”);
if (File.Exists (Application.persistentDataPath + “/playerInfo,dat”)) {
BinaryFormatter bf = new BinaryFormatter ();
FileStream file = File.Open (Application.persistentDataPath + “/playerInfo.dat”, FileMode.Open);
PlayerData data = (PlayerData)bf.Deserialize (file);
file.Close ();

level1 = data.level1;
level2 = data.level2;
level3 = data.level3;
Debug.Log (“ALl is WORKING”);
}
}
}

There is an error on editor saying that path for loading doesnt exists

You mistyped the file name. You are saving as “playerInfo.dat” and asking for a “playerInfo,dat”

 if (File.Exists (Application.persistentDataPath + "/playerInfo,dat")) {
1 Like