How to update Unity3d’s default Project Location

Unity3d Project Location:

Unity3d is an excellent cross-platform tool for developing interactive content.  Unfortunately some desirable work-flow features are just not available.  One such feature is the ability to change the default Project Location where all new Unity projects are saved.  With Unity, I find myself creating new projects quite often to test new features and ideas.  Being able to set a custom default Project Location would be a great time-saver so I would not have to drill-down into a file dialog to locate a specific folder.

While searching for a solution I found many others looking for the same feature.  Unfortunately, no solutions were available.  I found one mention of a registry key which could be altered but that did not work.  I used the Microsoft  Process Monitor to view registry and file access by the Unity process but I never saw any interesting data being read.

After some quick tests I found that Unity always uses the personal documents folder.  The personal documents folder is located by Unity using the Microsoft SHGetFolderPath API.  By default, Unity saves new projects under a folder named “New Unity Project (X)” under your personal documents folder.   So, the task is to get Unity to read a different value for the personal documents folder.

The following details how to update Unity running on Windows.  These steps are not valid for Unity running OSX or Linux.


In order to get Unity to display a custom Project Location folder when you select File | New Project … you must update a value in the Windows registry.  To accomplish this, create a simple Visual Basic script to update the personal folder name, launch Unity, then revert the personal folder name when Unity is closed.  Here are the step-by-step instructions …

Create a new empty document (e.g. within Windows Explorer Right-click New | Text Document)


rename the file LaunchUnity.vbs


Open the Windows registry (e.g. regedit.exe) and browse to the key named HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders.  Find the value named Personal.  This is the value returned by the Microsoft SHGetFolderPath API.  It should be of the form C:\Users\<yourname>\Documents.

Make a note of this value.  You will use it later to update your Visual Basic script.

Now, right-click on your Unity3d icon and select Properties. Select the Shortcut tab and locate the Target textbox which contains the path to Unity3d on your system.  It should be of the form “C:\Program Files (x86)\Unity\Editor\Unity.exe”  but can vary based on where you installed Unity and if you are running 32-bit or 64-bit Windows.

Make a note of this value.  You will use it later to update your Visual Basic script.


Now create the Visual Basic script to update the folder name and launch Unity.  Right-click on the “LaunchUnity.vbs” file you created and select Edit.


Copy and paste the following Visual Basic script code into the LaunchUnity.vbs file

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "C:\YOUR\PROJECT\FOLDER", "REG_SZ"
sReturn = WshShell.Run("""c:\Program Files (x86)\Unity\Editor\Unity.exe""" , 0, True)
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "C:\YOUR\PERSONAL\FOLDER", "REG_SZ"

Replace the three strings “C:\YOUR\PROJECT\FOLDER”, “c:\Program Files (x86)\Unity\Editor\Unity.exe”,  and “C:\YOUR\PERSONAL\FOLDER” with the default path you want to save Unity projects, the path to unity.exe, and your existing personal folder respectively.  Warning: make sure you do not use a trialing \ on the paths or that will break the vbs script.

For example,  here is my final vbs script using “G:\UnityProjects” as my custom project location and “C:\Users\andrew\Documents” as my existing personal folder.

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "G:\UnityProjects", "REG_SZ"
sReturn = WshShell.Run("""c:\Program Files (x86)\Unity\Editor\Unity.exe""" , 0, True)
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal", "D:\Users\andrew\Documents", "REG_SZ"

Launching Unity

When you want to use the new custom project location, simply launch Unity via the new LaunchUnity.vbs script you just created.

Verify the custom project location

Launch Unity via the LaunchUnity.vbs script you just created.  Unity should launch as usual.  If it does not then go back and verify you followed all steps correctly.

From Unity, select File | New Project … and you should see your new custom project location.  Easy!


While Unity is running, you can view the Personal key in Windows regedit.exe.  Press F5 in regedit to refresh the view.  You will notice that it is set to you custom folder name.


When you close Unity, the Personal key will automatically revert back to its previous value.


Wrap up:

So, when ever you want to create a new project in Unity, simply open Unity with the LaunchUnity.vbs script.  As a benefit, once the new project is created, Unity will automatically close itself and re-open so the Personal folder will be reverted back to normal after your new project is open!


  • Simplify new project creation in Unity3d
  • Guarantee all new projects are placed within your developer storage
  • Easy one-click launch of Unity3d configures the project location folder and terminating Unity3d automatically reverts your personal folder to its default value
  • Since Unity automatically closes and re-opens after creating a new project the Personal folder will be reverted automatically after creating a new project


  • All programs requesting the Personal folder via the Microsoft SHGetFolderPath API while Unity3d is running will get the custom folder you defined for Unity3d.  You can shut-down Unity to automatically revert the original folder name


Setting Variables with Visual Studio Breakpoints

Occasionally I have a use for changing variables to test certain features when working on a project.  In these instances I like to use a breakpoint to test values rather than recompiling with some test code or manually breaking and setting a value, I like to use the breakpoint itself to set the variable. This is fairly easy to do.

To create a breakpoint that sets a variable. Create a breakpoint where you want your vairable to be set in code in Visual Studio. Right click on the breakpoint and select the “When Hit…” option. You will see something like the figure below. Select the “Print  a message:” checkbox.WhenBreakpointIsHit

Delete the contents of the edit box and place the code that would set the value like the example below. When you  are finished make sure the assignment is wrapped in curly braces.

SettingBreakPointfilm Despicable Me 3

You can leave the continue execution box checked depending on your situation. Most of the time I leave this checked, because I like to have the variable set without me having to stop what I’m doing and intervene with the debugger. Below you can see the output from the simple program. The value has changed from 5 to 6.

SetValueOutputYou can set multiple variables at once by putting each assignment in separate curly brace blocks. This is a great solution to test certain scenarios without having to fiddle with recompiling or stopping execution to set the value manually in the debugger.

One thing to note is that this is extremely slow and it will print the value you set into the debug window in visual studio. So doing this in a tight loop is probably not recommended. Currently I use a breakpoint that sets three variables differently between local debugging and remote debugging configurations.