码迷,mamicode.com
首页 > 其他好文 > 详细

Hololens文件读写

时间:2016-11-29 22:24:14      阅读:422      评论:0      收藏:0      [点我收藏+]

标签:end   storage   win   string   tail   添加   命名空间   nbsp   工程   

unity 内勾选 RemovableStorage 选项或 Package.appxmanifest 勾选 可移动存储 选项

uwp app IO操作用StreamReader www 不适用,如:

 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类

 

参考资料:win10 UWP读写文件   

                   win10 uwp 读取文本GBK错误

                   Hololens开发初探踩的一些坑

                   

Hololens文件读写

标签:end   storage   win   string   tail   添加   命名空间   nbsp   工程   

原文地址:http://www.cnblogs.com/Zajanmy/p/6115317.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!