Mixed Reality Toolkit 3 Setup(Unity Package Manager編)
Mixed Reality Toolkit 3のセットアップ方法としてUPMが使えるようになりました。
Mixed Reality Toolkit 3はOSSで提供されているUnity向けのUIフレームワークです。過去の経緯などは以下の記事で整理したことがあるので興味がある方は一読してみてください。
現在もOSSとして提供されているライブラリですが、そのセットアップ方法はこれまでは[Mixed Reality Feature Tool]というMicrosoft社製のUnityライブラリをセットアップするためのツールを利用していました。このツールは現在も利用することは可能です。一方でMicrosoft社はMixed Reality関連のサービスを順次終了させておりこのツールでセットアップできるライブラリも少なくなってきています。こういった背景があるかは不明ですが現在のMixed Reality Toolkit 3及びMicrosoft社が提供するライブラリ群がUPM経由でセットアップできるようになっています。今回はUPM経由でセットアップ方法について紹介します。
UPM経由でのセットアップ
今回はUnity 2022.3.36f1を利用しています。MRTK3をセットアップするためにはまずUnity Asset StoreからMRTK3および、Microsoft関連のライブラリを入手します。基本的には全て登録しておけばOKです。Microsoft関連のライブラリとしてはGraphics Toolのみ利用します。HoloLens 2での開発時にはOpenXR系や音声認識等のライブラリも利用することが可能です。
それぞれのAsset StoreのURLは以下の通りです。
Mixed Reality Toolkit 3
Microsoft Mixed Reality
UPMのインポートには順序がある模様
MRTK3を実際のプロジェクトに導入する際に注意点があります。MRTK3は機能単位でライブラリ化されており依存関係があります。このため導入時にはこれを意識してインポートする必要があります。インポート時に依存関係のあるライブラリが先にインポートされていない場合はエラーが表示されます。エラーメッセージの中に先にインストールすべきライブラリ名は通知されるのでそれに従って導入すればOKです。以下はMRTK UX Componentを最初にインポートしたときの例です。このようにエラーが表示されます。
依存関係は以下の通りなので使いたいライブラリをインポートする時は先に依存ライブラリからインポートするとエラーが出ずにセットアップが可能です。
表示名 | ライブラリ名 | 依存ライブラリ |
---|---|---|
MRTK Graphics Tool | com.microsoft.mrtk.graphicstools.unity | なし |
MRTK Audio Effects | org.mixedrealitytoolkit.audio | ・org.mixedrealitytoolkit.core |
MRTK Core Definitions | org.mixedrealitytoolkit.core | なし |
MRTK Diagnostics | org.mixedrealitytoolkit.diagnostics | ・org.mixedrealitytoolkit.core |
MRTK Extended Asset | org.mixedrealitytoolkit.extendedassets | ・org.mixedrealitytoolkit.standardassets |
MRTK Input | org.mixedrealitytoolkit.input | ・org.mixedrealitytoolkit.core ・com.microsoft.mrtk.graphicstools.unity |
MRTK Spatial Mqnipulation | org.mixedrealitytoolkit.spatialmanipulation | ・org.mixedrealitytoolkit.core ・org.mixedrealitytoolkit.uxcore |
MRTK Standard Asset | org.mixedrealitytoolkit.standardassets | ・com.microsoft.mrtk.graphicstools.unity |
MRTK Tools | org.mixedrealitytoolkit.tools | ・org.mixedrealitytoolkit.core |
MRTK UX Component | org.mixedrealitytoolkit.uxcomponents | ・org.mixedrealitytoolkit.uxcore ・com.microsoft.mrtk.graphicstools.unity ・org.mixedrealitytoolkit.standardassets ・org.mixedrealitytoolkit.spatialmanipulation |
MRTK UX Component(Non Canvas) | org.mixedrealitytoolkit.uxcomponents.noncanvas | ・org.mixedrealitytoolkit.uxcore ・org.mixedrealitytoolkit.standardassets ・org.mixedrealitytoolkit.spatialmanipulation |
MRTK UX Core Scripts | org.mixedrealitytoolkit.uxcore | ・org.mixedrealitytoolkit.core ・com.microsoft.mrtk.graphicstools.unity |
MRTK Windows Speech | org.mixedrealitytoolkit.windowsspeech | ・org.mixedrealitytoolkit.core ・com.microsoft.mrtk.tts.wndows |
MRTK Windows Text-to-Speech Plugin | com.microsoft.mrtk.tts.wndows | なし |
Discussion