I just started using unity 2021.1 and I encountered a problem with opening scripts via visual studio.
After creating a new script I double clicked it in order to open it, weirdly enough visual studio didn’t open.
I made sure that my external script editor was set to Visual Studio 2019 and that I had the unity components installed via the Visual Studio Installer.
After searching the web for a bit, I found a weird solution that for some reason worked even though it’s very counter intuitive and involved removing the Visual Studio Editor and Visual Studio Code Editor packages via the package manager. ( Visual Studio Code won't open through Unity Editor )
I’m not sure if it’s the correct place to report this bug at, if it isn’t please direct me to the correct place. I would also like to know if other people encountered this problem because it’s pretty serious.
Edit:
Forgot to mention that I had Visual Studio 2019 prior to downloading Unity
Secondly, I’m using Visual Studio 2019 Community Edition, not VS Code. The problem is not with intelisense ( well, as of now ) The problem is that scripts don’t open at all while those 2 packages exist in the package manager, the second they are deleted the scripts magically open. I saw the first thread you posted yesterday and I already did everything in it.
The only difference is that in my case if I try to open the project via Assets → Open C# Project I get the same warning but without any path printed by the warning message.
So in conclusion I can’t really work at all as of now because I either can’t open the scripts or have them as part of a project.
I’m also having this problem, with Unity 2020.3.14f1**,** and Visual Studio 2019 Community Edition 16.11.5 (latest version at the time of this writing). I have this problem even from a blank 2D template from Unity Hub:
This wasn’t always this way, but I don’t know what changed. I’ve had to get good at collecting file names and line numbers from the console, switching to Visual Studio, finding the file names in the tabs of opened files or in the Solution Explorer, pressing CTRL + G, typing in the line number, and pressing enter. I do this 100s of times per day now.
I did, but I don’t remember exactly what worked. I recommend biting the bullet by reinstalling Visual Studio (which means you’ll need set your VS preferences again and re-install VS extensions, unless you backup the former somehow). That’s probably what I ended up doing.
Recently, when the connection between Unity and VS is lost, I’ve been able to re-connect by deleting the .sln file and opening a script from Unity, but I’m sure you’ve tried that 10 times by now. The VS re-install is your best bet, despite the work it takes.