Fast Platform Switching in Unity

Multi platform titles in Unity are a bit of a pain due to the amount of time it can take to switch from one Platform to another (especially iOS). Unfortunately, Unity’s cache server is fairly expensive as it requires purchasing an Asset Server license and lets face it, Asset Server leaves a lot to be desired for a source control solution.┬áChecking out multiple projects is an option, but makes it a bit more work to test changes across multiple platforms. Fortunately there is a very simple solution to this problem, filesystem junctions.

Lets say we have a project checked out in “/Projects/GameWindows”, create the folder “/Projects/GameAndroid”, then open a command line prompt in this directory to make a file system link like so:

mklink /j Assets ../GameWindows/Assets
mklink /j ProjectSettings ../GameWindows/ProjectSettings

Open the project at your newly created and linked directory and switch to the Android platform. All your assets and settings will now be linked across both workspaces, but the platform specific data in Library remains unique to each workspace. Switching from one platform to the other is now as simple as switching projects, you won’t have to reimport the entire library every time you do this, only the assets that have changed since you last opened the workspace. It is even possible to have both locations opened at the same time, generally Unity will notify you when an a shared asset has changed and reimport the asset with no issues.

This approach is also great for multiplayer testing.

Note: Deleting a linked folder in Explorer WILL NOT delete the target folder.

7 thoughts on “Fast Platform Switching in Unity

  1. Liszto

    There is a way to do this with a MAC ?I try with : “ln -s” cause with Unix it works (I tought ) but with MAC it seems to be only a link for finder and not for the OS..

    If someone have an idea about this ?

    Reply
    1. admin Post author

      Unfortunately unity does not read through soft links, I had though that maybe they changed this recently, but as you indicated it appears they have not. However, there is still a way to do this on Mac, you simply need to use hard linking instead of soft linking. While OSX does not support hard linking out of the box since about OSX 10.6 it is very easy to add this functionality back in.

      https://github.com/selkhateeb/hardlink

      This is a very simple project which provides a hard link command line utility in OSX.

      Reply
    1. admin Post author

      You can do this as many times as you want. Just create a new directory and link Assets and ProjectSetting for every platform you wish to support.

      Reply
  2. Pingback: Fast Platform Switching in Unity Made Easier : Deozaan's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *