- Home /
Do you need to close Unity to stage files in SourceTree?
I've noticed that when I try staging while Unity is still open, there are a bunch of files that make the staging process very slow. If I close unity, a lot of the previous files are gone, which makes the staging a lot faster. Do I need to stage the files that disappear when I close Unity? or should I just keep closing Unity every time I want to commit some changes?
Thanks!
Answer by Nerull22 · Sep 02, 2016 at 03:01 PM
It sounds like you're trying to source control some files that you do not need to. I have used SourceTree in the past with Unity and have not had a problem with staging while Unity remains open. If you have files appearing and disappearing when you open and close Unity it sounds like you're not ignoring the temp folder. The temp folder does not need to be in your source control and honestly shouldn't be in your source control. Below is a site that I use for generating .gitignore files from time to time.
If you enter in what tools you're using it will generate a .gitignore file for you. It's not always super great if you're adding multiple tool sets, but you should be fine with just the Unity one. Just Unity .gitignore file is listed below. Stage and commit the .gitignore file and those appearing and disappearing files should not be present anymore.
https://www.gitignore.io/api/unity
If this didn't help, let us know so we can try to narrow down the problem.
Worked like a charm, thanks a lot! Its probably worth to mention that for the gitignore file to work you need to go to Edit--> project settings--> editor and change the version control mode to "visible meta files" and the asset serialization mode to "Force text".
Thanks again!
Answer by guneyozsan · Feb 18, 2017 at 03:23 AM
Yes you need to close Unity. The Unity lock file will also prevent you from commiting while it is open.
For Unity 5, you can safely ignore "Library" and "Temp" folders.