Working with YAMLMerge

Tutorial

·

advanced

·

+10XP

·

5 mins

·

(129)

Unity Technologies

Working with YAMLMerge

YAMLMerge (unityyamlmerge.exe) is a tool that is included with the Unity Editor and works with version control software to merge Scene and Prefab files. In this workflow, we’ll configure Git to use YAMLMerge.

Languages available:

1. Working with YAMLMerge

This tutorial has been verified using Unity 2019.4.12f1 LTS


YAMLMerge (unityyamlmerge.exe) is a tool that is included with the Unity Editor and works with version control software to merge Scene and Prefab files. In this workflow, we’ll configure Git to use YAMLMerge. If you’d like to configure a different tool for use with YAMLMerge, please see the Unity Manual. YAMLMerge can also be run directly from the command line.


2. Configuring Git to use YAMLMerge

1. Open your .gitconfig file. This is typically in your user/home directory.


2. At the end, type:


[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

3. The path to Unity will vary depending on your platform, version number, and whether you’ve installed Unity directly or through the hub.


3. Configuring your Unity project

1. From the Edit drop-down in the Unity Editor, select Project Settings.


2. Click on Editor.


3. Under Version Control, set Mode to Visible Meta Files if it’s not set already (Figure 01).


4. Set Asset Serialization to Force Text if it’s not set already (Figure 01).


Figure 01: With these settings, your project is now ready for version control.

Figure 01: With these settings, your project is now ready for version control.


4. Usage and advanced options

When there’s a merge conflict, open Git Bash and type: git mergetool.


When invoking YAMLMerge directly from the command line, you can specify which version of a file to keep by using -l or -r. You can also premerge by using the -p switch, and enable headless mode (suppress all error dialogs) by using -h. For more information on these options, invoke unityyamlmerge from the command line with no additional parameters.


5. Conclusion

This has been a brief introduction to YAMLMerge, a tool that is included with Unity to resolve merge conflicts when using version control with your projects.


Complete this tutorial