Unity Android路径及注意事项


Application.temporaryCachePath==/storage/emulated/0/Android/data/com.***.***/cache

Application.persistentDataPath==/storage/emulated/0/Android/data/com.***.***/files

 

或许你碰到过,在电脑读取该目录下的文件一点问题也没有,突然发不到Android怎么也读取不到。是吧即便路径改成Android上的路径也读取不到 "jar:file://" + Application.dataPath + "!/assets";

嗯嗯嗯,Android上就是这么特殊,其实不是文件路径不对,而是在Android上读取文件的方式不对哎
他需要以WWW的方式去读。好坑啊

path=Application.streamingAssetsPath+“文件名。后缀”

string str;
IEnumerator ReadFile(string path)
    {
        WWW www = new WWW(path);
        yield return www;

        if (string.IsNullOrEmpty(www.error))
        {
            str= www.text;
        }
    }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM