Mac で HoloLens 用 UWP アプリをビルドする【Boot Camp】
はじめに
HoloLens アプリ開発は基本的に WindowsPC を使って行います。
しかし今回 Mac の Boot Camp を使って HoloLens 用アプリを開発してみました。
(探したところ Boot Camp での開発環境構築のサイトが見当たらなかったため)
結論から言えば、問題なくビルドできました!
一応手順を紹介したいと思います。自分へのメモも含めて。
動作環境
- MacBookPro 13-inch, 2017, Four Thunderbolt 3 Ports
使用するソフトウェア
手順
BootCamp を使って Windows をインストール
- Windows 10インストール用の iso ファイルをダウンロード ただし iso が入った USB メディアを買ってある人はこの手順は必要ありません。
- Boot Camp を使って Windows10 をインストール
ちなみに自分はWindows起動後にbootcampコントローラのインストールが失敗し wifi やら右クリックが使えなくなっていたため、以下のリンクから Windows サポートソフトウェアをインストールしなおしました。
support.apple.com
Windows サポートソフトウェアをインストールしたら無事に wifi が繋がりました。
また、Windows 用パーティションは最低 60GB は必要です。
ここを節約してしまうと後々困りますので注意してください。
Windows そのものに数十GB、Visual Studio にも約 20GB 使います。
自分は、Mac に 150GB、Windows に 100GB パーティションを区切りました。
開発者モードにしておく
Windows側、HoloLens側どちらも開発者モードにしましょう。
HoloLens のサンプルアプリをビルド
- HoloToolKit をダウンロードし Unity のプロジェクトに配置
DLはこちら - 適当なサンプルシーンを開き、UWP 向けにビルド
Windows10 SDK がインストールされていないとビルドが通りませんので注意。
しかし、以下のようなエラーが出ました。
Exception: Failed to locate env variables VS140COMNTOOLS or VS120COMNTOOLS. Utility.GetVSVersion () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/Utility.cs:623) MetroCSharpVisualStudioSolutionCreator.WriteSolutionFile (System.String solutionFileName, UnityEditor.Scripting.ScriptCompilation.ScriptAssembly[] csharpAssemblies) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/MetroCSharpVisualStudioSolutionCreator.cs:196) MetroCSharpVisualStudioSolutionCreator.CreateSolutionFileFrom () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/MetroCSharpVisualStudioSolutionCreator.cs:724) PostProcessWSA.CreateVisualStudioSolution () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWSA.cs:320) PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:237) UnityEditor.WSA.BuildPostprocessor.DoPostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:142) UnityEditor.WSA.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:149) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
これはVisual Studio 側の環境が整っていないのが問題らしいので次のステップに進みます。
Visual Studio 側の設定
- Visual Studio を起動
- ツール -> ツールと機能を取得
- ユニバーサル Windows プラットフォーム開発をインストール
再度ビルド
無事 Unity でビルドが通り、Visual Studio 用ソリューションファイルが生成されました!
あとは Visual Studio でコンパイルすれば HoloLens 上でアプリが動作します!
その他
リモートデスクトップ
HoloLens から リモートデスクトップアプリを使って BootCamp で起動した Windows10 に普通にリモートデスクトップ繋がりました。