Using Git with 3D Games

Git can work fine with 3D Games out of the box. However the main caveat here is that versioning large (>5MB) media files can be a problem over the long term as your commit history bloats. We have solved this potential issue in our projects by only versioning the binary asset when it is considered final. Our 3D artists use Dropbox to work on WIP assets, both for the reason above and because its much faster and simpler (Not many artists will actively want to use Git!).

Git Workflow

Your git workflow is very much something you need to decide for yourself given your own experiences as a team and how you work together. However. I would strongly recommend the appropriately named Git Flow methodology as described by the original author here.

I won’t go into too much depth here on how the methodology works as the author describes it perfectly and in quite few words too so its easy to get through. I have been using with my team for awhile now and its the best workflow we’ve tried so far.

Git GUI Client Application

This is really personal preference here as there are quite a few options in terms of Git GUI or whether to use a GUI at all. But I would like to suggest the free SourceTree application as it plugs in perfectly with the Git Flow extension. Read the SourceTree tutorial here on implementing the Git Flow methodology in their application.

Unity3D Ignore Folders

Place the following into a .gitignore file within your Unity project folder.

# =============== #
# Unity generated #
# =============== #
Temp/
Library/

# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
ExportedObj/
obj/
*.svd
*.userprefs
/*.csproj
*.pidb
*.suo
/*.sln
*.user
*.unityproj
*.booproj

# ============ #
# OS generated #
# ============ #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

Unity3D Settings

  1. Switch to Visible Meta Files in Edit → Project Settings → Editor → Version Control Mode.
  2. Switch to Force Text in Edit → Project Settings → Editor → Asset Serialization Mode.
  3. Save the scene and project from File menu.

Posted

in

, ,

by

Comments

7 responses to “Using Git with 3D Games”

  1. Thanks for these insights!

    If I may ask – with the option to force the asset serialization mode to text (available now even in Unity Free), is it still somehow advantageous to use the Dropbox for assets? As the assets will be in text form, they shouldn’t bloat git anymore, if I understand it correctly.

    We’re just starting a new project and being complete Unity newbies, I have a hard time deciding whether I should set the project with assets being in Dropbox or just use Git for everything.

    Thanks in advance for your time!

    1. Scott Richmond

      You will still have binary assets such and texture and audio files. You might be able to get away with it in a reasonably small project by just using Git. But we found it very quickly started to explode the size of the repository. Finally, our artists really didn’t want to use Git for WIP stuff as it took too long to manage.

      1. Ah, now I understand!

        Allright, so we’ll set up Dropbox/Copy/similar and add a sync button to Unity to pull new assets from Dropbox, and another button to push new local assets to Dropbox (because I feel that having Dropbox folder and Unity Assets folder linked with mklink can be detrimental somehow).

        Thank you again!

  2. When you install Sourcetree, do you usually use a global ignore file? Also, what do yo usually include in your .gitignore when using Unity?

    1. Scott Richmond

      I have just updated my post with some more recent information, so take a look. I use the config pasted in my post as a .gitignore file placed within the Unity project folder. I don’t typically use a global ignore file in my git repositories if I can help it.

      1. Thx for the quick reply! Any reason why you’re not ignoring some of the files suggested here? https://github.com/github/gitignore/blob/master/Unity.gitignore

        1. Scott Richmond

          No particular reason. Feel free to add any more you think you need. This list works well for us however.

Leave a Reply

Your email address will not be published. Required fields are marked *