Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have started working on a personal project using Unity with a friend and we've set up our own source control system.

I am aware of the fact that there are many types of files, namely those that are generated locally when you build (for example, Visual Studio files) and those that are specific to your particular machine that should not be added to source control, but I'm not exactly sure what these file types are.

I don't want to exclude any generated files I should be including, such as .meta files.

Would someone be able to list all, or at least all of the common file types that should not be added to version control, specifically for a Unity project?

share|improve this question

5 Answers 5

up vote 8 down vote accepted

With the current version of Unity, just check in anything in the Assets folder and ProjectSettings folder. Don't check in anything under Library, or at the top level.

share|improve this answer

A good reference for this kind of lists is GitHub's gitignore templates. The Unity-specific list is here.

And if you feel that something is missing, make a pull request!

share|improve this answer

The file type is less important that the file's purpose and origin; as you said, anything that can be generated from the source files under version control (usually) has no business being included in the repository itself.

Similarly, anything user-specific, such as settings or configuration files, should be excluded.

Beyond that it's really up to you and your project.

share|improve this answer
2  
I suppose what I'm asking for really, is a short list of which files in a standard unity project ARE the files that get generated or are user specific. Apart from the files that I manually create I'm fairly ignorant as to which do what and come from where. –  Asher Einhorn Aug 15 '12 at 16:26
    
I see. I edited your question to clarify that, as the Unity bit had been removed by the time I saw it (or I just missed it). –  Josh Petrie Aug 15 '12 at 16:39

You can take a look at my Unity project, Radius, on GitHub as an example. Or checkout the Unity.gitignore file in the official GitHub gitignore repo.

There is also a nice guide by Damien Mayance on his website about Git and Unity projects

Make sure you check in your .meta files as this is what Unity uses to reference each asset. You can make them unhidden in your OS by going to Edit->Project Settings->Editor and changing Version Control to Visible Meta Files.

If you are storing your unity project in a folder called UnityProjectName, this is what your .gitignore should look like. If you just have the Unity project folder as the root of the GitHub repo, just remove the UnityProjectName/ from each path below.

.gitignore

# Ignore unneeded Unity files
# --------------------------------------------------
UnityProjectName/Temp/
UnityProjectName/obj/
UnityProjectName/Library/

UnityProjectName/*.csproj
UnityProjectName/*.unityproj
UnityProjectName/*.sln

# Ignore Custom Builds
# --------------------------------------------------
UnityProjectName/[Bb]uilds/
share|improve this answer

I don't know about unity but you mentioned visual studio. There you can usually exclude the bin and obj folders in the project folders (in some project types, the bin folder also stores assemblies from included projects, but I think this only applies for certain type of web projects).

Also do not check in the ".csproj.user" and ".suo" files. Those two types include user settings. If you check those in, then all user settings will be reflected on the other machines, when you update the source. This is quite annoying, as those settings are not build or project relevant but more to configure the ui, editor etc for each developers individual needs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.