Debugging Unity projects in VSCode – 1 minute setup

After publishing my last post about how to use Microsoft’s Visual Studio Code (VSCode) as an replacement IDE for Unity development I’ve received some questions on how to setup debugging in VSCode. So… this article is about  setting up VSCode debugging with Unity.

Setting it up – Step 1 of 1 (yes, it’s easy)

After you have successfully installed VSCode on your system and everything is working between Unity and your new favorite code editor, you have to install the “Unity Debugger Extension for Visual Studio Code”.

Therefor open your Unity project folder in VSCode and press CTRL + P to open the Command Pallete. Enter the following command: “ext install unity-debug” and start the installation. You will be prompted to restart the application after the extension has been installed.

VS Code Command Pallete
VS Code Command Pallete

Next open the debug view on the left (CTRL + SHIFT + D) and select “Unity Editor” in the dropdown menu on the upper left. Press the play symbol and switch to Unity. Run your project and see how VSCode debug view is populated with informations about your running game.

You can now create breakpoints via doubleclick next to the line numbers and step through your code via a small debug menu that is visible while debugging. And that’s it. You can now start debugging you code in your editor while running your project in Unity.

The following screenshot should help you to orient yourself.

VSCode debugging
VSCode debugging enviroment up and running

 

 

 

 

3 thoughts on “Debugging Unity projects in VSCode – 1 minute setup

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.