I have a number of scripts (helper classes, functions etc) that I’d like to use in many different projects.
Is there a better way to do it other than simply copy/paste ? (especially if I want changes in one project to update these files in all other projects)
NOTE: Unity itself warns - upon detection of a symlink folder - to “make sure you know what you’re doing”. See the following:
Assets/HelperScripts is a symbolic link. Using symlinks in Unity projects may cause your project to become corrupted if you create multiple references to the same asset, use recursive symlinks or use symlinks to share assets between projects used with different versions of Unity. Make sure you know what you are doing.
With the above warning in mind… You could try using symlinks. Basically, put the scripts you want shared amongst several projects in a folder not related to any of your projects, then create symbolic links from this folder to script-folders in each project you want to have access to these scripts.
Thus, when you update the scripts in the original (non-project-related) folder - or from within any open project that reference them, all your projects will receive the updated scripts. I tried this just now, and had changes done to a script in one project reflected in another project.
Basic example of creating a symlink from a source folder to two different projects on Windows:
mklink /D "C:\Projects\MyFirstProject\Assets\HelperScripts" "C:\Projects\SharedScriptFolder"
mklink /D "C:\Projects\MySecondProject\Assets\HelperScripts" "C:\Projects\SharedScriptFolder"
(HelperScripts folder would be the target “virtual” folder the scripts should show up in - which should not exist when you run the command - and SharedScriptFolder would be the source folder with the shared scripts,)