- Asset Server の実体は PostgreSQL に Unity が一部手を入れたもの
- TCP ポートの 10733 番を使用
psql の Path はこちら。
OS | Path |
---|---|
Mac OS X | /Library/UnityAssetServer/bin/psql |
Windows | "%ProgramFiles%\Unity\AssetServer\bin\psql.exe" |
Linux | /opt/unity_asset_server/bin/psql |
psql で作成されているデータベースを確認。
OS | Path |
---|---|
Mac OS X | /Library/UnityAssetServer/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view' |
Windows | "%ProgramFiles%\Unity\AssetServer\bin\psql.exe" -U admin -h localhost -d postgres -c "select * from all_databases__view" |
Linux | /opt/unity_asset_server/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view' |
出力結果
databasename | projectname | description | version --------------+-------------+----------------------------+--------- test | Test | Created with Unity 4.6.2f1 | 2.0
この出力を見て分かる様にプロジェクト名は T が大文字の Test としているにも関わらず、データベース名は test と成っている事に注意が必要です。
例えば Jenkins の Unity Asset Server Plugin を使う場合に Database Instance には Test では無く、 test と指定する必要が有ります。
databasename が test なので test に接続。
psql -U admin -h localhost -d test
\d でテーブル一覧を確認。
List of relations Schema | Name | Type | Owner --------+------------------------+----------+---------- public | all_databases__view | view | unitysrv public | all_users__view | view | unitysrv public | asset | table | unitysrv public | asset_serial | sequence | unitysrv public | assetcontents | table | unitysrv public | assettype | table | unitysrv public | assettype_serial | sequence | unitysrv public | assetversion | table | unitysrv public | assetversion_serial | sequence | unitysrv public | changeset | table | unitysrv public | changeset_serial | sequence | unitysrv public | changesetcontents | table | unitysrv public | configuration__matview | view | unitysrv public | dirdiff_id | sequence | unitysrv public | maint_action_id | sequence | unitysrv public | person | table | unitysrv public | person_serial | sequence | unitysrv public | personroles | table | unitysrv public | reinheritance | table | unitysrv public | role | table | unitysrv public | role_serial | sequence | unitysrv public | stream | table | unitysrv public | variant | table | unitysrv public | variant_serial | sequence | unitysrv public | variantcontents | table | unitysrv public | variantinheritance | table | unitysrv
changeset 辺りが見るべきデータですかね? 以下のコマンドを実行。
select * from changeset;
コマンドラインから AssetServer のファイルを取得する
こんな感じで記述。
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -assetServerUpdate 127.0.0.1 Test nakamura test -projectPath ~/AssetServerUpdateTest
コマンド | 説明 |
---|---|
-quit | 処理が終わったら Unity を終了させる |
-batchmode | バッチモードで実行 |
127.0.0.1 | IPの指定。127.0.0.1:12345 の形式でポート番号を指定する事も可能 |
Test | Asset Server のプロジェクト名 |
nakamura | Asset Server に接続するユーザ名 |
test | Asset Server に接続するユーザのパスワード |
-projectPath | Asset Server から持ってきたファイルを取り込む Unity のプロジェクトフォルダを指定。 ブランクのフォルダや存在していないフォルダ(※もちろん、フォルダが作成可能なパスで有る必要あり)を指定する事も可能。 |
Unity - マニュアル: コマンドライン引数
http://docs.unity3d.com/ja/current/Manual/CommandLineArguments.html
上手く動かなかった場合には Editor ログを確認。
Unity - マニュアル: ログファイル
http://docs.unity3d.com/ja/current/Manual/LogFiles.html
自動起動
Mac の場合には自動起動は launchctl が使われています。
自動起動を解除する時は以下のコマンド。
launchctl unload /Library/LaunchDaemons/com.unity3d.assetserver.plist
再度、自動起動したい時は以下のコマンド。
launchctl load /Library/LaunchDaemons/com.unity3d.assetserver.plist
Tips
- Jenkins の Unity Asset Server Plugin は現時点(2015/03/06)では監視(ポーリング)機能のみしか提供されていない為、 Asset Server からファイルを持ってくる処理は別途、シェルなどを準備する必要が有ります。
- Jenkins のジョブで Asset Server からファイルを持ってくる時にファイルの数が大量で有った場合に Unity が例外を起こして落ちるという事がありました。ファイルの数によっては事前に手動でファイルの同期を1度行ってから Jenkins での有用に切り替えた方が良いかもしれません。
関連情報
Unity - マニュアル: Asset Server のセットアップ
http://docs.unity3d.com/ja/current/Manual/SettinguptheAssetServer.html
Asset Server の使い方(基本) - 強火で進め
http://d.hatena.ne.jp/nakamura001/20150305/1425556242