Free Visual Studio Tools for Unity

It's about two months now since I became aware that Unity code can be edited using Visual Studio. I remember what a relief it was to be able to rely on intellisense to remember the myriads of different member and property names that I was still getting used to after about a year of programming with Unity. Of course, MonoDevelop sometimes gives you intellisense, but whether it chooses to give you intellisense right now bears no relation to whether it will give you intellisense, say, ten seconds later.

So the fact that I had to go back to MonoDevelop sometimes for some debugging, or indeed that I sometimes opened MonoDevelop inadvertently when my finger accidentally double-clicked on a script or error message, has been a bit of an irritation. I have been aware of solutions to both those problems, but until now I thought that they always involved paid versions of either Unity or Visual Studio, or both. I can't even manage a new computer right now (which is part of the reason it annoys me so much if I accidentally open MonoDevelop - it takes my computer a minute or two to open it, during which it can't do much else), let alone big software licenses.

A few weeks ago I got quite excited when I noticed the Visual Studio Tools for Unity. But then I got to the FAQ and found that the minimum required version was Visual Studio Professional. Another question mentioned Visual Studio Community Edition, but I'd never heard of that - I knew the free version was called Express Edition, and that was below the minimum requirement, so I guess I ignored mentions of any other versions.

Just the other day I was looking to see if there was a version of Visual Studio for the Mac (since I'd acquired a 10 year old Mac Mini that ran more smoothly than some of my computers, and thought it might be easier to develop on that), and found some recent announcements by Microsoft, one of which was the Visual Studio Community Edition which I had glossed over before. If you haven't noticed it before either, it's basically Visual Studio Professional, but free, with a similar license to Unity Free (you can use it until such a time as you start making loads of money from it, then you have to buy the paid version).

It took a few hours to uninstall some conflicting versions of Visual Studio, install Visual Studio Community Edition 2013 (the latest stable release at time of writing), then install Visual Studio Tools for Unity. After that, getting it working was simple - instructions are given on the project's own page, I just opened my project, imported the package 'Visual Studio 2013 Tools', closed and reopened Unity, and then selected the new menu option 'Open in Visual Studio'. It really is that simple.

And then, in addition to all the intellisense and stuff you could get just by using Visual Studio Express to edit your Unity project, these are a few of the added features you get:

  • Your game can be run from Visual Studio (the default setting by the Visual Studio Play button is just to 'Attach to Unity', but it can also 'Attach to Unity and Play' - it will remain attached, and unable to edit code, until you press the Stop button in Visual Studio, even if your game has already stopped running, so don't be caught out by that).
  • Double-clicking a script will open it in Visual Studio.
  • Double-clicking an error message in Unity will bring up the offending line of code in Visual Studio.
    You can set breakpoints and debug your game from Visual Studio. (Though note that an error still just lets the game struggle on - it doesn't break automatically like programs in Visual Studio usually do.)

Alas, there's currently no syntax highlighting for shaders, so I still will be going to MonoDevelop for editing shaders for the moment, but it seems the next version of Visual Studio Tools for Unity will support that too, so we'll be able to use Visual Studio for everything. And there will be much rejoicing.

This entry was posted in Unity. Bookmark the permalink.

Comments are closed.