

It’s also possible that Git’s merge algorithm ignores a true conflict, though less likely. For example, say a property was simply moved around, but its value was unchanged. Ideally Git could use UnityYAMLMerge during its initial conflict detection (during pull or merge commands) to avoid Git displaying a conflict when one may not truly exist. The original file can can be edited to specify a different fallback tool, but note that it will be overwritten if a new version of Unity is installed. There are several merge tools defined in this file (including P4Merge) and the first one that is found will be used. If it fails to resolve a conflict, it will launch a “fallback” tool specified in the file mergespecfile.txt located in the same folder as UnityYAMLMerge.

When pulling or merging new changes results in a conflict, git mergetool can be run to attempt to automatically (better) resolve the conflicts in scenes or prefabs using UnityYAMLMerge. To set a user name and email that will be used when committing changes:Ĭmd = 'C:/Program Files/Unity/Editor/Data/Tools/UnityYAMLMerge.exe' merge -p \"$BASE\" \"$REMOTE\" \"$LOCAL\" \"$MERGED\" Configuring Git User Settingsīefore creating or cloning a repository, it’s worth configuring a few user-specific settings for Git.
#Using p4merge with git full
This makes merging changes possible and allows Git to store changes as smaller deltas instead of a full copy of the file to save storage space. The Asset Serialization setting ensures that Unity stores its asset files as text instead of binary. The command-line Git client will still find these files, but making them visible will ensure that other clients don’t have issues finding them. meta files that Unity creates alongside all asset files and directories are not hidden on disk. The Version Control setting simply ensures that the. The following settings are the default in newer versions of Unity, but it’s still worth a quick check to make sure they’re configured correctly. There’s a minimal amount of configuration required when using Git in a Unity project.

#Using p4merge with git windows
Note: I’ll be using the Git command-line client (MinTTY) for Windows for the rest of the article. This article covers initializing a new project using Git with Large File Storage (LFS) to handle the substantial number of binary files required by game development. Using Git for version control in a Unity project requires a small amount of initial setup, but it can all be done quickly using the command-line client.
