Unity には意味的に正しい方法でシーンやプレハブのファイルをマージすることができる UnityYAMLMerge というツールが組み込まれています。このツールは、コマンドラインからアクセスでき、サードパーティのバージョン管理ソフトウェアも利用可能です。
Editor ウィンドウ (Edit> Project Settings の順に移動し、Editor カテゴリを選択) で、サードパーティ製のバージョン管理ツール (Perforce や PlasticSCM など) を選択することができます。これらのツールの 1 つが有効になっている場合、Version Control 見出しの下に Smart Merge メニューが表示されます。メニューには 4 つのオプションがあります。
UnityYAMLMerge ツールは、Unity editor が同梱されています。 Unity が標準の場所にインストールされていると仮定すると、UnityYAMLMerge へのパスは次のようになります。
C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe
または
C:\Program Files (x86)\Unity\Editor\Data\Tools\UnityYAMLMerge.exe
上は Windows用。
/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge
上は Mac OSX 用 (このフォルダーにアクセスするには、Finder から Show Package Contents コマンドを使用します)。
UnityYAMLMerge は、それがどのように未解決のコンフリクトまたは未知のファイルを続行するかを指定するデフォルトのフォールバックファイル( Tools フォルダーでも mergespecfile.txt と呼ばれます)が同梱されています。これはまた、ファイル拡張子に基づいて自動的にマージツールを選択しない(例えば、git のような)バージョン管理システムのための主要なマージツールとしてそれを使用することができます。もっとも一般的なツールは、すでにデフォルトで mergespecfile.txt にリストされていますが、新しいツールや変更オプションを追加するために、このファイルを編集することができます。
コマンドラインからスタンドアロンツールとして UnityYAMLMerge を実行することができます(引数なしでそれを実行すると、対応するすべての手順を参照することができます)。一般的なバージョン管理システム用のセットアップ命令を以下に示します。
.unity
と入力します。merge -p %b %1 %2 %r
と入力します。次に、.prefab
拡張子を加えるには、同じ手順にしたがってください。
.git
または .gitconfig
ファイルに次のテキストを追加します。
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = '<path to UnityYAMLMerge>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
.hgrc
ファイルに次のテキストを追加します。
[merge-patterns]
**.unity = unityyamlmerge
**.prefab = unityyamlmerge
[merge-tools]
unityyamlmerge.executable = <path to UnityYAMLMerge>
unityyamlmerge.args = merge -p --force $base $other $local $output
unityyamlmerge.checkprompt = True
unityyamlmerge.premerge = False
unityyamlmerge.binary = False
~/.subversion/config
ファイルに次の行を追加します。
[helpers]
merge-tool-cmd = <path to UnityYAMLMerge>
.unity
と入力します。 <path to UnityYAMLMerge> merge -p %base %theirs %mine %merged
次に、.prefab
拡張子を加えるには、同じ手順にしたがってください。
.unity
拡張子を追加します。 <path to UnityYAMLMerge> merge -p "@basefile" "@sourcefile" "@destinationfile" "@output"
次に、.prefab
拡張子を加えるには、同じ手順にしたがってください。
merge -p $BASE $REMOTE $LOCAL $MERGED
と入力します。Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.