Programming in VRChat

VRChat でのプログラミングについて調べたことの書き溜め

ローカルテストをデスクトップモードで行う(vrchat-launcher)

Lang: English

f:id:naqtn:20190611090056p:plain

概要

VRChat のローカルテストをデスクトップモードで起動できるようにするツールを作りました。ついでに単体で使用した際に開始前にワールドをメニューから選択できる機能を実装しました。

はじめに

先日の VRChat SDK のアップデート(VRCSDK-2018.01.26.13.13)で試作中のデータをサーバにアップロードせずに、手元のマシンに置いた状態でテストできるようになりました。(ログインは必要で完全にオフラインで動作するわけではない)(リリースノート "Local testing has been fixed" の項。この書き方からするとある時から壊れていた?)

アップロードの時間が削減されてさっと確認できるようになり便利になりましたが、必ずVRモードで起動するので少々不便なこともあります。(ちょっとした変更を確認したい時に HMD を装着してコントローラを手にするのはやっぱり億劫)そこでデスクトップモードでも起動できるようにするツールを作りました。

ついでに、このツールを Unity 経由でなく Windows エクスプローラから起動した時に、VRChat が起動する前に接続するワールドを選択できる機能を実装してみました。

インストール

  1. vrchat-launcher.vbs をダウンロードして任意の場所に置く。
  2. Unity menu > VRChat SDK > Settings を開く
  3. "VRChat client" の項の "Edit" ボタンを押し、ファイル選択画面を表示する。
  4. 画面右下の exe(*.exe) という表示フィルタ設定を All files(*.*) にする
  5. ステップ1で置いたファイルを選択する。

f:id:naqtn:20190611090118p:plain

機能・設定

  • VRChat SDK の Build Control Panel でローカルテストを開始する(「Test」の下にある「Last Build」「New Build」を押す)と、このツールの機能により、VRChat クライアントがデスクトップモードで起動する。
    • (ちなみに「New Build」は Unity での編集状態を新たに見れるようにする、 「Last Build」は最後に「New Build」した結果をそのまま表示する、という動作をする。)
  • vrchat-launcher.vbs ファイルを Windows Explorer でダブルクリックする
    • ワールドの一覧が表示されるので、キーボードで数値を入力して選択する(数字+リターン)。選択したワールドに降り立つ事が出来る。
    • 「0」 (ゼロ)を選択すると VR モードとデスクトップ・モードの選択が可能(トグル選択)
    • ワールドの一覧は vrchat-launcher.vbs に書かれているので、好きなワールドを加えることができる。(world の名前と id を調べて、テキストエディタvrchat-launcher.vbs を編集する)
  • VR モードとデスクトップ・モードの初期選択は vrchat-launcher.vbsstartWithVR を書き換えることで選択可能。
    • 配布状態では false になっていてデスクトップ・モードで起動する。true にすると VR モード起動する。
    • ただしこれは VRChat SDK から起動した場合と Windows Explorer で起動した場合の両方に共通の初期設定。
      • 別の値にしたい場合は vrchat-launcher.vbs をコピーして別設定のファイルを作って運用する。
  • vrchat-launcher.vbs 中の confirmMode を true にすると、 この VR モードの選択を VRChat SDK から起動する際にも行えるようになる。
    • 毎回選択しないと始まらないというデメリットはある。
  • もし Windows Explorer でダブルクリックした時にも VRChat が起動しない場合、 ' GetInstallPath = "C:\Program Files (x86)\Steam\steamapps\common\VRChat" の部分を VRChat をインストールしている場所(VRChat.exe ファイルがあるフォルダ)に書き換えて、先頭の引用符「'」を取り除いてみてください。(報告いただけますと幸いです。)

f:id:naqtn:20190611090152p:plain

アンインストール

  1. インストール作業と同様にファイル選択画面を表示する。
  2. キャンセルボタンを押す。
  3. 不要ならば vrchat-launcher.vbs ファイルを消す。

メモ

  • VRChat 界隈はハッキング行為でごたついていることもあり、安心して利用できるよう、ファイルの中身を誰でも簡単に確認できる VBScript で実装しました。

履歴

  • 2018/2/7 VRChat のインストール先をレジストリから読むように変更。vrchatInstallFolder 変数は廃止
  • 2019/6/11 レジストリからの読み込みが意図せず無効化されていたのを復活。上手くいかない場合の対処についてドキュメント

A tool to launch VRChat client in desktop mode for local testing (VRChat launcher)

  • I made a small tool to use desktop mode while local testing.
  • When invoked from Windows Explorer, It shows world selection menu to allow you seleting a world before starting VRChat client.

Install

  1. Download vrchat-launcher.vbs
  2. Open VRChat SDK Settings window (Unity menu > VRChat SDK > Settings)
  3. Press "Edit" button to client file selection dialog.
  4. Change file name filter (at right bottom of the window) exe(*.exe) to All files(*.*)
  5. Select vrchat-launcher.vbs file (located step 1)

Functions and configurations

  • When local testing started (from VRChat SDK "Last Build" or "New Build" button under "Test" section), VRChat client work in desktop mode.
  • When vrchat-launcher.vbs is started from Windows Explorer, It shows world selection menu.
    • The list is witten in vrchat-launcher.vbs. It' plain text, so you can edit it.
    • If you enter zero (and return) , it toggles VR/desktop mode selection.
  • Default VR/desktop mode is written as startWithVR in the file. Change it if you want.
  • If you change confirmMode to true, you can change VR/desktop mode when local testing invocation.
  • If VRChat doesn't start even if from Windows Explorer, try to edit this part ' GetInstallPath = "C:\Program Files (x86)\Steam\steamapps\common\VRChat" pointing where you install VRChat (the folder where VRChat.exe file exists) and remove heading quotation mark (').

Uninstall

  1. like install step, show file selection dialog.
  2. Press cancel button.
  3. Delete vrchat-launcher.vbs if you want to do so.

note

  • Because of hacking tool issue, I made this tool with VBScript so that anybody can checks its internal code.
  • If you encounter Windows "unknown publisher security warning" you can suppress it by editting vrchat-launcher.vbs file to be your own. (It's plain text file.)