zoukankan      html  css  js  c++  java
  • 安卓 通过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:///

  • 相关阅读:
    static关键字详解
    解读equals()和hashCode()
    基于马士兵老师的高并发笔记
    scrapy安装及基本使用
    scrapy 简单操作
    python django简单操作
    Map,Filter 和 Reduce
    2017-08-06笔记
    幂等性
    Jmeter jdbc连接
  • 原文地址:https://www.cnblogs.com/dj1232090/p/10197233.html
Copyright © 2011-2022 走看看