Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Visual Studio Code stopped launching from Unity.

Discussion in 'Editor & General Support' started by Olmi, Oct 5, 2019.

  1. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    I've had this same issue with Unity for a few weeks now so I thought to ask if anyone else is experiencing the same; my VS Code stops launching from Unity. This happened again after I installed latest Unity 2019.3 beta a while ago today. Earlier I've managed to get this fixed by re-installing VS Code but that is too tedious and is really not a fix for this as I've done that already many times when VS Code just suddenly stops launching.

    When I click a file with associated extension (like a shader or a C# script) a few cursor blinks happen as if something is going to start, but nothing starts. Sometimes VS Code opens in background (somewhere) and I can see the process in Windows Task Manager but the window is nowhere to be found. If I kill the task and open VS Code from it's icon, I can see the file I tried to open in the "Open Recent" sub-menu under File menu.

    I'm in Windows 10 and got the latest Unity VS Code extension installed (Visual Studio Code Editor 1.1.2 com.unity.ide.vscode package.)

    EDIT: just finished reinstalling VS Code and yet again that "fixed" the issue, but I'm sure it will fail again in a few hours if not earlier.
     
  2. Macklin

    Macklin

    Joined:
    Jun 13, 2015
    Posts:
    11
    Olmi and zIyaGtVm like this.
  3. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    That .cmd file selection does allow me to launch the scripts, but autocompletion / intellisense is now dead. Forgot to mention earlier that it usually coincides with this failure (at least for me.). The frustrating part is that I don't get any obvious errors like printouts that problems panel in VS Code. Anyway thanks for that tip, it helps a bit but I still need to figure out what would resurrect that intellisense, other than doing complete VS Code reinstall every day...
     
  4. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    I uninstalled Debugger for Unity extension, restarted VS Code and installed it again and intellisense started to function. I've done that a few tiles earlier and it didn't help so I'm not sure if that's a 100% fix. Anyway thanks for the help @Macklin.
     
  5. Macklin

    Macklin

    Joined:
    Jun 13, 2015
    Posts:
    11
    @Olmi Glad you got it (somewhat?) working! I didn't consider Intellisense, and I'm not sure if its function is tied to the external script editor preference in Unity at all. I tested it just now, and regardless of the set editor, Intellisense should work as long as you have generated cs project files with Assets -> Open C# Project. Try deleting the old .csproj and .sln files beforehand too.

    I find whenever I have issues with Intellisense, it's almost always OmniSharp failing to install or update, which can happen on more restrictive networks. The VSCode output logs usually give an indication of what's going wrong, but not always - as you've mentioned. Also make sure to check each type of log in the dropdown (Tasks, .NET, C#, OmniSharp Log, etc.).
     
    Olmi likes this.
  6. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Thanks for the help again. Too bad this problem seems to be repeating itself, it didn't take long to fail again. Well, I just keep re-installing and using these tricks. I think multiple Unity installs might play some role in this issue? I never had these problems earlier, until I started to use 2018, 2019 and 2019.3 betas side by side.
     
  7. Macklin

    Macklin

    Joined:
    Jun 13, 2015
    Posts:
    11
    That's annoying. The Unity Editor shouldn't really have anything to do with Intellisense (unless I'm mistaken), so I don't think having multiple installs would affect anything. As long as there are csproj/sln files, no script errors, and if OmniSharp is working properly, Code should handle everything.

    Only thing I could suggest is to try using a system install of VSCode (as opposed to a user install), that's assuming you're not already running one. And you do have the C# extension installed, right?