Unity中的Path对应各平台中的Path

OS:
Application.dataPath :                    Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
Application.streamingAssetsPath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
Application.persistentDataPath :    Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
Application.temporaryCachePath : Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Library/Caches

Android:
Application.dataPath :  /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

Windows Web Player:
Application.dataPath :  file:///D:/MyGame/WebPlayer (即导包后保存的文件夹,html文件所在文件夹)
Application.streamingAssetsPath : 
Application.persistentDataPath : 
Application.temporaryCachePath : 

---------------------------------------------------------------------------------------------------
各目录权限:

根目录:StreamingAssets文件夹html

#if UNITY_EDITOR
string filepath = Application.dataPath +"/StreamingAssets"+"/my.xml";
#elif UNITY_IPHONE
 string filepath = Application.dataPath +"/Raw"+"/my.xml";
#elif UNITY_ANDROID
 string filepath = "jar:file://" + Application.dataPath + "!/assets/"+"/my.xml;
#endif
android


根目录:Resources 文件夹缓存

可使用Resources.Load("名字"); 把文件夹中的对象加载出来app


根目录:StreamingAssets 文件夹spa

可使用Application.dataPath进行读操做线程

Application.dataPath: 只可读不可写,放置一些资源数据
xml


Application.persistentDataPath
htm

IOS与android平台均可以使用这个目录下进行读写操做,能够存放各类配置文件进行修改之类的。对象

在PC上的地址是:C:\Users\用户名 \AppData\LocalLow\DefaultCompany\testblog






Unity的资源数据加载 - Resources、AssetBundle、StreamingAsset、PersistentDataPath


Resources 
- 打包集成到.asset文件里面及引用的资源as后se一个文件里面面
- 主线程加载
- 想要动态更新资源则不考虑


AssetBundle 
- unity定义的二进制文件类型
- 用WWW类下载

StreamingAssets
- 可读不可写
- 内容限制 - 无 
- 只能用WWW类下载


PersistentDataPath目录下
- 可读可写
- 内容限制 - 无
- 清除手机缓存文件会一并清理这里的东西
- 随意弄,可做为本地目录让WWW下载、也能够本身用FileInfo乱整







Unity的Android和IOS上相关的目录结构
Android:
- assets 游戏内容相关的都在这里了
- lib JNI相关的东西
- META-INF Java包跟rar包的区别
- res 图标之类的
- AndroidManifest.xml Android配置文件
- classes.dex Java虚拟机runtime的东西
- resources.arsc Java编译后的二进制文件


IOS:
- level0/level1… Scene
- sharedassets0/shaedassets1/… Scene相关的东西
- Managed 脚本编译后的dll
- resources.assets Resources里面的东西
- Raw StreamingAssets里面的东西