Visual Studio won't attach to Unity, even after Vs Tools for Unity update

Hey guys,

I have a problem that’s been posted on here quite a lot, but mine has bit of a twist.
I have 2 versions of Unity installed on my laptop: 5.5.0f3, which I use for most projects, as well as 5.4.1f, which I’m required to use for a single project.

With the 5.4.1f version, when I try to attach Visual Studio to Unity so I can debug with breakpoints and such, Visual studio can’t find any instances of Unity.

With 5.5.0, attaching works as expected.

All the other posts I found about this problem seemed to be solved by updating to the newest version of the Visual Studio Tools for Unity, but that didn’t help in my case. Updating to Visual studio 2017 (I used 2015 before) didn’t help either.

Has anyone encountered this problem before and found a fix or workaround?
Thanks in advance!

I had to run Unity as Administrator for it to work for me.

Go to Debugger at the top in visual studio and choose “Attach Unity Debugger” then hit play, That is what worked with me, I also ran Unity as administrator. Hope that helps

For me going to Unity Preferences → External Tools, choosing MonoDevelop then Visual Studio again solved the problem

since updating to unity 2018.2.1f1 I am completely unable to attach VS to unity. I have tried absolutely everything including attempting to reinstall unity and visual studio. When I hit the attach button it just goes dark for a few seconds then back to normal as though I never touched it. No errors, no feedback whatsoever

Edit-> Preferences-> External Tools > Editor Attaching checkbox


Found this in a comment by aoguzkoca in one of the answers :slight_smile:

I solved this issue for myself when I ran into it on a different project. My problem was that because I had 2 versions of unity installed on my pc, i had renamed the Unity.exe to more easily distinguish it from the windows Start menu. The VS Debugger seems to require the .exe to be named exactly as expected.

I did reinstall the unity and the visual studio and fix it to me

Had this problem several times. Close visual studio, delete .sln and .csproj files in your unity project folder, then open some of your c# scripts from unity. New sln and csproj should be generated and attach to unity should be available again.

I fixed this by going to edit > preferences > and checking the bool next to ‘Player Projects’ under ‘generate .csproj files for:’ and clicking ‘Regenerate project files’ button. The other stuff did not work for me