Unity has MonoDevelop as a built-in code editor. But not many developers love it. Among many alternatives of MonoDevelop, Visual Studio Code is a good choice for editing and debugging Unity’s C# files.
Table of Contents
Download Visual Studio Code
You can download the stable build directly from Visual Studio website. In case you want to test new features which are being built, VS Code Insiders should be your choice.
Set VS Code as default script editor
In Unity, open Unity’s preferences window by access Edit > Preferences. Then on External Tools, browse to the folder VS Code was installed in order to set it as default external script editor. After that, double-clicking on a script file will open it in this editor.
VS Code supports most common features of a script editor such as Syntax Highlighting, IntelliSense, Snippets, and CodeLens.
Install Unity Extensions
Before using the editor, you need to install some extensions from VS Code Extension Marketplace, which will help you writing code for Unity faster.
In VS Code, open Extension tabs or press Ctrl + Shift + X then type “Unity” in the search box to search for all extensions related to Unity. There are 3 extensions you need to install.
- Debugger for Unity – It allows Visual Studio Code to debug your Unity C# projects.
- Unity Snippets – It provides code snippets for working with Unity C# scripts.
- Unity Tools – It adds miscellaneous functionality to VS Code for Unity developers.