Unity3D and Visual Studio

I got tired of MonoDevelop. It was totally adequate, but I thought there must be better IDEs to develop on in Unity3d than ‘adequate‘. I turned to Reddit to poll the Unity3D community on what they use and what they recommend. Some of it was unhelpful, but people took the time to answer the question and to them, I’m thankful.

At the moment I develop on my Mac Book Pro but I tend to use my wife’s 27″ iMac as a second (more like main) screen using target display mode. It works fine, except when I leave that mode and the iMac looses the mouse pointer – OSX doesn’t ‘just work’, and for what it is, it’s bloody unstable (but that’s a separate blog post). So that means bootcamp is a secondary option as I can’t use that nice big screen. I need to stay in OSX somehow.

I had a bash at Sublime Text 2 but it just wasn’t what I was looking for. It’s more just a text editor and I need something with some oomph!

Jdonavan suggested Parallels and Visual Studio 11. Why didn’t I bloody think of using Parallels! It should be perfect for the task and I used it once in an old job. I tested it out and sure enough I could fullscreen it on both monitors. The only bug I’ve found with it so far is that the Unity editor will not pick up the mouse sharing. Everything else works fine. When I test my scenes I have to switch the mouse to the Win7 inside Parallels and so lose it in OSX temporarily.

Next up was getting Visual Studio 11 to work with Unity. Not as straightforward as I hoped, but it didn’t take long. The first hurdle is that Unity doesn’t even recognise 2012! You have to manually add it as your external editor. Go into options > external editor > browse. then you need to find your copy of VS. If you browse to something along the lines of Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe it will work. Unity then displayed the correct name in the drop down which was a positive sign. So now I could click on script stuff in the Editor, it whisks you off to happy Visual Studio land.

The next problem was that VS11 didn’t have references to the Unity DLLs. Again with a little forum searching and playing around, I found the right place to link them up. Under Project > Add Reference > Browse > [Unity Directory]/Data/Managed/ UnityEditor.dll and UnityEngine.dll. Looks like you have to add this on every project though.

And it’s all set up. The other thing I invested in was Resharper. Having heard from many sources that it was just all kinds of awesome, I added it in and it’s been absolutely amazing. The one big thing I’ve been missing since leaving Flash/FDT behind was templates and they’re here in all their glory. It’s a good plugin and extends VS really nicely.

So far I’ve been on this setup for a month and I’ve not looked back. If you do extensive coding in Unity3D and C#, this is something you really need to look into. The time I’m saving now is pretty great and it’ll only get better as I learn the million shortcut keys that VS has to offer and as I build my template empire.

Soon, I’ll try out UnityVS. They’re promising shader editing in VS which would be well worth my money. They already have full debugging to – which I really need. I’ll update that as and when I get round to buying it and trying it out.

Bookmark the permalink.

3 Responses to Unity3D and Visual Studio

  1. Lars Bilke says:

    Hi Jasper,

    thanks for article. One question: Do you run Unity itself also in the VM? I think so because otherwise I cannot imagine how to setup VS as an external editor.

    I would prefer to run only VS in the VM but I think it is not possible.

  2. Jasper Stocker says:

    Yes I do, wanted to keep it as simple as possible. Not noticed a significant performance dip – but I’ve not tested that out fully yet with crazy graphics.
    I think it might be possible though – Parallels does seem to support launching exe’s from OSX and you could use crystal mode or whatever they call it.

  3. Jason says:

    I used MonoDevelop for a day and already hated it, there’s only one choice for C# programming on windows and it’s Visual Studio. Have been using it for years besides IntelliJ for Java development and it is just the best IDE for the job.

Leave a Reply