string streamingAssetsPath = Application.streamingAssetsPath; string dataPath = Application.dataPath; string persistentDataPath = Application.persistentDataPath; Debug.Log ("streamingAssetsPath= "+streamingAssetsPath+ "_dataPath= "+dataPath+ " _persistentDataPath="+persistentDataPath);
对于android平台下与电脑上测试的结果:
//android真机测试:
streamingAssetsPath = jar:file:///mnt/asec/com.test.longshao-2/pkg.apk!/assets
_dataPath = /mnt/asec/com.test.longshao-2/pkg.apk
_persistentDataPath =/data/data/com.test.longshao/files
persistentDataPath在android平台可指定路径为sdCard中,需要配置过程:
File->Build Settings->Player Settings ->Inspector->Other Settings ->Write Access ->External(SDCard)
设置成功后真机测试路径为:
_persistentDataPath =/mnt/sdcard/Android/data/com.test.longshao/files
//电脑测试:
streamingAssetsPath = D:/unity_workspace/example/example_UI/Assets/StreamingAssets
_dataPath = D:/unity_workspace/example/example_UI/Assets
_persistentDataPath = C:/Users/longshao/AppData/LocalLow/DefaultCompany/example_UI