Categories
Software

Two Unitys, One Project

trick Unity into opening the same project in two different Editors

Here’s how I open two instances of unity on the same project

There are numerous times that I’ve wanted to compare two scenes in the same unity project. Unfortunately, Unity doesn’t allow an already open Unity project to be opened again. However, I found a hack that lets me open the same project more than once. So let’s open an elevated Windows Powershell and get started.

  1. Close all instances of Unity, Visual Studio, MonoDevelop, etc.
  2. Open an elevated Powershell
  3. Change to the parent folder of the unity project
  4. Copy the entire unity project to a new folder
    1. Copy-Item -Path .\GameProject\* -Destination .\GameProjectCopy\ -Recurse -Force
    2. -Recurse to copy all the folder and sub-folder contents
    3. -Force is optional, but errors get thrown if folders already exist. This just overwrites them without any fuss or complaints on the command line
  5. Delete the ‘Assets’ folder inside the new project
    1. Remove-Item .\GameProjectCopy\Assets\ -Recurse
  6. Symbolically link the Assets folder of the original project (GameProject) to a folder in the newly cloned project (GameProjectCopy)
    1. New-Item -Path .\GameProjectCopy\Assets\ -ItemType SymbolicLink -Value .\GameProject\Assets\
  7. Ensure the project are properly linked
    1. Open the Assets folder in Windows Explorer in both projects
    2. Create a file in one folder and ensure the file appears in the other folder
  8. Open Unity for both projects.

This should be enough to trick Unity into opening the same project in two different Editors. The advantage of this technique over just copying the project to another folder is that changes saved in one editor are immediately available in the other one. Both Editors are always in sync!