Unity中的Path對應各平臺中的Path

OS:html

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文件夾app

#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.net

 

根目錄:Resources 文件夾xml

可使用Resources.Load("名字"); 把文件夾中的對象加載出來htm

 

根目錄:StreamingAssets 文件夾對象

可使用Application.dataPath進行讀操做blog

Application.dataPath: 只可讀不可寫,放置一些資源數據資源

 

Application.persistentDataPathget

IOS與Android平臺均可以使用這個目錄下進行讀寫操做,能夠存放各類配置文件進行修改之類的。string

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

相關文章
相關標籤/搜索