There is some worry that this could muck up TimeMachine. Currently it seems that TimeMachine treats any hard links that are not its own as new files, so all linked files will be duplicated in time machine. I assume that as they are linked they will be restored properly overwriting themselves as they come down.
I am in the middle of setting up ten demo machines with our current build of the software so I am wrapped up, once I get a few moments I will fire up the Mac and tell you the exact command you need to create a symlink to a directory. Damn Mac users.
If you don’t find a solution for a link on the mac, you could also try mounting the the directory inside of your Project.
This gave me an Idea for a quick editor scripts, will post later, I am going to bed now.
You could also use git and git submodules to version control your shared projects in one git repository and use as a submodule in another… you don’t even need pro to version control scripts without too much trouble.
rstehwien: I’ve taken a few frontal assaults on GIT and I have an account on GitHub, but I have yet to figure out how to integrate this into a Unity project.
You can use git locally… one of the advantages of git is you don’t need a server like you do with subverison. GitHub (where I have many projects myself) is useful for sharing projects with the public (free) or a team (pay… unless you want it open source). I use git on my local machine for projects that will never be put on a server… just drives me crazy to not use source code control.
Here is a good book:
Setup instructions:
Section on submodules:
If I have some time later… I’ll get some unity specific instructions ready for using git. All my unity projects have been throw away… but I’m rapidly approaching real projects that will require the use of git. I have used git for my professional work outside of unity so I know it can work.
I haven’t had time to writeup instructions but here are two github projects I found (by the same person but there were others) that have instructions for using git submodules:
Was asked to follow up on this. I had forgotten that Unity on Mac OS X for whatever reason won’t see symlinks to directories. You have to create hardlinks to directories instead. Mac OS X won’t let you do that by default, even though the underlying DFS supports it. It’s how Time Machine works.
The above link clearly shows the only way to create a hard link to a directory on the Mac is to write some custom code and build it. It specifically has numerous scary warnings about trashing your file system if you use this. No thanks!
I can confirm that Unity 2.4 refuses to follow symlinks to directories on Mac OS X. It works fine on Windows machines. We have shared Editor, Plugins, and even various project-level Resources and Scripts directories. Works PERFECTLY on Windows (which is hard to make symlinks on).
I will make some hard-links now, but this is hard and potentially dangerous. How do I report a bug on this and request it get addressed?
Yeah, the Mac OS X solution is less than ideal, but it was the only way to fix it. I assume you mean 3.4 rather than 2.4. You can of course get around all of this nonsense by using version control on your source code, but it shouldn’t have to be that way.
TBH, I’m waiting to see how version control works in 3.5. This may make things easier. Not sure why Unity Mac doesn’t support aliases (soft link) by default, as they are a system feature. Could be a base architecture issue. I know some of the features I’d like to see (nested prefabs for instance) are on the road map, bit require fundamental changes in the architecture of the editor. Perhaps windows links work as the windows editor is relatively new compared with the Mac? Report it. Let’s see if we can get some mileage out of it.
Important: It will create the link “SharedAssets” in that directory, so if you already have a folder or file with that name, it will be overwritten.
Unity will throw a notice in the console saying essentially that you should be careful doing this. Which is good advice, if you delete/change any of the files in there, it will impact all your projects using that alias. (since there is only one set of files)
Be aware that Unity’s support for symlinks has fluctuated somewhat due to concerns that you could really mess things up if you are not careful, especially on the mac.
As of 4.2, symlinks are now supported on both the Mac and Windows platforms:
I just finished get this set up on my Mac; now, whenever Unity regains focus, it reimports every asset in the symlinked directories. The project is still small – so it only takes 20 seconds – but given how I bounce back and forth between Mono and Unity, even 20 seconds is intolerable. The assets are not changing; there are no “circular” symlinks; this only happens on Mac; Pcs are fine. Please help.
Steve
Edit: BTW, I just tried something; instead of linking to many (10 or so) directories, I just symlinked to the “parent-most” directory and the “always reimporting problem” went away. Although this is good news, it is NOT a solution. It is just a clue into how fix the bug – please fix the bug. I should have the option of “symlinking”’ any number of directories – not just one.
Edit2: I am now going to experiment with 2 symlinks and see what happens.
Edit3: The problem occurs if I have 2 or more symlinked directories – regardless of how many or few files are in those directories
If you believe this is a bug, then please submit a bug report.
I do not use, nor fully understand all of the ramifications of, sym-links. These are not limited to setting up the symlinks, circular links, confusing backup engines and potentially corrupting multiple projects at once by updating the shared folder(s).