- Home /
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!
Also, I don't have Xamarin installed, and the rest of my $$anonymous$$m who use the same version for the same project can attach VS to Unity without issues.
Answer by JvanOpstal · Dec 13, 2017 at 09:29 AM
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.
Answer by BrienKing · Feb 13, 2018 at 08:11 AM
I had to run Unity as Administrator for it to work for me.
YES! After trouble-shooting this for hours this was the answer for me.
I was running Visual Studio 2017 as Ad$$anonymous$$istrator and once I told Unity to run as Ad$$anonymous$$istrator as well, things synced up! Thanks for the tip!
Answer by LCC_Coding · Jun 21, 2018 at 08:14 AM
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
Wow. Both the $$anonymous$$icrosoft documentation AND the Unity documentation both left this step out. I feel like an idiot, but at the same time, I don't use Visual Studio ever.
Thank you so much for taking the time to post this. I believe this will end up being the answer that most people are looking for.
Firstly, make sure that you have the Workload installed for "Game Development with Unity" within Visual Studio. You do this during the installation process. See this documentation.
Once you do that then setup Unity to use Visual Studio as the editor. The documentation (for Visual Studio) here.
In Visual Studio for $$anonymous$$ac you nee to go to: Run > Attach to process
Answer by Chmis · May 14, 2017 at 07:19 PM
For me going to Unity Preferences -> External Tools, choosing MonoDevelop then Visual Studio again solved the problem
I tried choosing $$anonymous$$onoDevelop and then back to Visual Studio, but it isn't working for me.
Answer by amcakebread · Jul 30, 2018 at 03:24 PM
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
I've tried all the solutions mentioned, but unfortunately I'm in the same situation. Have you resolved it?
I'm sorry, no I haven't solved it. And all these people saying to switch to mono and back obviously don't have a recent copy of unity because they have dropped mono. I still get regular lock ups when debugging making it close to impossible to use but I do now have a suspicion that it is connected with loading assets or resources
Thank you. I have also a $$anonymous$$ac computer. When I tried with VS for mac, I could debug it.
In Visual Studio for $$anonymous$$ac you nee to go to: Run > Attach to process