The Unity 3.0 docs mention that Visual Studio can be used for editing code, but for debugging code the only information provided is for MonoDevelop.
Is it possible to use the Visual Studio debugger instead? (perhaps via the Mono Tools for Visual Studio add-in?)
As mentioned in a comment below UnityVS plugin is now available for free.
Answer by iandallas
Sep 19, 2012 at 12:35 AM
UnityVS, a third party plugin, lets you use Visual Studio as a debugger for Unity.
Sadly it's not free http://unityvs.com/pricing/
Another note: you need the full version of Visual Studio. VS Express will not work.
Just tried the trial of it for all of 3 minutes. UnityVS can see into some of my classes which mono can't.
UnityVS developers SyntaxTree have just been acquired by Microsoft. You can now use Visual Studio Tools for Unity for free!
@TheMaster42 Visual Studio Express does not currently support Extensions, and UnityVS is installed via a VS Extension, so unfortunately I don't think it'll work with an Express edition.
Answer by qJake
Aug 14, 2010 at 10:31 PM
No. Only MonoDevelop can be used as a line-by-line debugger in Unity 3. MonoDevelop is a .NET-like environment for Windows and OSX.
There is a very high-effort way to get this working, as the wire-protocol that MonoDevelop uses to communicate with the builtin debugger inside Unity is "documented" as the sourcecode that writes/reads to it is opensource. It would be possible to write a Visual Studio plugin that talks Unity in the "debugger language" it understands. This is defenitely not a light undertaking however. (for implementation, see Mono.Debugger.Soft.dll in mono's sourcecode)
In good conscience, Lucas Meijer wrote the second paragraph, not me. ;) I'm not big on taking credit for other's work. :)
Answer by SherlockDotNet
Mar 29 at 12:04 PM
It is now possible to debug in Visual Studio. Here's the link to the Unity website explaining how: https://unity3d.com/learn/tutorials/topics/scripting/debugging-unity-games-visual-studio
In short, once you have Visual Studio and Unity Tools https://www.visualstudio.com/en-us/features/unitytools-vs.aspx you can launch your game, open your code in Visual Studio (double-click on a script if Visual Studio is configured to be your code editor) and then click on the "Attach to Unity" button.
Answer by chilberto
Nov 18, 2013 at 04:30 AM
I had a look at UnityVS and did a post: http://azuregames.azurewebsites.net/2013/11/18/unity-and-unityvs/
Definitely worth $100 to me.
Answer by Zyxil
Feb 13, 2011 at 05:06 PM
With Unity 3.2 this feature now exists.
You have to debug using the MonoDevelop that ships with Unity 3.2.
When you have the project open in MD, click Run > Attach to Process. Then choose the Unity editor process or your running built debug exe. If you attach to the editor, you can start and stop the game editor at any time using the "play" button or Ctrl+P.
Unfortunately, the "feature" I wanted was debugging from within Visual Studio. It's great that as of Unity 3.2 it's even easier to debug from MonoDevelop, but that doesn't seem to affect the situation for Visual Studio.
I agree that debugging with VS would be idea, but I'm pretty sure this will not happen. I believe UT made significant custom modifications to MD and Unity to get the debugging to work.
The pain is now gone with 3.2 and MD. All you have to do is open MD and attach to process. You can attach/detach at will. You don't have to open and close Unity. MD even warns you if the code is out of sync and is fixed with a single button click.
The 3.0 debugger with MD was unusable. With 3.2 it is very useful.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
13 People are following this question.
How Do I use Mono Debugging in Unity 3.0?
Use Visual Studio to debug Unity. Cannot connect to process
Unity instance missing in "Attach Unity Debugger", Visual Studio 2013. How do I fix this?
Must one migrate to C# from UnityScript to be able to use advanced tools?
Visual Studio alternatives for Mac