Hololens文件读写
Posted zajanmy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hololens文件读写相关的知识,希望对你有一定的参考价值。
unity 内勾选 RemovableStorage 选项或 Package.appxmanifest 勾选 可移动存储 选项
uwp app IO操作用 StreamReader 会提示没有权限,如:
1 using UnityEngine;
2 using System.IO;
3 public class test : MonoBehaviour
4 {
5
6 void Start ()
7 {
8 string path = Path.Combine(Application.streamingAssetsPath, "test.txt");
9 StreamReader s = new StreamReader(path);
10 string end = s.ReadToEnd();
11 Debug.Log(end);
12 }
13
14 }
结果会报错,uwp应用的IO操作需要用到 StorageFile 类(导出uwp工程后添加 Windows.Storage 命名空间才能够使用StorageFile类),或者使用 File 类的静态方法,www 读取还没尝试过
参考资料:win10 UWP读写文件
以上是关于Hololens文件读写的主要内容,如果未能解决你的问题,请参考以下文章
Hololens 构建失败 - 命令 AssemblyConverter.exe 以代码 1 退出