一) 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
二) ios 平台中的资源路径
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
StreamingAssets文件夹下的只读不可写路径:
以Application.streamingAssetsPath为基准 : jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
安卓读:filePath = Application.streamingAssetsPath + "/文件名.格式名";
filePath = "jar:file://" + Application.dataPath + "/!/assets" + "/文件名.格式名";
IOS读: filePath = "file://" + Application.streamingAssetsPath + "/文件名.格式名";
filePath = "file://" + Application.dataPath + "/Raw" + "/文件名.格式名";
PC读:filePath = "file://" + Application.streamingAssetsPath + "/文件名.格式名";/
Unity内部的可读可写路径:
安卓: path = Application.persistentDataPath + "/文件名.格式名";
IOS: path = Application.persistentDataPath + "/文件名.格式名"; //未验证
PC: path = "file://" + Application.persistentDataPath + "/文件名.格式名";//
网友评论