UPMでUniVRMをインストールする

  • Unity 2019.4以降 が必要です。

  • Git client のインストールが必要です。

Unity 向けの git のインストール

Unity Manual Requirements を参照してください。

To use Git dependencies in a project, make sure the Git client is installed on your machine and that you have added the Git executable path to the PATH system environment variable.

未インストールだと

An error occurred while resolving packages: Project has invalid dependencies: com.vrmc.vrmshaders: No 'git' executable was found. Please install Git on your system then restart Unity and Unity Hub

というようなエラーが出ます。

他のgit

https://git-scm.com/ からインストールした git.exe (デフォルトは、 C:\Program Files\Git\cmd\git.exe) が、Path の中で最初に見つかるように設定してください。

  • powershell からバージョンを確認した例 (20201130)

> git --version
git version 2.29.2.windows.2

UnityPackageManager ウインドウによるインストール

../../_images/menu_packagemanager.jpg

UnityPackageManagerのWindow

../../_images/from_git.jpg

add package from git URL

新しいUniVRMバージョンがリリースされる時に、このバージョンに関連するgit urlsを公開します。

たとえば、v0.66.0 のgit urlは次のとおりです:

  • https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.66.0

  • https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.66.0 => VRMShaders に依存

  • https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.66.0 => UniGLTFとVRMShaders に依存

パッケージ同士の依存関係を自動でダウンロードしてくれる機能は無いので、以上の git url を順に追加してください。

ProjectウィンドウのPackagesフォルダにインポートしたパッケージを確認する:

../../_images/upm_package.jpg

バージョン番号を変更することで、お好きなバージョンに切り替えることができます。

packages/manifest.json 直接編集によるインストール

以下の内容を追記してください(v0.66.0の例)。

{
  "dependencies": {
    // ...
    "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.66.0",
    "com.vrmc.unigltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.66.0",
    "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.66.0",
    // ...
}

gitの特定コミットを指定する場合

dependencies に特定のコミットを指定します。

例:

{
  "dependencies": {
    // ...
    "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#39d54ce7d3b0061d2d9ee236017dca129c7cdc51",
    "com.vrmc.unigltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#39d54ce7d3b0061d2d9ee236017dca129c7cdc51",
    "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#39d54ce7d3b0061d2d9ee236017dca129c7cdc51",
    // ...
}