- Home /
Visual studio can't attach to unity editor.
When debugging I would like to attach to Unity and cycle through my breakpoints, however the "Attach to unity" button is replaced with "Start" and I can't seem to fix this.
I've gone so far as to delete my personal VS and old Unity to install the latest bundle where Unity comes with VS 2015 community as the requested feature should be available out of the box, but to no avail. What can I do to fix this? It would mean a ton!
Thanks in advance.
Okay, I figured it out. So for all of you experiencing the same issue, here is the solution that solved it for me:
Open the folder that holds your entire unity project and delete everything except the "Assets" and "Project settings" folders.
If it worked for you, leave a comment so others can find it easily!
It worked for me here! I closed the application, deleted all the files on my project except for Assets and Project Settings, and when I opened my project again the "Attach to unity" option was available. Thanks a lot!
Answer by crare · Jan 07, 2018 at 12:25 PM
Those didn't work for me so I found answer in forums. I am using Visual Studio 2017 so for some reason it wasn't already installed for me. To install Tools for Unity in VS:
Close Unity just to be sure nothing goes wrong. in Visual studio -> Tools -> Tools and Features..
New window pops up. Scroll down on tab "Workloads" to section "Mobile & Gaming" and you find "Game development with Unity". Check the checkmark and click "Modify" in the bottom right corner of that window.
This will then ask about VS processes running, click "continue" and it closes your VS-windows and continues installing the Tool you need. after it's done your Visual studio editor comes back.
Close VS, Open Unity and double click script to open it in VS(If you have it setup as editor in Unity preferences[Edit->Preferences->External Tools->External Script Editor -> set it to Visual Studio]).
Now you should see "Attach to Unity".
Answer by alok-kr-029 · Jun 05, 2017 at 08:02 AM
To solve this issue go to C ->Program Files->Unity->Editor and rename the unity exe file to "Unity.exe " remove the version extension if any
this almost worked perfectly fro me. I had to use Unity
without the .exe
and I had to restart my machine to make it work correctly. Thank you for putting me on the right path.
Answer by itaielidan · Dec 06, 2018 at 10:13 PM
What worked for me is to update visual studio. Go to Tools>Get Tools And Features...>Modify>Update
All done!
Answer by _raj9 · Jun 29, 2016 at 05:31 PM
I had a similar issue. Installing the latest version of VS tools for unity fixed that.
https://visualstudiogallery.msdn.microsoft.com/8d26236e-4a64-4d64-8486-7df95156aba9
@_raj9 do you know the link to download the latest tools for VS 2017
Answer by Valhalaru · Aug 20, 2020 at 09:48 PM
These worked for me -
Debugging Unity on a Mac with Visual Studio (steps may work for a PC too)
Setup:
a. In Unity make sure VS is set in Unity->Preferences->External Tools - External Script Editor set to VS
b. In VS - Install the latest Unity Tools for Visual Studio (Game Development with Unity).
c. Click a script in Unity to Open VS
Steps:
In Unity goto Unity->Preferences->General - set Code Optimization on Startup to “Debug”
In Unity goto File->Build Settings
Change Run in Xcode as to Release or Debug (the change resets it in VS)
You should see the PLAY button in VS with “Attach to Unity” as one of the options
(If that doesn’t work, do this:) Simply close VS and in Unity > Edit > Preferences > External Tools - Click on "Regenerate project files" (you don't need to check anything else, just click the button)
Start VS again by clicking a script should be able to see the "Attach to Unity" option
Alternative to Attach Button on PC
1. In VS - goto Debug->Attach Unity Debugger-> ...select the Unity Process running your project.Your answer
Follow this Question
Related Questions
Unity editor bugging out 4 Answers
Importing A*Pathfinding plugin issue 1 Answer
Android OpenGL error in Unity 5 but not in Unity 4.6 0 Answers
Visual Studio Code Mac (1.29.1) problem with class inheritance Unity (2018.2.17f1) 0 Answers
Unity 5.3.1 and Visual Studio 2015: Project Target Framework Not Installed Error Message? 4 Answers