Quite recently I gave a (second) chance to the praised solution called UnityVS, and was literally blown away.
Although I’ve tried this tool when it originally came out, back then I was having hard time making it to work with my setup.
My Unity setup contains class a number of library projects compiling to DLL-s, which are then being copied via the post-build commands into the actual Unity solution:
Back then, I didn’t manage to hit breakpoints in my source code (or I didn’t know how to set it up properly, which is more probable ). However, they improved their solution and now it is working without any problem.
A real debugging tool
The development with eDriven.Gui got so complex that the Debug.Log() simply wasn’t enough. As a long-time Visual Studio user I just needed a real debugging tool.
So, I decided I should to cope with UnityVS learning curve again.
Downloading a trial version
Luckily, they are quite open for testing: you can download a 2-week trial for the Visual Studio version of your choice (2010, 2012 or 2013) right from their site (after leaving your e-mail, the UnityVS license will be sent to your inbox and you’ll be able to download it).
Remembering my previous fail, this time I decided for a new strategy: reading the actual documentation.
UnityVS site has an excellent documentation page, which you should blindly follow and you’ll get it up and running with no problem.
However, I wanted to make it easier for you guys, so here’s a small cookbook that should make you up-and-running quickly.
You should start by running the UnityVS installer, and then importing the UnityVS package into Unity.
After the import, you get the UnityVS menu, where you should click the “Generate Project Files” menu option:
UnityVS generates its projects + solution inside of the Unity’s root folder (that is, the parent folder of the Assets folder of the current Unity project):
Getting your projects to a new solution
The generated UnityVS.Unity.sln is the solution you’ll be working with.
The trickiest part was to get all of my current projects this solution, with their existing post-build commands working properly. For me, it was trial-and-error.
However, I managed to get them how I wanted:
For being able to debug your application, you need to switch your Unity project to a standalone debug build:
If you have any changes, you should first rebuild your project in Visual Studio (Ctrl+Shift+B).
Then, you should run your game in Unity (Play mode).
Switch to Visual Studio project again and press F5 to start debugging.
If Visual Studio complains about not being connected to Unity, you should look for a small Unity icon in the lower-right edge of Visual Studio. This icon turns out to be crucial:
When semi-transparent – this icon indicates that Visual Studio isn’t connected to Unity process. If so, you should click the icon to get the dialog (as in the image above), and reconnect manually.
When successfully connected to a playing game, you can set up and test a breakpoint.
If you manage to hit the breakpoint – it’cigar time!
Your breakpoint should look like this:
Now you have all the beauties of Visual Studio development with Unity: watch lists, immediate window, call stack and much more.
A very valuable tool
I highly recommend this tool for every Unity developer working on PC, using Visual Studio.
It comes at a very affordable price for what it does: it will save you hours of work, making you more productive.
Danko Kozar, November 2013