- Home /
How do I find a folder I can write data to on Android?
I need to store savefiles for my game on Android, but I can't figure out what path to write to. Application.dataPath returns the path to my apk folder, but I can't write anything there. Is there some relative path I can use ../ from Application.dataPath to get to? The files should stay permanently with the app, so a cache folder would be inappropriate.
Answer by arsalank2 · Nov 25, 2011 at 03:44 PM
Use Application.persistentDataPath
http://unity3d.com/support/documentation/ScriptReference/Application-persistentDataPath.html
Answer by eriQue · Nov 25, 2010 at 08:51 AM
There is an example plugin that shows how retrieve the cache directory. It can easily be modified to return the persistent files directory instead (replace getCacheDir() with getFilesDir()). But as far as the script API goes there is currently (with 3.1) no support for that.
Answer by Richard 3 · Mar 17, 2011 at 02:37 PM
Just Use PlayerPrefs. This will this will handle everything automatically. This makes saving games really simple.