0

So there is this game where I am using File I/O to store game data like high score and all that. It works fine in windows pc build(.exe) but I cant load the high score on android app.

I am just using a simple file name that gets created(if not exist) in the executable directory but same code doesn't seems to be working with android.

Is there a catch between working directories of android and windows pc? Please help..

string dataFile = Constants.GameDataFilePath;

gameDataFile = File.Open(dataFile, FileMode.OpenOrCreate,
                                       FileAccess.Read,
                                       FileShare.None);
Jajan
  • 887
  • 3
  • 15
  • 28

1 Answers1

0

On top of what Joe said, Application.persistentDataPath+"filename.extension", you should also go to Build Settings->select Android, click Player Settings and change Write Access from Internal Only to External (SD). Sometimes, that seems to be a problem if you don't do it.

Programmer
  • 121,791
  • 22
  • 236
  • 328