zoukankan      html  css  js  c++  java
  • Unity3D Resources TextAsset 正文

    一些小的数据,您可以使用txt文字作为一种媒介,被收购、变速箱、更改、记忆力。

    实例:User1.2.3.txt,放入 Resources/Data 文件下;

    一,Unity3d Resources.Load 载入获取数据。

       TextAsset TXTFile = (TextAsset)Resources.Load("Data/board" + boardN.ToString() +"." + rows.ToString() + "." + columns.ToString());

      TextAsset TXTFile = (TextAsset)Resources.Load(STR_DataBoard + boardN.ToString() +"." + rows.ToString() + "." + columns.ToString());

          if (TXTFile !

    = null)

         Debog.Log(TXTFile.text);   

            

    二,存储数据:

        // 存储路径

         string p = Application.dataPath +"/Resources/Data";

        TextWriter tw = new StreamWriter(Path.Combine(p, "board" + 1.ToString() +"." + 2.ToString() + "." + 3.ToString() +“.txt”),false, Encoding.ASCII);

    // f 为 数据

    string  f="ffffffff";

             tw.Write(f);

                tw.Flush();

                tw.Close();

    // 资源数据库.刷新   

     AssetDatabase.Refresh();

  • 相关阅读:
    React实现双数据绑定
    浏览器兼容
    关于postman
    前端常用插件、工具类库
    媒体查询总结
    Vue开发中可能会使用到的所有插件
    Vue+iView通过a标签导出文件
    类的内置方法
    单元测试
    面向对象的三大特性
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4819028.html
Copyright © 2011-2022 走看看