1
\$\begingroup\$

I didn't use VSCode since two weeks ago. Today, I opened my Unity Project. VSCode updated some extensions and unhappily, Intellisense doesn't work anymore. I didn't change VSCode settings — all configuration is the same as before. I don't know how to fix it. I noticed that the C# icon has changed too. An extension called Unity has been installed too.

Screenshot of VSCode extensions tab

I'm using VSCode 1.81 and Unity 2022.3

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

I recently updated my VSCode extensions too. Here's what I did to ultimately get intellisense working again - note that I haven't tested exhaustively to see if all steps are required or if some had nothing to do with fixing the problem.

  1. Remove old VSCode C# extensions. I read that the old Omnisharp-based C# support is incompatible with the new C# Dev Kit versions based on Roslyn. I kept the following installed (all with the Microsoft developer checkmark):

    • C# - Base language support for C# (ms-dotnettools.csharp)

    • C# Dev Kit - Official C# extension from Microsoft (ms-dotnettools.csdevkit)

    • Unity - Integrates Visual Studio Code with Unity (visualstudiotoolsforunity.vstuc)

    I then closed VS Code for the next steps.

  2. In Unity package manager, ensure Visual Studio Editor package is installed and updated to the latest version (2.0.20 at the time of writing).

    Yes, that's the Visual Studio (not Code) package - according to the Unity VSCode extension docs, the new extension relies on this package, and the old "Visual Studio Code Editor" package is no longer maintained.

  3. In Unity File -> Preferences -> External Tools, set External Script Editor to Visual Studio Code (version 1.81.0 at the time of writing). Note the "Visual Studio Editor v2.0.20 enabled" text below the drop-down.

    Unity preferences screensot

  4. Click the "Regenerate project files" button just below that section in the preferences dialog.

  5. Re-launch VSCode by double-clicking on a C# script in the Unity Project tab.

    Check the VSCode terminal pane - it does some initialization steps, including downloading the .NET runtime if your version doesn't match, and that can take some time. So your intellisense might not kick in until you see the confirmation that the projects have loaded successfully:

Project system initialization finished. 2 project(s) are loaded, and 0 failed to load.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I also reset my VSCODE configuration to default. Everything works fine now. Intellisnse is back. \$\endgroup\$
    – Achie1
    Commented Aug 14, 2023 at 1:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .