1

I've been facing my screen for more than 12 hours just because of so many problems, I have a Unity project that had a huge number of files (mostly because there are more than 3000 tiles) and bringing it to Git was a huge problem. I am admittingly only 13 yrs. old and I'm still beginning to understand Git

First: When I completely transfer my Huge filed project into a repo, using the same process, having to wait for a ludicrously huge amount of time, the folders inside the project (ex: Assets, Library, etc.) doesn't appear, only the files outside those folders like the csproj. files.

Second: I had to decide to only transfer the Assets folder. there were two choices, the 1st was to use git inside the project and "git add" the Assets folder, the disadvantage was that there was sometimes of file that would take a ludicrous amount of time to load. The 2nd was to use git inside of the Assets folder to "git add --all", the disadvantage was it won't be detected by my new package installed called Github for Unity https://assetstore.unity.com/packages/tools/version-control/github-for-unity-118069 and also not be detected by my IDE Jetbrains Rider.

Please I have been crying for half an hour and thinking of giving up my whole career on programming so if anyone that can answer please, it would be ludicrously grateful for your help. Thank You.

Fender Selim
  • 65
  • 1
  • 2
  • 8
  • 3
    I'm guessing, since you mention the Library folder that should never be committed to source control, that you don't have a `.gitignore` file. This one should help quite a bit. https://github.com/github/gitignore/blob/master/Unity.gitignore If you have a large project the first commit will take some time. You'll need to be patient. – Retired Ninja Aug 16 '21 at 11:14
  • 1
    additionally to the `.gitignore` you definitely also will want to use [Git LFS](https://git-lfs.github.com/) for the larger asset files. I suggest you also have a read [here](https://stackoverflow.com/questions/56267842/cleaning-up-and-migrating-existing-unity-project-into-new-one-or-another-pc/56267992#56267992) where I explained a bit more about what you want to keep and what you definitely do not want to keep in your version control – derHugo Aug 16 '21 at 12:45
  • Certain folders like 'Library' and 'temp' you don't need worry about copying over as Unity will re-create these files when you open your project again. Git can be a real pain, don't give up! It might be worth initialising a new repo in the location of your project, a git client such as github desktop can help massively with this – Jay Aug 16 '21 at 13:45
  • Ok i'll try to use this info, thanks. – Fender Selim Aug 16 '21 at 20:58

1 Answers1

0

While I had such a terrible experience in transferring my project to git, and also I did some research, here are my solutions:

  1. If you want to use plain git, like using GitHub to store your project, you should be careful. The first thing is that you should use .gitignore to choose which to ignore and which to commit, it's really important.
    However, you will encounter another fatal problem, when your project become more and more hug, I mean you have so many gameobjects in your scene, this condition can be more serious if you have a huge amount of 3D models, you will find that the scene file is terribly huge, and mine is nearly 8Gb. Then you found that you should need to solve the terrible compatibility of huge files in Git, using Git LFS to solve this, and you also need to expect that your supplier do not set a threshold in file size when transferring one single file to git server. Second, since you are using plain git, while so many files is handled and formated by Unity itself, and git cannot easily parses the file content correctly, which will lead to a result that each simple modification in your scene will make git reckon that this is a new file, although you might only change the name of a gameobject. The dire consequence of this operation is that your git repo will consume huge file storage (you will notice .git folder will consume a huge storage). When you want to share this repo with your friends, it will become a disaster.

So here comes the second solution, which I personally recommended.

  1. You can use the official version of git you solve your problem: Plastic SCM. Unity officially using this git supplier to control the versions. You can still use Plastic SCM as an alternative version control tool, (like it mentioned in comments, PlasticSCM is not based on Git, sorry for that.) It has the default .gitignore (in this case, we use ignore.conf to control ignores) so that you do not need to be bothered, like which I should upload and which not. At the same time, it can correctly analysis the right file type of each Unity generated files. So when you change a name of a gameobject in your scene and save it, the whole scene file will no longer be seen as a new file, the git only update one line in this file.

But to be mentioned, I recommend Plastic SCM as the way to control your version only because it can correctly analysis file types generated by Unity, it does not means it is perfect. I encounter some odd bugs when I use it, because it is only during beta test, but it is just another story.

Ember Xu
  • 344
  • 2
  • 9
  • 1
    [wiki](https://en.wikipedia.org/wiki/Plastic_SCM) says about Plastic SCM: "It is a full version control stack **not** based on Git" – bolov Aug 17 '21 at 11:40
  • @bolov Wow, thanks for your information, I was deluded by its features. – Ember Xu Aug 18 '21 at 01:10