其他分享
首页 > 其他分享> > 读写txt到hololens文件系统中

读写txt到hololens文件系统中

作者:互联网

读写txt到hololens文件系统中 具体路径为 User Folders \ LocalAppData \ 相应app文件夹 \ LocalState
通过windows device portal 可以删除并上传新的txt文件,这里也可进行读取。

using UnityEngine;
using System;
using System.IO;
using System.Text;
using UnityEngine.UI;

public class ReadWriteToFile : MonoBehaviour
{
	public Text debugText;
	void Start()
	{
		string path = Application.persistentDataPath +@"\MyTest.txt";
		if(!File.Exists(path))
		{
			string createText = "Hello" + Environment.NewLine;
			File.WriteAllText(path,createText,Encoding.UTF8);
		}
		string readText = File.ReadAllText(path);
		if(debugText)debugText.text = readText;
	}
}

参考:
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.readalltext?view=netframework-4.7.2

标签:string,hololens,读写,System,File,path,using,txt
来源: https://blog.csdn.net/weixin_42261356/article/details/109989043