September 22 2019

Multiple Unity Editor Instances Within a Project? I'm Sold!


Here’s one for you: you have a 500GB multiplayer project, how do you go about testing it in Multiple Unity Editor Instances? Here’s the solution.

I struggled with this problem in the past. The natural answer is to say: well, I’ll just open it again in Unity!

Looks like this project is already open

Nice try, buddy. The second, most common reaction is to say: Ok, I’ll just create multiple instances of my project!

There’s no enough space in drive Z

Multiply 500GB of Assets content by the number of players you want to test. Do you have that amount of free SSD space?

Chances are that you don’t.

If you do, please contact me for raising funds for my games.

But even if you did have so much space, let me ask you: do you really want to manually sync all your versioning repositories on every change that was pushed?

And, how sure are you that all your clients are running the exact same version?

I had these problems. And I solved them. Now I’ll share a solution with you.

Multiple Unity Editor Instances

The idea is really simple.

We have a single workspace that contains all the assets, project settings and such. Let’s call it MyRPG_Master.

And you want to run multiple instances of the Unity Editor on that project, right?

Well, what you are going to create is a slave project. A slave project is a Unity project that borrows the Assets that are physically stored exclusively in the Master project. In other words, the Master project will be kind enough to share a single copy of its assets with large number of slave projects. That way, you don’t duplicate Assets content (the caveat is that each of those will need its own Library directory, but this is still a huge win).

The technical term we will use is… Junction. A junction is nothing more than a lightweight link to an original piece of content. A junction is all we need to trick Unity into thinking you have a real copy of that data.

Gotcha, Unity!

Let’s say we need 3 clients. For that, we will need 3 directories for our slave projects. And each directory will contain a set of junctions pointing to the MyRPG_**Master directory.

So, what junctions do you need?

That’s totally up to your project, but I’d start with the Assets and Packages directories. Assets is usually the heaviest directory, and you really want to use the same packages in your slave projects.

If you want to make sure they also have the same project settings (recommended), you may also add a junction for ProjectSettings. And you may keep adding to the list, depending on your project needs.

You create them in Windows with the command line tool. You have to invoke mklink with the /J flag to indicate that you want a hard link. There’s some documentation on this here.

I’m aware this might be a bit too technical, so I prepared a free Unity Asset that will help you doing just this in no time.

Download the package below and drop the script somewhere in your Unity project. Then, you will have a brand new tool at your disposal under Window → The Gamedev Guru → Editor Instance Creator. Open the window and start creating Multiple Unity Instances slave projects!

Using the Guru’s Multiple Unity Editor Instances tool is straightforward:

  1. Choose a name that pleases you; I’d suggest adding the _Slave suffix to your project name.
  2. Select whether you want the project settings to be mirrored. I recommend this one, unless you really know what you’re doing.
  3. Optionally, add ​extra subdirectories to be shared. Here you might want to add documentation, pipeline scripts, audio banks or any kind of asset you want to be shared in your new slave project.
  4. Click on Create. A new explorer will show you the location of your new project. Now you can open it and enjoy a lightweight copy of your master project.

If you’re more experienced with the command line, apart from the tool you’ll also find a brief README file including the necessary steps.

Download my Unity Instance Tool

Subscribe now to get rid of the famous Looks like this project is already open problem with this free Unity Asset

Download
The Gamedev Guru Logo

Performance Labs SL
Paseo de la Castellana 194, Ground Floor B
28046 Madrid, Spain

This website is not sponsored by or affiliated with Facebook, Unity Technologies, Gamedev.net or Gamasutra.

The content you find here is based on my own opinions. Use this information at your own risk.
Some icons provided by Icons8