How can I debug my unity project using Visual Studio 2012?

  1. I set my preferences to open up Unity .cs files using Visual Studio 2012

  2. I came across this: Visual Studio 2012 Tools for Unity - Visual Studio Marketplace

and I download and installed VS2012 Tools for Unity

  1. Now I’m stuck here, when I try and run/debug a single .cs file in VS, I get this exception:

“A project with an Output Type of Class Library cannot be started directly. In order to debug this project,add an executable project to this solution which references the library project. Set the executable project as a startup project.”

I’m not sure what that means and how to proceed. I’m not sure how to sync up Unity with Visual Studio.


Btw, I have Unity free version 4.6.1 installed and Visual Studio Premium 2012.


You have to click the Attach to Unity button on VS, which is next to the build options in the tool bar, then click the Play button in Unity as you would if you were using MonoDevelop.

It works fine for me.