1. 新建一个txt文档,加入你想要的内容 再把编码换成UTF-8的编码方式 如图:
2.我们再把我们保存好的txt文档放入unity工程当中。添加如下代码:
- using UnityEngine;
- using System.Collections;
-
- public class ReadTxt : MonoBehaviour {
-
- //这个变量就是我们用来存放我们的txt的.
- public TextAsset testTxt;
- // Use this for initialization
- void Start () {
-
- }
-
- // Update is called once per frame
- void Update () {
-
- }
-
- void OnGUI()
- {
- //显示出来
- GUILayout.Label(testTxt.text);
- }
- }
复制代码3.效果如下图:
来源:
http://www.cnblogs.com/hejianchun/articles/3065491.html
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。