I'm having issues getting the UnityYAMLMerge tool to work, in order to fix conflicts merging a scene in 2 different branches (myBranch
into dev
). Here's what I've done:
Set Asset Serialization to Force Text: In Edit > Project Settings > Editor menu, I set Force Text under Asset Serialization Mode. This has been set for the entire lifetime of the project so all applicable git-tracked files should have this setting.
Treat the Files as Binary to Avoid Git Merging Them Automatically: created
.gitattributes
in project root dir with the following then pushed:
*.unity binary
*.prefab binary
*.asset binary
- Set up UnityYAMLMerge with Git: copypasted the following into
.git/config
:
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Tools/UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
Note: the Unity docs state that the UnityYAMLMerge.exe should exist at:
C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe
or
C:\Program Files (x86)\Unity\Editor\Data\Tools\UnityYAMLMerge.exe
However I do not have an Editor/
directory at either of these locations, and instead I found the executable at C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Tools/UnityYAMLMerge.exe
(2019.2.17f1 does match the version of Unity I'm building this project in).
However after all this, when I am in my branch dev
and try to merge my branch myBranch
into dev
, I still receive conflict warnings and am asked to manually fix them:
$ git merge myBranch
warning: Cannot merge binary files: Assets/Scenes/ManagerScene.unity (HEAD vs. myBranch)
warning: Cannot merge binary files: Assets/Scenes/2-Paint.unity (HEAD vs. myBranch)
warning: Cannot merge binary files: Assets/Resources/Prefabs/UI/Heatmap.prefab (HEAD vs. myBranch)
Auto-merging Assets/Scenes/ManagerScene.unity
CONFLICT (content): Merge conflict in Assets/Scenes/ManagerScene.unity
Auto-merging Assets/Scenes/2-Paint.unity
CONFLICT (content): Merge conflict in Assets/Scenes/2-Paint.unity
Auto-merging Assets/Resources/Prefabs/UI/Heatmap.prefab
CONFLICT (content): Merge conflict in Assets/Resources/Prefabs/UI/Heatmap.prefab
Automatic merge failed; fix conflicts and then commit the result.
From what I understand, the UnityYAMLMerge tool should automatically resolve these conflicts without causing git to prompt me to fix them. Is this correct? Otherwise, what else must I do to use this tool properly?
Thanks for any help!