http://www.ceeger.com/forum/read.php?tid=16174
public void Start(){ StartCoroutine(ontest()); } IEnumerator ontest(){ string persistentDataPath = Application.persistentDataPath +"/01.txt"; Debug.Log(" persistentDataPath : "+persistentDataPath); if(!File.Exists(persistentDataPath)){ string fileName = Application.streamingAssetsPath + "/01.txt"; Debug.Log(" fileName :"+fileName); if(File.Exists(fileName)){ WWW www = new WWW(fileName); yield return www; if(!string.IsNullOrEmpty(www.error)){ Debug.Log("==============load not error=========="); }else{ Debug.Log("=============load error=========="); yield break; } if(www.isDone){ Debug.Log("==============isDone=========="); File.WriteAllBytes(persistentDataPath,www.bytes); }else{ Debug.Log("==============not isDone=========="); } }else{ Debug.Log(fileName +" is not exists"); } }else{ Debug.Log(persistentDataPath+" is exists"); } }
adb logcat -s Unity 打印的结果
在ios 运行没有这种情况,android 不知道为毛出现这种情况!
与本人出现类似情况的一个帖子 http://tieba.baidu.com/p/2431263861
这路径好像是找不到,以前做截屏的时候保存路径也出现过这情况,你可以不必考虑路径是否存在,你直接读取路径下的资源就OK了
dengqiang569:这路径好像是找不到,以前做截屏的时候保存路径也出现过这情况,你可以不必考虑路径是否存在,你直接读取路径下的资源就OK了看来只能这样了。