DEV Community

Ryo Kuroyanagi
Ryo Kuroyanagi

Posted on

How to use VSCode for coding on Unity

TL;DR

  • Install C# Plugin for VS Code
  • Install .NET Core and .NET Framework
  • Generate project files (.csproj) by Unity preference menu

Background & Overview

Always I start using new PC, I get stuck with setting up VSCode for Unity programming. This is a quick note for people who are willing to set up VS Code for Unity. In the following sections, I explain how to enable intellisense on VSCode. Please note that I do not explain how to set up debugging (inserting breakpoint etc.).

Prerequisite

I assume that you have Unity and VSCode on your PC. I'm using Unity 2021 now but the steps may not change event for different Unity versions.

Step 1: Install C# VS Code plugin.

In your extensions search on VS Code or you can find the plugin on this page.

Step 2: Install .NET Core / .NET Framework

At this moment, we can download the SDK from on this page. The URL may change in the future.
I installed .NET Core 7. We need .NET Framework 4.7.1 for that core. I installed .NET Framework 4.8.1 first but it did not work and error messages told me I need ver 4.7.1. You may use another version of .NET Core,

Step 3: Generate C# project files.

On Unity editor, go to preference of editor [Edit] --> [Preferences] --> [External Tools]. Set External Script Editor as Visual Studio Code, check all checkboxes in Generate .csproj files for: section and then click Regenerate project files button.

Wrap-up

That's it! Hope this make your life easier.

Top comments (0)