How to Fix IntelliSense and Symbols in VS Code for Unity C# Scripts

Published: Saturday, July 23, 2022

Greetings, friends! I was working on a game with some friends, and some of us noticed that we couldn't use IntelliSense in VS Code. In this tutorial, I'll show how this issue was resolved!

Unity lets us use VS Code as our IDE instead of Visual Studio. There is a great article on Unity Development with VS Code on VS Code's official website that discusses how to use .NET in VS Code. One of the steps mentions that we need to install Microsoft's official C# extension.

As of version 1.25.0 of the C# extension, there's one more step we need to do to get IntelliSense and symbol lookup working in VS Code. The changelog for the C# extension mentions that for Mono-based development (e.g. Unity) that requires full .NET framework, we need to set "omnisharp.useModernNet": false" in the extension's settings.

Open up your workspace settings from within VS Code by opening the command palette. The keyboard shortcut for opening the command palette is Command + Shift + P on macOS and Ctrl + Shift + P on Windows. Search for Preferences: Open Workspace Settings and click Enter.

Now that you have the workspace settings opened, do a search for omnisharp.useModernNet. Then, uncheck the checkbox. This will set the value to false in the C# extension's settings.

The omnisharp.useModernNet setting in the C# extension in VS Code.

Once this is done, VS Code will ask you to restart the language server. Agree to this, and the OmniSharp language server will restart.

You might not get any notification that the language server is done restarting, and that's okay. Next, make sure to close out of VS Code. Once you open up VS Code again and navigate to a C# script in your Unity project, you should be able to use IntelliSense again!

Hovering over the function, EndOfGame, causes a popup to appear with information about where EndOfGame is defined.

It may take a few minutes before the symbols are discovered in VS Code and the IntelliSense starts working again. The "OUTPUT" tab of VS Code's integrated terminal will likely have a bunch of logs that mention that the Unity project is being updated. This is a sign that things are working and symbols are being discovered. Look at all these symbols!

A list of symbols in Photon's Asteroids Game Manager.

I hope this helps solve a common issue people may face when developing games with Unity. IntelliSense drastically speeds up development and helps us learn how code works. My friends and I have been working with Photon PUN to make a multiplayer game, and having IntelliSense makes the process of learning Photon much easier!

Resources