VS code - files not opened from Unity

instead of using the EXE file, use the CMD file in the bin folder and then its back to working.

that did not work for me.

I also got the MissingMethodException error on macOS with Unity 2019.2.9f1 using VSCode.

But I only had it in one project, another one was working fine. Comparing the two, I noticed I had removed the Rider IDE package. I added it back and now VSCode works again.

Note that Rider Editor package 1.1.1 has an invalid dependency on the Test Framework 1.1.1, which is not verified for 2019.2 and wonā€™t be installed, leading to compilation errors. Install the Rider Editor package 1.1.0 instead.

This transition of editor support to external packages has been really painful. The basic functionality of opening scripts breaking repeatedly, bugs being fixed only very slowly and requiring tedious troubleshooting and workarounds. Unityā€™s testing of these changes has been really lacking.

I had the same problem, could not open files from Unity, but from within Windows.
The only thing that helped me was to uninstall Visual Studio Code and install the Insiders build instead:

I have the same problem, out of nowhere, now I can open VS Code from Unity, but IntelliSense and Snippets are not working.

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

I have installed the latest .NET Framework Developer Packs.

This worked for me. But first I had to go into the ā€œDetailsā€ tab in my task manager and end all the existing VS Code processes.

1 Like

vscode updated itself the other day and this problem stopped happening. i am now on vscode 1.39.2 and things are back to normal.

This one worked for me. Thank you.

It looks like this is fixed in package 1.1.3.

1 Like

Canā€™t seem to be able to download 1.1.3 from the Package Manager. For me, the 1.1.2 is the latest version available

ā€¦
I had this problem for one of my projects on Windows 10. I tried restarting my computer and it didnā€™t work. Then I restarted and installed a quick update for my computer and itā€™s working now. Weird.

My solution to this problem is below and my environment is: win10 + u3d 2019.2.12f1.

  1. open your unity editor and double click on one .cs file ( and of cource, vsCode didnā€™t start and show code),
  2. open your Windows TaskManager and force kill all Visual Studio Code processes, maybe some warning messages would appear and ignore it.Make sure all vscode process was killed.
  3. try double click .cs file in unity editor, and it works in my pc.

I donā€™t need repeat these operation, restart unity editor is still no problem with vsCode.

If you try open .cs file but he didnt open, you can try open VSCode and click any Recent project, maybe is help you

Iā€™ve installed the plugin and didnā€™t work. So what I did was see the Processes from windows and to my surprise, there were a few of Visual Studio Code. Finished them all, closed unity and voilĆ”. It worked.

This worked for me right away after I tried everything else

So my VS code was working until I started my new project and I believe it is due to me having spaces in my directory path. Hope this simple fix works for you all.

Unity Version: 2019.2.11f1

G:\UnityFun\Classic Clashing (Didnā€™t work)
G:\UnityFun\Classic-Clashing (Worked)

I do not use any plugin.

As I saw that several people have this proplem I wanted to share a simple solution that worked for me.

Just paste this into your External Script Editor Args after choosing Visual Studio Code:

. -n -g $(File):$(Line)

For people who want to know what this actually does:

. - takes the current directory as unity uses the project folder to open its internal cmd(or powershell I am not sure) it will point to your project folder perfect
-n - will always create a new window normally but this will not happen if it is a folder! by default vscode uses -r but it has a problem with unitys terminal session so the -n fixes this issue :slight_smile:
-g - is a goto to open a file at specific line if line is not provided it will just open at start of file.

Sidenote:
Seems I only face this problem on mz windows10 machine it works fine on my mac without changing the parameters.

ps: just saw you can also use:

"$(ProjectPath)" -g "$(File)":$(Line):$(Column)
1 Like

ā€œ $ļ¼ˆProjectPathļ¼‰ā€ -gā€œ $ļ¼ˆFileļ¼‰ā€ļ¼š$ļ¼ˆLineļ¼‰ļ¼š$ļ¼ˆColumnļ¼‰
Ťhis is useful to me

1 Like

Just uninstalled and reinstalled VS code ā€¦ it worked for me