Visual Studio Code Unity



  1. Visual Studio Code Unity Setup
  2. Unity Visual Studio Code Completion

Unity Debugger Extension for Visual Studio Code

This extension is not officially supported by Unity Technologies.

Use Visual Studio Code to debug your Unity C# projects.

Setup

  • Open your Unity project folder in the Visual Studio Code.

  • Select the debug view on the left and click the cogwheel.

  • In the drop down list select “Unity Debugger”. If you do not have Unity Debugger in the list, then you already have a .vscode/Launch.json file in your project that you must delete first.
  • You will now have a .vscode/Launch.json file in your Unity project folder and can select which Unity target you wish to debug.
  • All done. You can now debug your C# scripts in VS Code by setting a breakpoint in a C# script from your project, switching to the debug view and clicking the green triangle button to attach to Unity. Enter play mode in Unity and the breakpoint should hit in VS code.

Attach to Process Picker

New in version 1.1.0 it is now possible to select which Unity process you want to attach to from a quick pick menu.

  • In the command palette type 'Unity Attach Debugger'

  • Wait a bit for the Unity processes list to appear at the top of the VS Code window.

  • Select the Unity process you wish to attach the debugger to.

Usage

Strings in the variable view is truncated to 100 characters, with appended ellipsis. 'Example wor...'. To view the entire value of this string add it to the watch fields. In addition, evaluating the variable using the debugger console will reveal the same result.

Building

To build this repository, clone it then get all submodules:

Then open VSCode-UnityDebug.sln in Visual Studio.

-->

VS Code Python Tooling Gets 'Most Requested' Feature: Poetry Support. The wildly popular Python extension for Visual Studio Code is previewing support for Poetry, which eases Python packaging and dependency management. Search results for 'Unity', Visual Studio Code on marketplace.visualstudio.com. Descargar Visual Studio Code:https://code.visualstudio.com/Extensiones:C#:https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharpvscode-icons:ht.

Note

This guide assumes you already have installed Unity using the Unity Hub program. If you are new to Unity, we recommend visiting Unity Learn and complete the Unity Essentials learning path first.

Install Unity support for Visual Studio

Visual Studio Tools for Unity is a free extension that provides support for writing and debugging C# and more. Visit the Tools for Unity overview for a complete list of what the extensions includes.

Note

This installation guide is for Visual Studio. If you're using Visual Studio Code, please visit the Unity Development with VS Code documentation.

  1. Download the Visual Studio installer, or run it if already installed.

  2. Click Modify (if already installed) or Install (for new installations) for your desired version of Visual Studio.

  3. On the Workloads tab, scroll to the Gaming section and select the Game development with Unity workload.

Note

This installation guide is for Visual Studio for Mac. If you're using Visual Studio Code, please visit the Unity Development with VS Code documentation.

Tools for Unity is included with the installation of Visual Studio for Mac and no separate installation steps are required. You can verify this in the Visual Studio for Mac > Extensions > Game Development menu. Visual Studio for Mac Tools for Unity should be enabled.

Check for updates

It's recommended to keep Visual Studio and Visual Studio for Mac updated so you have the latest bug fixes, features, and Unity support. This doesn't require an update of Unity versions.

  1. Click the Help > Check for Updates menu.

  2. If there is an update available, the Visual Studio Installer will show a new version. Click the Update button.

  1. Click the Visual Studio for Mac > Check for Updates... menu to open the Visual Studio Update dialog.
  2. If there is an update available, click the Install button.

Configure Unity to use Visual Studio

By default, Unity should already be configured to use Visual Studio or Visual Studio for Mac as a script editor. You can confirm this or change the external script editor to a specific version of Visual Studio from the Unity Editor.

  1. In the Unity Editor, select the Edit > Preferences menu..

  2. Select the External Tools tab on the left.

  3. The External Script Editor dropdown list provides a way to choose different installations of Visual Studio. You can also click Browse... from the dropdown list to add an unlisted version.

  4. If Browse... was selected, navigate to the Common7/IDE directory inside your Visual Studio installation directory and select devenv.exe. Then, click Open.

  5. Once Visual Studio is selected in the External Script Editor list, confirm that the Editor Attaching checkbox is selected.

  6. Close the Preferences dialog to complete the configuration process.

Unity
  1. In the Unity Editor, select the Unity > Preferences menu..

  2. Select the External Tools tab on the left.

  3. The External Script Editor dropdown list provides a way to choose different installations of Visual Studio. You can also click Browse... from the dropdown list to add an unlisted version.

  4. Close the Preferences dialog to complete the configuration process.

Visual Studio Code Unity Setup

Next steps

Visual Studio Code Unity

Unity Visual Studio Code Completion

To learn how to work with and debug your Unity project in Visual Studio, visit Using Visual Studio Tools for Unity.