Setting up Visual Studio Code for Unity

Visual Studio Code without a doubt, most popular and loved code editor in the code editor market. Many developers love working with Vs Code.

If you are one of the lovers of Vs Code and if you want to work with Vs Code together with Unity, this article is for you.


Visual Studio Code must be downloaded beforehand. If it is not installed, you can get it here according to your operating system.

Do not forget to install the .NET SDK required for you to work in .NET, you can install the .NET version you want from here.

Setup .NET SDK

After the SDK installation is complete, we will need to perform a few more operations. As it is known, Vs Code does not come as a ready-made box, unlike an IDE.

For Windows, after the .NET SDK installation is completed, restart your computer so the changes can be saved to %PATH%.

For macOS, after the .NET SDK installation is completed, you must install the latest stable Mono release (click here to install) to avoid the “Some projects have trouble loading” message on Vs Code.

C# extension and OmniSharp configuration

To enable autocomplete, code analysis, and AI-supported code completion you have to set up the C# extension on Vs Code.

After installation is ended, go to the Vs Code settings and uncheck the “Omnisharp: Use Modern Net” setting for enabling the extension.

For Windows, the C# extension no longer ships with Microsoft Build Tools so they must be installed manually. Download the Build Tools for Visual Studio 2022. After that, install the .NET desktop build tools workload (others are unnecessary).

Determinating Vs Code as Unity default editor

When you start your scripts in Unity, you should edit the settings in Unity so that Vs Code opens by default.

To edit it, start Unity and go to Unity preferences, then go to the external tools menu and choose Vs Code as the external script editor.

External Tools Menu Unity (Source: Author)

After all adjustments, we can use Visual Studio Code as a code editor for Unity but still not enough to give load all the work to Vs Code.

More tools for productivity

Visual Studio Code has a large plugin market. Therefore, we can find a solution easily for a problem. In this section, we are going to look best tools for working with Unity and C#.

1 – Change-case

With the help of this plugin, you can change the format (dot, camel case, etc.) of the selected variable name in seconds.

It can also be used with languages other than C#. I think it can be useful for big projects, you can install the plugin directly from here.

2 – Code spell checker

As the name suggests, it is a spell bug checker plugin. It notifies you when you make a typo. Moreover, it can help solve some coding bugs.

It increases the readability of the code by ensuring that you do not make typos in the function, variable, or class names.

It also prevents you from making typos in the comment lines. It’s an all-purpose plugin, you can install a plugin from here.

3 – Unity code snippets

A tool that automates a lot of things, from directly creating a Monobehaviour to creating an OnTriggerEnter function.

It contains all Unity snippets and saves you time while working. It is one of the most important plugins that anyone dealing with Unity should install (install from here).

4 – Rainbow brackets

With this plugin, you can reduce the chance of making mistakes while using brackets. The plugin makes it easier to distinguish brackets by coloring each bracket separately.

Whether it’s C#, C++, or any language, it works fully functionally and makes coding easy for you (download here).

Increase your coding speed with the Vim plugin

If you are switching from the Vim editor to Visual Studio Code or if you think that you will work faster with Vim’s shortcuts (in short, if you like the keyboard so much), you can install the Vim extension.

It can be a bit of a challenge to get used to Vim, but once you get used to it, you can see your coding speed increase easily.

This plugin is perfect for working in the Vim environment without compromising the benefits of Visual Studio Code (download it from here).

Leave a Reply

Your email address will not be published. Required fields are marked *