I want to know how to store local high scores on an iOS device.
If I make use of System.IO.File.CreateText() and System.IO.File.ReadAllText(), what file path should I use?
Is it safe to use the value of Application.dataPath in the iPhone device?
I want to know how to store local high scores on an iOS device.
If I make use of System.IO.File.CreateText() and System.IO.File.ReadAllText(), what file path should I use?
Is it safe to use the value of Application.dataPath in the iPhone device?
For simple data like highscores just use PlayerPrefs.
iOS only allows you to write to the Documents directory of your app/game.
The Documents path ought to be /Documents
Application.dataPath returns /<AppName.app>/Data
You could get there by using Application.dataPath + “…/…/Documents” . Or trimming the last 5 characters and then substringing to the last index of “/”.
Writing to Application.dataPath + whatever will result in a “Permission Denied” exception.
not fully true.
There is also the cache folder to which you should write all data that are not meant to be backed up by itunes actually (inapp store purchase downloads, temp files and alike)