skip to Main Content

I’m using VS code to write c# scripts for my Unity projects.
I got all required extensions and set vs code as the external script editor for Unity.
But when I open c# script on VS Code, the auto completion doesn’t work and vs code fails to highlight keywords.

I fixed the problem few days ago, by deleting all extensions, reload window, reinstall the extensions, restart the language server. The auto-completion and keyword highlighting now works.
But everytime I restart VS code or opening other Unity project’s scripts, the problem happens again, and I have to do the whole process again.

How can I fix this problem once and for all?

2

Answers


  1. Just change your IDE. Yep, there was time I was in love with VSC, but eventually I had problems with Unity too. VSC extensions sometimes are not all-powerfull and can work bad sometimes. Use other IDEs that are created for C# and support Unity for better autocomplete. I use JeyBrains Rider, it’s not free, but has trials for new accounts (you kinda can make infinite accounts, but I don’t know if it is legal), everything works fine there. Maybe VisualStudio (free) can also fit.

    Login or Signup to reply.
  2. Well Ive got the exact same issue just yesterday on Ubuntu. Let me find an answer that fixed it for me… here it is, but it is for linux, so you just have to download everything for windows if you use windows

    I found one: VS Code I did these steps to make it work with
    Itellisense in Linux Mint 20 Cinnamon (son of Ubuntu 20.04):

    1. I assume you already have Unity Editor running with the latest nvidia drivers
    2. Install VS Studio from .deb file (https://code.visualstudio.com/docs/setup/linux)
    3. Open VS Code and install de C# extension OmniSharp (you will be asked to install it when you open VS Code). After tah close VS Code
    4. Install .net SDK from here: https://docs.microsoft.com/es-es/dotnet/core/install/linux-ubuntu#2004-
    5. Install latest Mono release (Ubuntu 20.04): https://www.mono-project.com/download/vs/ But the next line must be
      changed: deb https://download.mono-project.com/repo/ubuntu vs-focal
      main for this one: deb [arch=amd64]
      https://download.mono-project.com/repo/ubuntu vs-focal main

    (just added [arch=amd64] )

    1. Open VS Code, go to menu File – Preferences – Settings – Extension – C# configuration look for "Omnisharp: Use Global Mono", and set it to "always".
    2. Close VS Code
    3. Go to Unity menu Edit – Preferences – External Tools – External Script Editor, and pick "Visual Studio Code"
      7.In the same window, check "Embedded packages", "Local packages", "Built-in packages", "Git packages" and after click on "Regenerate
      project files"

    Hope it helps

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search