Search Unity

Unity's version control component has been upgraded to Plastic SCM.

Collaborate and git - and do I need to re-import assets when cloning?

Discussion in 'Unity Collaborate' started by wheee09, Nov 22, 2019.

  1. wheee09

    wheee09

    Joined:
    May 21, 2018
    Posts:
    68
    Hi all,

    So, I have two questions - one specific and one general.

    I currently have a project setup with Github (+LFS). I think I used https://thoughtbot.com/blog/how-to-git-with-unity to set it up initially and it's been working well enough since. Now the big surprise was when I got my new MacBook Pro 16 (sweet beast of a machine) and went ahead with installing everything, cloning my repo and then firing up the project.

    I guess I shouldn't have been surprised but nothing compiled. After a bit of digging I realized that I had to re-import all of my assets from the store which seemed really odd to me given that all of the source/dlls/packages/so on were committed to the repo already. And during the re-importing of assets, it looked like even Unity recognized that files were already there.

    My question is... is this normal behaviour or is it perhaps because I'm git-ignoring something that I shouldn't be? How does Collaborate deal with project imports for the first time?

    And my general question is... from some of the skimming that I just did in this forum, it appears that Collaborate is moving towards using Git+LFS... is that correct?

    Appreciate any thoughts!
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @wheee09, thank you for your questions. I'm surprised that Unity didn't begin re-importing your assets after you finished pulling your repo from Github and opened your project for the first time. Were you building from the command line after you pulled your project or some different means other than building while the Editor is open? What compile errors did you see?

    Collaborate automatically imports all assets after the project is pulled from the Cloud. This is because the Library folder, which is ignored by Collaborate, needs to be rebuilt for faster referencing of models, Scenes and other assets. We ignore the Library folder because each machine compiles assets differently, which can cause inconsistencies between team members working on the same project, while also often doubling the project's repo size. This method is also recommended in Unity's Tips for using External Source Control Systems.

    As for Collaborate moving to Git+LFS, we haven't fully committed to that option just yet. We are in the process of reevaluating where we would like the Collaborate service to go, but moving the backend to Git+LFS is one of them. As soon as we finish weighing all options we will communicate our decision to everyone as soon as we have it, ideally before the end of the year. Thank you for your patience.
     
  3. wheee09

    wheee09

    Joined:
    May 21, 2018
    Posts:
    68
    (edit) misread your original question...

    After cloning my repo via git command line, I opened it via Unity Hub. I'm not sure if it tried to re-import . I can try it again and see what steps are taken when opening the project for the first time.

    Thanks to your reference about the /Library folder - something that I was not aware of... when I look at my project that's not compiling and compare it against my original machine, I see that there a bunch of dlls that are missing in the /Library/ScriptAssemblies - namely the Assembly-CSharp-* dlls and a host of other dlls for a number of assets which would explain why nothing works.

    I wonder... because the first error that shows up is for DOTween, and I think when I imported it from the Asset store initially, there was a bit of a "installation" process involved. And it's that installation process that is responsible for generating the DOTween dlls into the /Library/ScriptAssemblies directory. So perhaps Unity is not quite able to re-import something like that automatically on open.

    (2nd edit) So I recloned and opened it up, it's definitely importing assets and I think it's get stuck on the DOTween one above.


    That would make sense... does ignoring the Library folder have any impact or or prevent version locking of assets? By that I mean, say that you have an Asset that is committed to the repo and the Asset store has a newer version. And this newer version has made some breaking changes that you don't want to deal with just yet. Because the Asset is checked into the Assets directory, am I still able to clone the project on a new computer and still continue using the older version of the Asset?

    Great to hear. Thanks for the input!
     
    Last edited: Nov 23, 2019
  4. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    You're welcome for the help! Regarding the DOTween errors you're seeing, it's very possible that the asset might only initialize fully during the import process and doesn't check whether it needs to reinitialize each time the project is opened. That could explain why you needed to manually reimport your assets after copying down your repo.

    Ignoring the Library folder helps to save commit time and storage space since it's going to be rebuilt on each local machine. It's just meant to be a local cache and isn't required to be included in the repo for the project to be built. It just saves initial build time when first opening the project to keep that folder. With regards to the scenario you described, where there's a newer version of an Asset that you don't want to use, Unity should never auto-update any of your Assets from the Asset Store (unless they're set up on their own to do that) to the latest version without manual confirmation. You should be fine to continue using your older Asset after cloning the project to a new computer.