Let’s git started!
Setting up Unity for use with git
Today we’re going to look at how I set up git and, more specifically, how I set up git when I’m using it with Unity. Setting up git for use with Unity is fairly similar to how I would set up a new repository for a web or other software development project but there are a few steps where steps unique or specialized to the use of unity are required. Let’s dive in!
First, we need to verify that Unity is going to work in a manner that will synergize with git. There are a few settings inside the Unity editor that you will want to have set before involving git in the process.
The first setting will be to make the meta files that are generated with every file and folder you use in your project visible to git. This will help avoid broken file references when downloading the project from the version control server onto another computer or when changing between branches.
To do this, Open the Unity Editor and navigate to
Edit > Project Settings > Editor
in this window select the Version Control option from the left-hand side menu and then make sure that the Mode is set to “Visible Meta Files”
The second setting we will want to make will be to ensure that Unity writes files to disk in a format that can be easily stored and retrieved in git. This format also helps void having merge conflicts that cannot be resolved because they are in a format that cannot be compared easily in git.
To do this, in the Project Settings window, select Editor from the left-hand side menu and set the Asset Serialization Mode to “Force Text”.
After making these changes make sure to save them by going to
File > Save
That’s it for today. Tomorrow, we will begin looking at a couple of workflows for getting your git repositories setup and getting your Unity project added to it.