安卓 通过www读取Application.persistentDataPath

今天在读取Application.persistentDataPath路径下的图片时,在前面加上“file:///” 例如

 

#if UNITY_EDITOR || UNITY_STANDALONE
        return "file:///" + Application.persistentDataPath + "1.jpg";
#elif UNITY_ANDROID
         return "file:///" +Application.persistentDataPath + "1.jpg";
#else
        return "file:///" +Application.persistentDataPath + "1.jpg";
#endif

 

搞了半天 www 加载 在前面加“jar:file///” 没有用 不加也没有用,只有在前面加"file:///"才行;

 

另外 FileStream 读取文件时遇到一些问题

string ConfigurationFile= ""#if UNITY_EDITOR
            ConfigurationFile = Application.streamingAssetsPath + "/ConfigurationFile.txt";
#elif UNITY_ANDROID
           ConfigurationFile =Application.streamingAssetsPath + "/ConfigurationFile.txt";
#elif UNITY_STANDALONE
             ConfigurationFile = Application.streamingAssetsPath + "/ConfigurationFile.txt";
#endif

 FileStream file = new FileStream(ConfigurationFile, FileMode.Open);

 

有没有发现 fileStream 地址不能加 file:///

安卓 通过www读取Application.persistentDataPath

上一篇:java_ 集合


下一篇:java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseSelectProvider.()