Referencing assets not physically located in MyProject/Assets

I have a collection of scripts that I import into every project I create. For argument’s sake, let’s say every time I alter MyScript.cs, I want those changes to be reflected in every project that has a MyScript in its Assets folder. In reality, when I make a change to one of these scripts, I often forget which project contained the edited version, or I have to merge two edited files by hand if I changed two different versions, etc. My other concern is data duplication - it seems really wasteful to have identical files in thirty different places.

My first thought was using a NTFS Junction Point concept within a project’s Assets folder, basically a pointer to another folder, but I’m not sure that’d work or be wise. Before I go down that road I thought I’d ask about alternatives. What do you guys do in this scenario? Besides “only edit cross-project files in a separate project and update them as a package,” as my goal is to find an alternative that takes less discipline and real-estate.

Any thoughts? Thanks!

Typically you can do things like this pretty easily with symlinks (well the junction point idea wouldn’t be very far away from this), i’m doing this using dropbox to keep some app settings, templates that require to be in a certain location (where just dropbox path, does not work), vim config and other things synced on all machines.
Doing this for ages and never had any issues.
-In theory- this should work with unity as well, but i haven’t actually tried this yet with assets for unity, so carefully test this first on some new project before you accidentally throw your existing stuff out of whack.

The way you do it is, create a source folder somewhere (if you need it across several machines, cloud services or a network drive works well).

Then on mac open a terminal and navigate to your unity project folder and

ln -s ~/path/to/source/folder myfoldername

On windows open a command window, navigate to your unity project folder and

mlink /D "myfoldername" C:\path\to\source

Since it’s just a link, any change on any project will change the files in the source (and across all others).

I’d try this first, it’s easy to setup.

Alternatively you could make a script i suppose, either outside or an editor script within unity to pull these in. But these have the downside of being copies, and you said you want to avoid this. Also with an external script you’d have to run it each time to sync.

I use git submodules for this. They’re kind of quirky but with the right workflow they work well.

Or if you’re not using version control at all yet then you could just start using it for these shared scripts, which will also help you track changes in the long term and resolve conflicts when you’ve modified the same scripts in several projects.

This might be too much discipline I guess, but version control is immensely valuable when you work with it properly.