Working on unity project from multiple devices?
Is there any way to work on a project from multiple devices (not at the same time) and syncing the changes? I use a laptop to work on my game when I am not home but when I am I prefer to use my desktop. Is there a more convenient (and free) option apart from manually copying and importing the project between devices? Any help is greatly appreciated.
Answer by starr_stealer · Oct 12, 2016 at 08:33 PM
Update: I setup this blog post in response to this question, due to the nature of the complexity of the answer needed. https://github.com/SlagleSoft/Unity-Git-SCM-Example/blob/blog/unity-scm-tip/blog.md
Note: this actually applies for any "development" project, I will try to be brief about this subject, because it can go in great detail, esp if you haven't used Source Control before. More detail slightly falls out of context here.
You want to look into Source Control, I highly recommend Git, and the SourceTree UI App.
Git: https://git-scm.com/
SourceTree: https://www.sourcetreeapp.com/
GitHub: https://github.com/
BitBucket: https://bitbucket.org/
Github and Bitbucket are the two leading PAAS web solutions out there. Extremely quick to get setup, something to help you pick a solution. Github is free for open source projects (anyone can see them), while Bitbucket has free private projects (you say who can see it, up to 5 for free).
Now to target your question more specifically, Unity project "sharing".
First, you will want to make your Unity project source controllable, this means turning on visible Meta files, and force text format for Unity files.
Open your project in Unity, then
Goto: Edit -> Project Settings -> Editor
Set: Version Control -> Mode = Visible Meta Files
Set: Asset Serialization -> Mod = Force Text
These settings get you ready for base level Source Control for Unity projects. I say base level because this only handles Text based files. Other assets such as Images, Models, etc. Are still in Binary format. Git handles this "fine" normally, but for Larger files, ie Models, you need an extra layer on Git to handle them.
Git LFS: https://git-lfs.github.com/
Git LFS - Large File Storage. By installing this module, Git now handles Large binary files much better.
Now to breifly discuss taking this even further, fine grain control over how Git handles files. Features like these is why I recommend Git, other Source Control platforms offer them, but imo Git offers them in a nice uniform and easily understood way.
.gitignore file (no file name, just extension) This file goes in the projects root folder. It is used to "Ignore" files, ie they are not checked into Git. These are files only needed locally, and are either generated by the project or customized by the local user and don't apply to everyone working on the project.
Here is a base starting point for the Git Ignore file when using Unity: https://github.com/github/gitignore/blob/master/Unity.gitignore
.gitattributes file (no file name, just extension) This file goes in the projects root folder. It is used to inform Git how to handle files, often it handles them just fine, but never hurts to have insurance. How merges are handled is the main focus we take for Unity in this file. When using Git LFS (recommend it) we can apply a few extra values in this file.
Here as a base starting point for the Git Attributes file when using Unity with Git LFS: https://gist.github.com/nemotoo/b8a1c3a0f1225bb9231979f389fd4f3f
More info regarding Unity Source Control: https://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html
If you need any more details just ask, I am also willing to setup a public Github example Unity project to give you more of an idea if needed.
Edit: Alternate Solutions
I wanted to cover the subject just a little bit more, I mentioned Source Control (which is by far the best solution for any development project). Why is Source Control the best solution? Because it was meant for this type of task (more specifically sharing projects with multiple people). Source Control keeps a history of every change made in the file(s). Everything is stored locally as well as on a central server, the server is where everyone downloads the project and submits their changes to (and download others changes, sync changes, etc). Source Control helps handle Merge Conflicts when the same file(s) are changed by multiple people (or change sets, ie Branching). But I digress, getting off topic of the context of other solutions.
Source Control can be "scary" at first and seem overwhelmingly complex (it's not I promise). BUT, there are other ways to achieve a similar goal. Also note, if multiple people are working on the project, these solutions become even less valid.
Any software, service or anything of the like, built for "sharing" or "backing up" files could be used for working on a project from multiple devices. Anything as basic as FTP or Windows File Share, up to more indepth solutions such as Google Drive, Windows One Drive, Dropbox, etc. The idea is quite similar to Source Control, you have files locally, and you have files stored at a central server. Personally I wouldn't recommend any of these, as the risk of lost work is just too high (override the wrong file, there may not be an undo). I only mention these because I often find people fear change just a little too much to take on something like proper Source Control.
Thanks a lot for the answer! I think I will be going with git but one question, does it have access restrictions as to who can edit or see the project? Also, your answer was really helpful in customizing the unity project to support git but how would one actually set up source control with git in the first place?
Implementations of Source Control does indeed have access restrictions. Hopefully I'll have enough room to fill in the follow up question. I am going to assume you want this private (if not, similar steps for Github public). First create a free account with Bitbucket, once you login you will create a Organization and then a Project (pick GIT not mercurial). Now you need to install 3 things on your machines that you work from. https://git-scm.com/ https://git-lfs.github.com/ https://www.sourcetreeapp.com/ Open SourceTree when done, fill in your Bitbucket info. Go back to the Bitbucket website, then the Project you started, it will give you a repo clone URL, copy that. Go back to SourceTree and press "Clone/New" paste in the URL, set "Destination Path". You now have a local folder on your computer that is Git powered, copy your Unity project files into that folder (not Root itself, just whats inside). Go to SourceTree, double click the added project, goto File Status tab, click "Stage All", type in a message and press Commit, then on the top press "Push".
You can now go to any other device, and repeat the same steps (but adding the files), and be able to download them and work on the project as you normally would. Every time you make changes, you have to "Stage" the files, make a message and "Commit" and "Push". Once Pushed they are synced on the server.
Once you setup the Git & SourceTree the first time, to get the updates from the server "sync" press "Pull"
I am also going to put up a "blog" style How To that goes into full detail and have screenshots, I will add it to my answer.
Thank you so much for the help. I will try to implement source control as soon as I can. Last question (promise!), can I do exactly the same thing to allow my friend who is working with me on our game (as an artist/animator) to access the project and import images/create animations himself? Or do I need to do something extra? I don't $$anonymous$$d importing images or making animations myself but if there is an easier way, might as well take advantage of it.
Also, I think that a how-to guide on source control would be really helpful for people who want to use something like source control but have no idea how (like me). Add the guide as soon as you can!
I can't stress this enough, your answers were really helpful, thanks a lot :)
@Threadlight Here is the blog post I spoke about: https://github.com/SlagleSoft/Unity-Git-SC$$anonymous$$-Example/blob/blog/unity-scm-tip/blog.md
Your answer
Follow this Question
Related Questions
i can't find the gui textures tab 0 Answers
Help me I lost my project! 0 Answers
why cant i get into my project without the unity bug reporter stopping me 0 Answers
Unity teams trial 0 Answers
2 touch Destroy(gameObject); 2 Answers