I'm having issues getting Visual Studio's debugger to attach to Unity - editing and compiling scripts inside VS is working fine - however, when clicking "Attach to Unity" or "Attach to Unity and Play", the code compiles but nothing else happens. If all the builds are up-to-date then the button does nothing at all. I can manually start the game inside Unity and it runs the up-to-date code, but it is not attached to the VS debugger.
I have Unity 5.3.5, Visual Studio Tools for Unity 2.2.0.0 and Visual Studio Community 2015 installed on my PC. All of the Unity tools appear inside Visual Studio (Attach To Unity, etc).
Going Tools > Attach To Unity Debugger
inside VS brings up a correct list of open instances of Unity editor, but selecting one doesn't attach to it. As suggested here I've attempted using 127.0.0.1 as the IP endpoint, but that still didn't work. I've allowed both Unity and VS through the firewall settings, to no avail.
Unity's Help > About
also display's the Visual Studio Tools For Unity version number, so it is aware of the plugin's existence.
I loaded up VS via devenv.exe /log
to see if anything weird was happening - the log looked fine and that Unity Tools was loaded up properly. (The log is here if that is of any use.)
I've done a repair reinstall on VS, Unity and VS Tools for Unity, which was long and arduous, but changed nothing.
I'm going mad trying to get it to work - it's really frustrating to press "Attach To Unity" and see it do literally nothing, not even an error message. I feel like I must be missing something - any ideas / suggestions / solutions would be greatly appreciated
The Attach To Unity button in Visual Studio. Some code editors may allow you to select an instance of Unity to debug. For example, in Visual Studio, the Debug > Attach Unity Debugger option exposes this capability. Visual Studio listing the current instances of Unity available to debug.
One common reason VS would not show the Attach to Unity option is that the solution/project was not recognized as a Unity project and instead it was opened as a normal C# project. This usually means that the Tools for Unity extension is not installed.
All of the Unity tools appear inside Visual Studio (Attach To Unity, etc). Going Tools > Attach To Unity Debugger inside VS brings up a correct list of open instances of Unity editor, but selecting one doesn't attach to it.
If you started debugging using the Attach to Unity and Play configuration, the Stop button will also stop the Unity Editor. You can debug development builds of Unity players with Visual Studio.
This was killing me too. After going through everything installed in the last few days and uninstalling and reinstalling, I determined that the latest Xamarin broke VSTU integration. I even reverted to VSTU 2.1 to no avail.
Only uninstalling Xamarin allowed the debugger to attach to Unity.
So for now, we have to use either Xamarin or VSTU, but not both on the same machine if we want the VS debugger to attach to Unity.
This is indeed a compatibility issue between VSTU and XamarinVS. We worked with Xamarin and we already fixed this in our master.
We will release a new VSTU version with the fix and additional features shortly.
Regards Sebastien Lebreton [MSFT]
I had the same problem, except that the tool didn't print any unity process... Uninstalling Xamarin as well didn't help, and in fact I was just not able at all to attach unity throw the tool. (Attach process did worked, but no breakpoint in code can be reached).
In fact, it was because I renamed "Unity.exe" to Unity "5.3.4f1.exe".
Visual Studio Tools for Unity need to attach to the process Unity, and no other name can be handle for now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With