Skip to content

Integrating Integrations in the Unity gitignore (vscode, Rider, FMOD, Blender) #4231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CaseyHofland
Copy link

@CaseyHofland CaseyHofland commented Jan 12, 2023

Reasons for making this change:
I'm Casey, a fourth year bachelor student at the HKU (Hogeschool Kunstacademie Utrecht) studying in Unity Development. Every now and again I help teams out with their github, and I see a lot of conflicts arise that could have been avoided, so I've been questing to improve the unity github experience for my peers and students to come. This PR is part of that initiative.

Important note on flexibility:
The commits for this gitignore have been designed with flexibility, or rather rebase, in mind. If some part of this ignore is rejected, let me know which commit specifically is the culprit so I can rebase it, remove it, and we can all forget it ever existed.

Links to documentation supporting these rule changes:
d8cafd2, 37bc450 have no source but are literally cache directories.
d4c81e8 taken from FMOD Unity Integration Using Source Control
682c73e What is a blend1 file and why do you (not) need them? blend1, blend2, blend3, etc. files are autosave backup files. If you have a habit of using blender in Unity, then you probably don't want to push all these files with your final result.

@CaseyHofland CaseyHofland marked this pull request as ready for review January 12, 2023 17:01
@CaseyHofland CaseyHofland changed the title Unity gitignore 2023 Making the Unity gitignore easier for students and beginners Jan 12, 2023
@Creator13
Copy link

I wouldn't put .idea and .vscode in there, as these folders can contain useful files like run/debug configurations or team-shared settings like code conventions. Experienced users will definitely want to keep these folders and will be scratching their heads when the editor-specific gitignores aren't working properly!

Something can be said for preventively including the Rider gitignore inside the Unity ignore, as many people use either ReSharper or Rider with Unity, but I guess it's safer to stick to convention and keep those in their separate ignores.

@NegInfinity
Copy link

I wouldn't put .idea and .vscode in there, as these folders can contain useful files like run/debug configurations or team-shared settings like code conventions. Experienced users will definitely want to keep these folders and will be scratching their heads when the editor-specific gitignores aren't working properly!

Something can be said for preventively including the Rider gitignore inside the Unity ignore, as many people use either ReSharper or Rider with Unity, but I guess it's safer to stick to convention and keep those in their separate ignores.

.vscode is something I always add to unity gitignore because it contains user configuration, and in case of unity the configuration depends on ABSOLUTE path to project library folder, which makes it useless in a team. In practice it is highly likely that people iwll end up stamping this sort of file with their local changes, cluttering the git history with junk.

I also made similar suggestion before.

#3810

Since a long time, developers have been able to use Visual Studio Code inside of Unity. I don't claim exactly to know how it works, but regardless its cache directory should be ignored, whether it is ever created or not (if not now, it might be in the future).
Idea is used by JetBrains (as to my understanding) and, as to my understanding, may in certain setups create cache directories. That's no good, these should be ignored.
There is really no reason to not include these by default. If you don't use FMOD, no harm done. But I've seen many teams fail to add this to their gitignore and getting unnecessary git conflicts that could have been easily avoided if this were in from the beginning.
Unity allows you to directly add Blender files in Unity. Even though this is not recommended practice, some teams still prefer it. For these teams, temporary blender files should be ignored.
@CaseyHofland
Copy link
Author

Removed 631b209 according to an earlier commit Unity: Remove exclusion for *.meta files.

Removed all the Global Gitignore additions based on general discussion in the Unity forums. Conclusion: these are by design meant to be in a Global gitignore (although I still think it's silly I have never heard of those before, are these really so underground?!)

Global Gitignore additions:

FMOD and Blender should in my opinion be added to the Unity gitignore as they have respected integration in the Unity software and, as is the point of this PR, may trip up beginners unnecessarily (especially the FMOD commit which may cause conflicts that should never have happened in the first place).

@CaseyHofland
Copy link
Author

Update:
As this initiative is taking shape I've relaxed the goal a bit from "No More Unnecessary Unity Conflicts" to "Less Unnecessary Unity Conflicts".

This is largely due to me learning about global gitignores (you'd think after 2 years that they'd have popped up somewhere but oh well) which put me in an awkward position - if it's by design that Windows / Mac / Linux files are ignored via a global gitignore, but no "student or beginner" will know about global gitignore then how to best approach? Leading me to the conclusion that perhaps maybe our school is to blame for our lack of source control knowledge more than I realized.

This PR still has in my opinion some valid additions to the Unity gitignore and will remain just as active, only with a different goal in mind.

@CaseyHofland CaseyHofland changed the title Making the Unity gitignore easier for students and beginners Integrating Integrations in the Unity gitignore (vscode, Rider, FMOD, Blender) Jan 15, 2023
@KumoKyaku
Copy link

My common configuration https://gist.github.com/KumoKyaku/5f9488ffa965a51c93163d3e0003fb1a
My common large file configuration https://gist.github.com/KumoKyaku/a095df526f245d4265c3af21eb2efb0d
Hope that helps.

@CaseyHofland
Copy link
Author

CaseyHofland commented Jan 23, 2023

My common configuration https://gist.github.com/KumoKyaku/5f9488ffa965a51c93163d3e0003fb1a My common large file configuration https://gist.github.com/KumoKyaku/a095df526f245d4265c3af21eb2efb0d Hope that helps.

Wow, there is obviously a lot of effort put into this, especially your lfs file! I have taken lines from it for my own personal use: there's a few file types I missed, where do you get this information?!

One trick you'll appreciate is something I do for some Unity specific files - instead of specifying how to merge in .gitattributes I use this:

# Collapse Unity-generated files on GitHub
*.asset linguist-generated
*.mat linguist-generated
*.meta linguist-generated
*.prefab linguist-generated
*.unity linguist-generated

Read the motivation for this here!

If you click the link and scroll up you'll also see the current .gitattributes I use.


Also, sorry for responding so late, we hit crunch time for our school project last week :P

EDIT:
I noticed an error in your file:

*.physicsMaterial* filter=lfs diff=lfs merge=unityyamlmerge -text

# Should be:
*.physicMaterial filter=lfs diff=lfs merge=unityyamlmerge -text
*.physicsMaterial2D filter=lfs diff=lfs merge=unityyamlmerge -text

Notice the 'missing' s for physicMaterial. For some reason these names are not consistent in 2D and 3D on this one particular type.

Copy link

github-actions bot commented Jun 8, 2025

This PR is stale because there have been no updates in 90 days. It will close after 180 days of inactivity. Leave a comment if you want to keep it open 😄

@github-actions github-actions bot added the stale label Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants