Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

Source Control for Unity

starting to play around with unity working on a small project of my own using the stuff we learned in the How to make a video Game course but was wondering how to use some sort of source control.

i can navigate to: Edit > Project Settings > Editor and there is a version control field there but beyond this point i don't know what to do.

:-D

4 Answers

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi Dan,

Version control in Unity can be tricky, because you're not only dealing with code; there's also binary data like asset files.

That said, Unity offers several options, but you will need either a Team License or Unity Pro to integrate with version control systems like Perforce or Plastic SCM.

If you're working alone, you can do what I do: I keep my entire project directory nested inside of my Dropbox folder, and then my Scripts folder is a Git repository. Once a month I'll make a physical backup as well. So far this has worked pretty well for me, since for binary assets, I tend to save off multiple versions as I work (like 3D models for example). If you do go this route, make sure you turn off Dropbox before opening Unity, and then re-enable Dropbox after you close Unity. Sometimes when Unity is importing assets into its internal database, or when it's creating a build, there can be conflicts with Dropbox.

Russell Cousineau I just use Github's own .gitignore for Unity. You can download it from here https://github.com/github/gitignore

Ah thanks!

Thanks Nick i will have a look at your Dropbox suggestion.

We (company I do work for) do actually successfully use Github for large Unity projects and they have a template .gitignore for Unity projects. (I've personally used Dropbox too for my own Unity projects although I set it up as remote repo so I don't need to worry about switching off Dropbox to open the project, my Unity projects are always stored locally outside of Dropbox folder as well as Asset Server which is a pain and expense to get and set up). I wouldn't be too afraid of something like Git+Github unless you have gigantic models etc. We've used it with actually fewer issues than Unity's own Asset Server.

Nick Pettit
Nick Pettit
Treehouse Teacher

That's really interesting. In my primary project I have several GB of textures and I've been using the repo for a few years, so I can't imagine performance would be very good in my case. Then again, I've never stress tested it.

Would you mind sharing your .gitignore?