Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Can't get VSCode to work properly with Unity

Discussion in 'Linux Editor' started by Kurolox, Jun 28, 2018.

  1. Himik_90


    Jan 19, 2017
    Hello everyone,
    I had the same issue with VS Code intellisense not showing up (for Unity API).
    I'm using Linux Lite 4.6(Ubuntu 18.04 LTS), AMD Athlon II X2, Unity (2019.2.8f1).
    My first steps were:
    - Install .Net SDK (v3.0) following instructions from official site (;
    - Install VS Code. (Install C# extension);
    - Set Visual Studio Code as external editor (in Unity);
    and... nothing had happen. :(
    Then I decided to use MonoDevelop IDE and use it for editing Unity scripts (
    I set external editor as Mono (not showing up in select box. You have to provide path to executable)...
    and it worked perfectly!
    But using MonoDevelop strangely increased my CPU usage to high values and i decided just for experiment use VS Code again! And it worked! Suddenly Intellisense started to work!
    That was solution in my case. Hope that this solution will work for you. ;)
    Last edited: Oct 11, 2019
  2. Tinus


    Apr 6, 2009
    Spent all day fixing an issue very similar to this, on Windows 10.

    Since using various 2019.2.x editor versions I would occasionally get Unity into a state where it would not be able to launch VSCode at all.

    VSCode child processes would show nested underneath the Unity Editor process in the Task Manager, but no code window would actually show. I definitely thought it strange that Code would be launched as a sub-process, but didn't know what to make of it for a good while.

    On closing Unity, the sub processes would be orphaned, and needed to be ended manually before VSCode could be launched as standalone again.

    No problems mentioned in either Unity or VSCode log files.

    Stuff I tried that didn't work:
    • Install Visual Studio 2019 latest version to to get MSBuild 16.3.x
    • Install DotNet core 3.0.x
    • Install latest Mono SDK
    • Install DotNet 4.7.1 SDK (was already installed)
    • Changing the way Unity passes command line arguments
    • Disabling all VSCode extensions (safe mode)
    • Deleting all VSCode settings and reinstall from fresh download
      • This worked once, a month ago, but problem returned today
      • Got it to launch properly once, but it broke soon after
    • Install VSCode Insiders Edition
    • Install Unity 2019.3.x beta
    Installing the 2019.3.x beta did point out something useful! In the preferences panel, the UI for selecting External Script Editor now points you to two options for a VSCode install:


    And it lists the option for /bin/code.cmd, which I only then remembered is what I used 6 months ago. Somewhere down the line I had configured it to use the Code.exe and never looked back. *facepalm*

    After setting my editors to use /bin/code.cmd, launching VSCode from Unity appears to work again, including in earlier 2019.2.x versions of the editor.

    Not a batch file expert, but code.cmd apparently sets just enough context to make it work:

    Code (CSharp):
    1. @echo off
    2. setlocal
    3. set VSCODE_DEV=
    5. "%~dp0..\Code.exe" "%~dp0..\resources\app\out\cli.js" %*
    6. endlocal
    (edit: only just noticed that this thread is in the Linux section of the forums... oh well)
    Last edited: Oct 11, 2019
  3. hunabku94


    Jun 12, 2017
  4. hongjiaqi


    Aug 8, 2017
    I tried several solutions but none worked for me. But finally I fixed my vscode integration.
    1. Reset packages and update vscode package to 1.1.2. Not really work. This may not be help because Unity still open project in Visual Studio 2019 community instead of vscode.
    2. Use this script, from to reset unity user preference.
    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    4. public class EditorResetPrefs : MonoBehaviour {
    5.     [MenuItem ("Edit/Reset Preferences")]
    6.     static void ResetPrefs() {
    7.         if(EditorUtility.DisplayDialog("Reset editor preferences?", "Reset all editor preferences? This cannot be undone.", "Yes", "No")) {
    8.             EditorPrefs.DeleteAll();
    9.         }
    10.     }
    11. }
    3. Select vscode as external script editor and everything worked again.
  5. Hallur90


    Dec 4, 2017
    I have a project where I suddenly wasn't able to open VScode via Unity.

    However if I create a new project it works as expected.

    Seems like something with the project got corrupted... any ideas?
  6. Hallur90


    Dec 4, 2017
    Reinstalling vscode worked for me.
  7. hongjiaqi


    Aug 8, 2017
    I reset unity user preference then I can open vscode via Unity but now it won't compile when I change code. I don't want to reinstall vscode so I use VS 2019 community now.
  8. GDevYoussef


    Nov 3, 2019
    I deleted the Assembly, sln and userprefs files from the game folder then open it again from unity hub after that VSCode works well
  9. bdilloughery_mvla


    Sep 22, 2017
    Any other fixes?

    My problem:
    Unity 2019.2.7f, can't open VS code with Intellisense/Omnisharp working. Double clicking on files in Unity does nothing except start rogue VS code processes in task manager that I can end task on. Manually opening VS code is great but would love auto-complete to work.

    I tried:
    1. Uninstalling and reinstalling VS code
    2. Reinstalling .NET targetting framework 4.7.2 dev pack
    3. Resetting the external tools preferences to the VS Code exe
    4. Deleting project's Assembly-Csharp.csproj and *.sln from project folder and reopening from Unity Hub

    So far no go.
    I have a bunch of new computers and this error seems to randomly re-crop up on just a few machines. Most are working just fine, but a few just loose the ability to open files. About 2/15 at any given time. Usually one of the 4 methods above fixes the issue. This time it is being especially stubborn.

    Other ideas? Posting to main forum too ...
  10. cobalt_strike


    Feb 24, 2019
    So, best way to go about this. For Ubuntu 18.0.4 LTS

    1) First download and install MonoDevelop -> location /usr/bin/mono

    2) Then get the .net 3.0 framework via terminal

    wget -q -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    sudo add-apt-repository universe
    sudo apt-get update
    sudo apt-get install dotnet-sdk-3.0

    3) Download Visual Studio. Location is /usr/bin/code

    4) Open Visual Studio and Download c# for Visual Studio and Debugger for Unity extensions via the extensions panel on left hand side.

    5) Click debugger on left panel select from the drop down menu "Unity Debugger" near green play button. Then click the settings right next to it and it should open the launch.json file

    5) Close Visual Studio and open Unity Project, then go to edit -> preferences -> external script editor -> select /usr/bin/code

    6) MAKE NEW SCRIPT in your project and double click to open. It should pop up with some errors on the bottom right. Fix them by following the suggestions(The error that says "Unable to watch for file changes in this large workspace.") Is okay to ignore.

    7) Close Unity and Visual Studio. Re-open Unity and then click on that new script that you just made. It should work from now on. At least it did for me!!!