Hey i want to make a Android Game now my step was Save/Load Data. Now i test it on my PC all goes perfect, The Game creates the Saves folder and saves my bool. Then i put the Apk on my Android device. When the game has to save the bool it stands still. (not a freeze frame but it dont go on).
Here the Code i used to save Data:
Save(It will start the method if you win a level): public void SaveData()
{
bool nextlevel = true;
if (!Directory.Exists("Saves"))
Directory.CreateDirectory("Saves");
BinaryFormatter formatter = new BinaryFormatter();
FileStream saveFile = File.Create("Saves/save.level." + nextScence);
formatter.Serialize(saveFile, nextlevel);
saveFile.Close();
}
Load(I need load in my Level screen to check if the player has played the level):
try
{
BinaryFormatter formatter = new BinaryFormatter();
FileStream saveFile = File.Open("Saves/save.level." + level, FileMode.Open);
nextlevel = (bool)formatter.Deserialize(saveFile);
saveFile.Close();
}
catch (FileNotFoundException e)
{
nextlevel = false;
}
I hope you can Help me ,thanks for help
I only know this method to Save data if you now a better one and if its go on android to please tell it to me !