当前位置: 首页> 财经> 创投人物 > 公司基本介绍模版_小程序制作方法_天津网站建设技术外包_百度提升排名

公司基本介绍模版_小程序制作方法_天津网站建设技术外包_百度提升排名

时间:2025/8/11 22:35:11来源:https://blog.csdn.net/weixin_39114763/article/details/144916182 浏览次数:0次
公司基本介绍模版_小程序制作方法_天津网站建设技术外包_百度提升排名

上代码,不需要用插件乱七八糟的东西,因为我这里导出webgl被各种插件折磨到了

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;using UnityEngine.Networking;
using UnityEngine.UI;public class CsvData
{public string id;public string 
}public class CSVReader : MonoBehaviour
{// Start is called before the first frame updatepublic Text txt_value,txt_value1;void Start(){//这个 放在streamingAssets的反而没用---txt_value.text = "";string filePath =Application.streamingAssetsPath+"/Language1.csv";Debug.Log(filePath);StartCoroutine(ReadCSV(filePath));//Res的方式加载:打开文件Language1.csv,不用加后缀TextAsset EnemyDatas = Resources.Load<TextAsset>("Language1");string[] str_row = EnemyDatas.text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);//拿到所有行string[] value = str_row[str_row.Length-1].Split(',');//拆分到哪个txt_value1.text =value[0] + " " + value[1] + " " + value[2] + " " + value[3];}// Update is called once per framevoid Update(){}private StringBuilder stbLine = new StringBuilder();private IEnumerator ReadCSV(string path){UnityWebRequest www = UnityWebRequest.Get(path);yield return www.SendWebRequest();if (www.result != UnityWebRequest.Result.Success){Debug.LogError("Error: " + www.error);}else{Debug.Log("下载完毕:"+www.downloadHandler.text);string[] lines = www.downloadHandler.text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);foreach (string line in lines){//Debug.Log(line);string[] values = line.Split(',');stbLine.Clear();stbLine.Append(values[0] + " " + values[1] + " " + values[2] + " " + values[3]);Debug.Log(stbLine);txt_value.text += stbLine.ToString() + "\n";foreach (string value in values){//Debug.Log(value);}}}}
}

关键字:公司基本介绍模版_小程序制作方法_天津网站建设技术外包_百度提升排名

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: