- Home /
Sharing tools across multiple projects
Hello, we have in my team several tools that we use simultaneously across projects that are in development. Every time we make a change to one of this tools we need to update it in all the other projects. Is there a known way to share files across projects so when we change one it changes in all the other projects? Its impossible the use asset bundles because you cant update scripts this way. I will really appreciate any help and will update here if I find a solution.
Answer by HD30 · Mar 25, 2018 at 09:25 AM
Update: I will write here the solution I found in hope that people will stumble upon this post in the future.
What we ended up using is SubModules in git. Very easy to do if you are using SourceTree. https://blog.sourcetreeapp.com/2012/02/01/using-submodules-and-subrepositories/
I created a main project with the tools i wanted and pused it to a repository. Then in the other projects I added the Tools repository as a submodule. What this solution gives me is that every time i commit new changes to the tools (in any of the projects) I can push it and it updates in all the other projects. This can happen in any of the projects using the tools, so you dont even have to mess with original tools project other then the initial setup. Make sure to only push your tools folder from the main project assets folder and not all the other unity related files so you wont mess your projects when pulling from the submodule repository.
This is the best solution we found after attempting a few. It requires careful setup but when its working correctly it's great.
Hope this helps! :)
Answer by Harinezumi · Mar 21, 2018 at 02:26 PM
This is a very valid and important question, I wonder why there isn't more information how to handle this. There are a few approaches that you can try.
The simplest approach that comes to my mind is compiling tools into .dll(s), and sharing those in the team. This will be self-encapsulated, easy to share, but sharing will be manual and will lack the flexibility to easily modify the tools.
The next idea that comes to my mind is - if you are using git for version control - to embed a repository within your project, e.g. in Assets/Tools/ folder, and put all the tools in that separate repository (or multiple ones). This way you will notice if a tool is not of the latest version so you can automatically update, will be easy to share among the team, and you will also have access to the source of the tools. However, it is more complicated to set up, and working on the tools in parallel is more complicated (you will probably need to resolve change conflicts).
You can also do the above embedding with hard-linking a shared folder (on Windows, check out the command mklink /j
), but it will lack version control and anytime something is modified everyone else will also have to reimport it. So I do not recommend it.
These are the ideas from the top of my head, probably there are more ways.
Answer by Baktillus · Mar 21, 2018 at 01:29 PM
If nothing else you could export the tools as unitypackage and import them into the other projects. Maybe that's too tedious for your usecase though