When to use persistentDataPath versus dataPath

Hello. I’m working on a game that will be both PC/Mac/iPhone. I need to store data for these locally for players (game state), and was looking at the best way to do this cross platform.

I see that there is both a dataPath and a persistentDataPath. dataPath is fairly well documented, persistentDataPath (which eludes to being the place to store data between runs) doesn’t give quite as much context as to when it’s appropriate to be used versus dataPath.

has anyone used the two and can they tell me which one they’d use to store the game state data? I did a search here and found three questions related to persistentDataPath, but none of the three were answered. Is peristentDataPath useful, or do people use dataPath and amend it as needed based on the underlying OS.


Late reply, but Application.dataPath will give you a read-only directory where the entire project can be found. If you have a sibling folder to your Assets/ directory, you can use it like:

Application.dataPath + ".." + Path.DirectorySeperatorChar + "sibling_path"

The Application.persistentDataPath is different for various platforms (iOS vs Android), and is the /Documents directory, a read-write path where you can put your downloaded stuff (new assets, for example).