Visual Studio Code not working since 2019.2

Hi,

after clicking on c# scripts in Unity, the VSCode editor won’t open. If you open the file manually, intellisense is missing. I have the latest version of Visual Studio Code package and Unity. (2019.2.5f1, 1.1.2) This is happening since 2019.2, 2019.1 still works.
Does someone actually managed to fix this thing?

1 Like

I have the same problem with Unity 2019.0b3 atm.
VSCode also does not open if I just double click any of the script files in windows explorer.
But this happens only for this specific Unity project folder. If I move the files to a different location they open fine (obviously also without intellisense)
So I am not sure if this is a Unity bug or a VSCode bug or maybe even both.
Also could not find any solution yet.

1 Like

Hello friends I found a partial solution, my current version is 2019.2.5f1 I decided leaving the external script edit args empty, and put the absolute cumin of vscode, and when opening the script I click the right mouse and choose option open container folder, this way it opens vscode, I hope that with you

Same for me using version 1.1.2 of the VSCode package.

1 Like

It’s starting to be a big issue. Not fixed in 2019.3 either…

1 Like

Hello! There is an active bug regarding this issue: Unity Issue Tracker - [VSCode] A Script fails to open when External Script Editor is set to code.exe

A possible workaround for this issue is to set External Script Editor value via Browse…-> instead of just choosing the “VSCode” option

Looks like when the support got from Unity to an extern package in the package manager, the support for visual code stopped working.
It seems like a big regression…

1 Like

@Domas_L we tried this on two machines but it still does not work

Check out the issue linked above.

Two workarounds/fixes include:

  1. Edit line 182 of VSCodeScriptEditor.cs from ProcessWindowStyle.Hidden to ProcessWindowStyle.Normal (details in the comments of the issue linked above). The external script editor should be set to the exe if you do this, otherwise the console window of the code.cmd instance will also be shown.
  2. OR set the external script editor to code.cmd (not exe) - in the bin folder of the VSCode install directory.

If you have attempted to open VSCode beforehand, make sure to end these processes from the Task Manager (in the details tab). If you already have opened VSCode externally, this issue won’t occur.

5 Likes

Worked for me, thank you so much!

1 Like

Number 2 worked for me. Logged in just to say thanks

Thank you, worked for me too.

intellisense STILL kind of doesn’t work under 2019.3+vscode w/ omnisharp 1.21.10

All unity packages failed to be recognized by omnisharp.
output suggests that it cannot find .csproj file associated with packages installed from the package manager:

[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Timeline.csproj' does not exist

I personally cannot locate these files under my project folder either, but they are explicitly referenced by Assembly-CSharp.csproj and friends.

The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at .NET SDKs for Visual Studio

Except 4.7.1 is installed. FFS.

Any fix for that?

Have you tried installing .NET 4.7.1 Developers Pack? It is different from the standard .NET Runtime Framework. You can find it here: https://www.microsoft.com/en-us/download/details.aspx?id=56119

Moments after I’d posted here I found the solution, pointing to code.cmd was not enough, I also had to check the generate .csproj files option and then go to Assets->OpenC#Project. After these steps everything started working fine once again.

2 Likes

In my experience, these fixes don’t work unless you also kill every existing Visual Studio Code task from the Task Manager. You’ll probably have a bunch of hidden ones (with no associated window) and no way to get rid of them other than killing each task manually. :eyes:

Hi, I know this doesn’t add any useful information to the issue but got to get my frustration out…

Sick and tired of Windows, so have switched to Ubuntu as everything I need should work out of the box on Linux. That being everything needed for game development! And the switch from VS 2019 to VSC shouldn’t pose an issue.

But after spending 6-7 hours installing and uninstalling according to all possible suggested solutions on the internet, I’m still not able to get VSC intellisense to work with Unity. So I feel forced to keep hanging on to windows. :frowning: Only, and only because of missing Unity intellisense in VSC. Sigh… :confused:

Hope there will come a permanent fix for this in the near future.

Should have been so easy, and instead frustrations!! :frowning:

Hope you all have found a working solution… :slight_smile:

Got it working… Sigh…

Section “Troubleshoot the package manager” on .NET and Ubuntu overview - .NET | Microsoft Learn
Followed by a “sudo apt upgrade”

Finally got it working 90%… Still get error markings when using things like:

using UnityEngine.UI;
using TMPro;

And references like
public TextMeshProUGUI _testText;

And intelliSense for TextMeshProUGUI Doesn’t show “SetText” when typin “_testText.”
So kind of, working. :confused: Maybe it’s just TMP that is different.