来源:http://blog.csdn.net/ynnmnm/article/details/52253674
http://www.jianshu.com/p/bbc2690bce30
Application.dataPath
Application.streamingAssetsPath
Application.persistentDataPath
Application.temporaryCachePath
iOS:
Application.dataPath /var/containers/Bundle/Application/app sandbox/xxx.app/Data
Application.streamingAssetsPath /var/containers/Bundle/Application/app sandbox/test.app/Data/Raw
Application.temporaryCachePath /var/mobile/Containers/Data/Application/app sandbox/Library/Caches
Application.persistentDataPath /var/mobile/Containers/Data/Application/app sandbox/Documents
Android:
Application.dataPath /data/app/package name-1/base.apk
Application.streamingAssetsPath jar:file:///data/app/package name-1/base.apk!/assets
Application.temporaryCachePath /storage/emulated/0/Android/data/package name/cache
Application.persistentDataPath /storage/emulated/0/Android/data/package name/files
Windows:
Application.dataPath: 应用的appname_Data/
Application.streamingAssetsPath: 应用的appname_Data/StreamingAssets
Application.temporaryCachePath: C:\Users\username\AppData\Local\Temp\company name\product name
Application.persistentDataPath: C:\Users\username\AppData\LocalLow\company name\product name
四个路径的含义
属性名称含义
Application.dataPath此属性用于返回程序的数据文件所在文件夹的路径
Application.streamingAssetsPath此属性用于返回流数据的缓存目录,返回路径为相对路径,适合设置一些外部数据文件的路径。
Application.persistentDataPath此属性用于返回一个持久化数据存储目录的路径,可以在此路径下存储一些持久化的数据文件:
Application.temporaryCachePath此属性用于返回一个临时数据的缓存目录。
Android 平台
属性名称返回路径
Application.dataPaht /data/app/xxx.xxx.xxx.apk
Application.streamingAssetsPath jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
Application.persistentDataPath /data/data/xxx.xxx.xxx/files
Application.temporaryCachePath /data/data/xxx.xxx.xxx/cache
IOS 平台
属性名称返回路径
Application.dataPahtApplication /xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
Application.streamingAssetsPathApplication/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
Application.persistentDataPathApplication/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
Application.temporaryCachePathApplication/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Library/Caches
Unity Editor平台
属性名称返回路径
Application.dataPahtApplication(工程目录)/Assets
Application.streamingAssetsPathApplication(工程目录)/Assets/StreamingAssets
Application.persistentDataPath系统指定目录1/工程名
Application.temporaryCachePath系统指定目录2/工程名