How to collaberate with someone while working at the same time unity

i cant find a way to collaborate with my partner so we can work at the same time. if any one of you guys can help that will be amazing

The basis would be using some type of version control. Incidentally for some time Unity had one that had “collab” or “collaborate” in its name. If you’re fine with it you might go with the builtin Unity-based solution (which means you’re storing your project on Unity’s servers).
I never tried that since I’m firmly based in using git for version control (using it at work on other types of projects for years now).
You can do the same with git, but some things need a bit of attention in order not to get entangled into merge conflicts.
Also to be aware of is that using a service like github, gitlab, bitbucket, or similar, there usually are some limitation on the size of projects and how large a single commit can be.

Things you should setup for your project repository:

  1. A .gitignore file (which is a filter list of things you don’t want to add into the repository). If you use github you can easily select a template when you create your project.
  2. Configure git lfs for the project. This mans “large file storage” and will save some types of files (like audio files or large images) separately from your other project files. It is optimized for this kind of data.

For working together in the same project, some things to keep in mind is that while git is good at tracking changes in a text file (as the scripts are), the way Unity makes changes for some asset files (scenes and prefabs for example) are a bit more difficult to track. This asset data is stored in a textual representation but small changes in a scene can still result in a lot of changes to the file that one might not expect. And if there are changes from two sides, the automated merging algorithms that git uses for code can easily break.

Therefore:

  • Create prefabs of what you have in your scene, and make changes primarily within the prefabs. Ideally a scene is built by placing prefabs and setting up some scene-specific values in the inspector.
  • Don’t work on the same prefab or scene at the same time. Create sandbox scenes for each of you and build stuff inside them, then move the assets into a prefab and only add the prefab into a scene that actually goes into the game when you build it.
  • Project reorganizations are a bit tricky and need extra care.
    • To each asset file Unity keeps a .meta companion file.
    • When you move files inside of Unity, git might lose track of which file was which, so in the next commit it might think “Foo.prefab” and “Foo.prefab.meta” were deleted, and “Bar.prefab” and “Bar.prefab.meta” are all-new files, while all you did was rename it from “Foo” to “Bar”.
    • Alternatively one can do it in git, but then one has to be careful to always move or rename the .meta file along with the asset file. Otherwise Unity loses track of the asset being the same and will generate a new .meta file. This would break connections from other objects to that asset (when you assigned that Foo.prefab to some spawner script it won’t have it anymore (and the inspector might show a message about a missing asset instead). And for some asset types the .meta file stores config data (for example for audio or image files that would have no room for the import settings) and those would get lost when Unity generates a new .meta (and Unity might delete the old .meta file since there is no asset file to go with it anymore).
    • Do not change the content of asset files when you reorganize them. Make separate commits with one only being for moving files around (adding new directories is ok, just create them first in Unity so they get their .meta file generated, before you switch over to Git Kraken, GitHub Desktop, or whatever application you use for dealing with git).

Before you start with a “real” project, I recommend making one sandbox project for testing out the workflows involved, so you could always throw it away and start over. :wink:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms