Sharing Files between Unity Projects

An annoyance for new Unity users is the inability to link to folders outside of the Project Directory.

Scripts, graphics, sfx that you want to share between projects suddenly needs to be duplicated every time you create a new project.

You may have a Logo graphic that you want to be uniform between projects, update it in one place, update it for all.

But Unity doesn’t let you do this!

So how can I fix this?

I’m sure you’ve heard of Shortcuts and Aliases, but what about SymLinks?

Basically think of a SymLink as a portal to another directory. Rather than a Shortcut which simply takes you to the linked directory, a SymLink IS the linked Directory, just referenced from another place.

This tricks Unity into thinking that the folder is inside the project folder, so it treats it as if it actually is!

So with a SymLink you can now Share Folders between projects and have Common Directories for useful scripts and scenes!

So how do I set this up?

This is a guide for setting up a SymLink to work with Unity on OS X, for Windows check out google.

Open Terminal

Navigate to your Project’s Asset Folder. note* It is important you create the Symbolic link from inside your Assets folder or it may not work properly!

cd ~/Documents/Unity/MyProject/Assets

You can then create a SymLink to a shared folder

ln -s ../../mkCodeBase/ mkCodeBase_Sym

let me break that down:

Make Symbolic Link:

ln -s

Source Folder:

../../mkCodeBase/

This means go back two directories, then link into my Shared Directory.

Link Name:

mkCodeBase_Sym

Remember, if you are having trouble finding the right directories, use autocomplete (press tab) to finish the directory names for you.

Comments

comments

Categories: CodeSnippet, Development