zoukankan      html  css  js  c++  java
  • 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;
            }
        }

  • 相关阅读:
    5.6
    5.6
    4.30数据结构
    4.30
    POJ3616
    4.29
    4.28
    186周赛
    CF1267G Game Relics
    CF763E Timofey and our friends animals
  • 原文地址:https://www.cnblogs.com/Jason-c/p/6719324.html
Copyright © 2011-2022 走看看