Using Visual Studio Code with Unity

by Michael Sacco Published January 10, 2024
The cover for Using Visual Studio Code with Unity

Using Visual Studio Code makes editing and debugging C# in Unity stress-free. This article will be a quick guide on how to integrate Visual Studio Code as your Integrated Development Environment (IDE) in Unity.


  1. You need to have Unity 2021 or newer installed.
  2. You need to install the latest version of Visual Studio Code.
  3. You need to install the Unity for Visual Studio Code extension from the Extension Marketplace in Visual Studio.

After you have met the above requirements, you can go ahead with setting up VS Code as Unity’s external editor.

How to set up Visual Studio Code as Unity’s external editor?

  1. Ensure your Visual Studio Editor package in Unity is updated to 2.0.20 or above. This is because the Unity extension for Visual Studio Code depends on the newer versions of the Visual Studio Editor package.
  2. Next, set VS Code as Unity’s external editor by selecting your Visual Studio Code version installed under the External Script Editor drop-down. You can find this drop-down by opening up Unity Preferences and then clicking on External Tools.

By following these steps, you are now ready to start editing and debugging your Unity’s C# script with VS Code.

Basic Editing with VS Code in Unity

VS Code is rich in advanced features you need for productive code editing. Here are some of the features:

  • Multiple selections: VS Code supports multiple selections to enhance the editing process. This is done by the creation of multiple cursors. A simple shortcut to achieve this is Shift+Alt+Down/Shift+Alt+Up to insert cursors below or above.
  • Shrink/Expand selection: This is another feature to quickly shrink or expand the currently highlighted area. A simple shortcut to achieve this is Shift+Alt+Right to expand a selection to the right or Shift+Alt+Left for otherwise.
  • Column selection: This particular feature helps to select a particular column. This can be done by holding Shift+Alt while dragging the cursor from one corner of the column to the opposite corner.
  • Auto Save: You can use Ctrl+S to save the current file by default in VS Code. However, there’s an option to turn on Auto Save in VS Code. No need to “Ctrl+S” every time. You can turn on this option by clicking on the Auto Save option in the File Menu.
  • IntelliSense: VS Code offers word completion while working on your C# script. You can manually trigger it with the shortcut Ctrl+Space.
  • Formatting: VS Code has great support for code formatting. To format an active file, you can use the shortcut Ctrl+Shift+I while you can use the shortcut Ctrl+K Ctrl+F to format a selected text.

There are other cool editing features in VS Code apart from the ones listed above.

Debugging with VS Code in Unity

VS Code makes debugging your C# scripts stress-free. By default, a Unity debugger is already attached to your project. All you need is just to press F5 to start your debugging process.


Now, this article has provided you with all you need to get started with using Visual Studio Code in Unity. You can visit the Visual Studio Code official docs to get more information.

Start coding away!

Free download: Indie Game Marketing Checklist

Download now


intro to unity

Don't forget to share this post!

Popular assets for Unity

See all assets ->
    Cutting-edge volumetric fog and volumetric lighting with support for transparent materials.
    Volumetric clouds, day night cycles, dynamic skies, global lighting, weather effects, and planets and moons.
    A lightweight procedural skybox ideal for semi-stylized projects.
    Image-based Outlines for 2D and 3D games with variable line weight, color, and displacement options.
    Drag-and-drop ready-to-use ambient, impact, and spell particle effects.
    Per-pixel gaussian blur on your entire screen, part of the UI, or in-scene objects.

Free Indie Game Marketing Checklist

Learn how to make your game successful with this handy checklist.

Download for free