Unity keeps opening new instances of Microsoft Visual Studio

Every time i double click a script in Unity it open a new instance of Microsoft Visual Studio, even if that script is already open on a previus one. This takes a lot of time and MVS keeps showing mensages telling that the files modified in another program.
Any Ideia whats going on and how to fix it? I just want to open the files in some new tab, not a whole other program.

1 Like

I had this problem as well, I believe it was related to upgrading a project to a new version of unity. I resolved it by deleting the .csproj files and the .sln file for the project. Unity just recreated them immediately, and the files correctly opened in the same instance of VS.

None of the solutions above worked for me.

Instead what I did was select “Open By File Extension” in Unity’s “External Tools” pane after setting VSCode as the default extension for .cs files.

This solved the problem.

I encountered another situation where the accepted answer did not work. When you first install Visual Studio and try to open a CS file through Unity it will prompt you, asking which program to open the CS file with. Often the only option is Visual Studio Version Selector; this is not the right answer. Instead within Unity go to the Edit menu bar → Preferences → choose External Tools. Under External Script Editor click browse and search for DevEnv within your Visual Studios folder. Usually found under

C:\Program FIles x86\Microsoft Visual Studio\Version##\Community\Common7\IDE\

Just close the Unity, then only clean the .sln file located in your project folder.

It still happens to me on Macos, Unity 2018.2.0b3. Nothing helped, and it’s making it completely impossible to work. It’s been frustrating lately as there hasn’t been a version of Unity in over a year that didn’t had at least one (often more) deal-breaking bug that made it useless…

  1. Close VS and Unity.
  2. If you are using Unity HUB, make sure to right click and close the program if it is running in your taskbar.
  3. Go into your Unity project’s folder and make backup copies in a separate folder of the .sln file with your project name in it AND the .DotSettings.user (if it exists).
  4. Now delete the originals of those two files.
  5. Open Unity and open your project.
  6. Now double click a script and it will open VS.
  7. Try doubling clicking a second script and this should open it normally now in the same window.

I wrote a long, very detailed explanation of the steps I took to resolve this VERY persistent problem and the site errored… I don’t have time to write it all again.

Short version:

  1. Do everything listed above.
  2. Rt-click on a .cs file and select “Get Info”
  3. Change default application for all files of that type to open in Visual Studio
  4. Create a new project and solution in Visual Studio. Add the existing Assets folder to the project.

There’s more that I did to make this work really, really well but my prior post had >20 steps.

I was able to fix this by going to Package Manager and then removing the two Visual Studio packages (Visual Studio Editor & Visual Studio Code Editor) which were added automatically. I do not know why this works, but everything runs just fine on Catalina with Unity and it never opens multiple instances of Visual Studio.

What worked for me was opening the Package Manager in Unity and removing the “Visual Studio Editor” and “Visual Studio Code Editor” packages.

My problem started from upgrading from Visual Studio 2017 to 2019.

I also had this problem on Mac OS Big Sur.
Solved by opening my package manager and updating my Visual Studio Editor Package to version 2.0.7.
Closed Visual Studio and Unity and Reopened.

I got the problem after i downgraded my Unity version.
My fix was to remove all Visual Studio Packages with the Package Manager and install only the given one from Unity Registry.

When working with Unity, if Visual Studio is already open and you attempt to open a script, Unity may open a new instance of Visual Studio rather than using the existing instance. This can result in multiple instances of Visual Studio being open, leading to unnecessary memory usage and decreased performance- 1

Happens when you install or directly copy project from git or a new project from old unity version. Just install VS code editor and VS editor package from Package manager. This might fix it. If not, try restarting unity. It does fix sometimes.

OH MY GOD! YOU ARE A GENIUS! Thanks!

Sorry if this is necro-ing a bit, but I may have found an alternative solution after all the other solutions failed to fix this issue for me.
If you open a C# script in Visual Studio as you usually do and then drag another script from your project onto that Visual Studio window, it will add that script as a tab in the same Visual Studio window. This drag-and-drop can be repeated for any other script you’d like to open.
So it is not exactly a fix for the issue, but it has been a suitable workaround for me which gets the desired results for the time being.

I hope this helps someone else as well. Cheers!

Set VS as default external Script editor
Check generate all .csproj files

Above solutions doesn’t work for me :frowning: .
I use visual studio 2019 and unity 2019.2.11f1.
This problem was very annoyed especially when click error at console, it always opening new visual studio and take a some time.
Have you other solutions, guys?

SOLVED : I reinstalled visual studio and everything was fine

Solution: I had the problem after upgrading from unity 2019 to 2020. when i created a new scripts in the 2020 version, i couldn’t open it. I deleted the two files (.csproj and .sln), but it still didn’t work. I solved it by:
|| renamed the C # file
|| opened the C # file
|| closed the C# file in Visual Studio
|| renamed the C # file back again to its original name, so that there are no errors in the program
|| opened the C # file again.

i had the same issue, just changed the Update Mode to Unscaled Time and its working perfectly.