LoginSignup
2
0

More than 3 years have passed since last update.

HoloLens 2 のAppDataにテキストを書き込み、デバイスポータルでダウンロードする

Posted at

環境

  • Unity 2019.4.22f1
  • MixedRealityFeatureTool-1.0.2103.2- Beta
  • MRTK 2.6.0

概要

  • HoloLens 2でテキストファイルを書き込み、デバイスポータルでダウンロードする ss01.png

ss02.png

AppDataにテキストデータを保存するC#のコード

  • Application.persistentDataPath でパスを取得する
var path = Application.persistentDataPath + "\\my_file.txt";
using (StreamWriter sw = File.AppendText(path))
{
    string s = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
    sw.WriteLine(s);
}

保存先のパス

C:\Data\Users\{USER_NAME}\AppData\Local\Packages\{APP_NAME}_{ID}\LocalState

用途

  • アプリケーションの動作ログの保存(UnityのDebug.Logは、Debugビルドに時間がかかる&処理負荷が高い)
  • 設定ファイルの読み込み(デバイスポータルからアップロードしたファイルを、HoloLens 2 で読み込むこともできる)

github

https://github.com/hachicomb/HoloLens2WriteTextExample
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0