写入读取 TXT 文件
Posted on 2013 年 05 月 22 日 by U3d / Unity3D 脚本/插件/被围观 24 次
1. 在 Unity3D 中新建一个 javascript 名为为 file.js
2. 写入如下代码:
if (GUI.Button(Rect(10,10,100,50),“Write File”)) {
//fileName = Application.persistentDataPath + “/” + “test.txt”;
fileName = Application.dataPath + “/” + “test.txt”;
if (GUI.Button(Rect(10,110,100,50),“Read File”)) {
//fileName = Application.persistentDataPath + “/” + “test.txt”;
fileName = Application.dataPath + “/” + “test.txt”;Unity3D 教程手册
function WriteFile(filepathIncludingFileName : String)
fileWriter = File.CreateText(filepathIncludingFileName);
fileWriter.WriteLine(“Hello world”);
评论0
最新资源