I have successfully created a class which handles saving and loading a custom class for the vast majority of devices available (thank you to this great live training session).
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = null;
// Check whether a player file already exists
if(File.Exists(Application.persistentDataPath + k_PlayerInfoFileName))
{
file = File.Open(Application.persistentDataPath + k_PlayerInfoFileName, FileMode.Open);
}
else
{
file = File.Create(Application.persistentDataPath + k_PlayerInfoFileName);
}
Player_Info data = new Player_Info();
data.m_CurrentLevel = m_CurrentLevel;
data.m_UnlockedLevel = m_UnlockedLevel;
data.m_LevelScores = m_LevelScores;
binaryFormatter.Serialize(file, data);
file.Close();
However, the process I’ve used (as demonstrated above) doesn’t work with a Windows Phone 8. Is there an alternative class or method I can use which saves a custom class specifically for targeting WP8?