Quickstart: Configure Visual Studio for cross-platform development with Unity

In this quickstart, you'll learn how to install the Visual Studio Tools for Unity extension and configure it for developing cantankerous-platform games and apps with Unity. The Visual Studio Tools for Unity extension is free and provides support for writing and debugging C# and more. Visit the Tools for Unity overview for a complete listing of what the extensions includes.

Install Visual Studio and Unity

  1. Download the Visual Studio installer, or open up it if already installed.
  2. Select Modify (if already installed) or Install (for new installations) for your desired version of Visual Studio.
  3. Select the Workloads tab, so select the Game development with Unity workload.
  4. If Unity is non already installed, select the Unity Hub checkbox in the Optional department of the installer.
  5. Select Alter or Install to complete the installation.

Screenshot of the game development with Unity workload box in the installer

When Visual Studio completes the installation process y'all're set to setup Unity.

  1. Open the Unity Hub, which was installed during the Visual Studio Tools for Unity installation.
  2. On the left of the Unity Hub window, select the Installs tab.
  3. Select the Add button.
  4. In the Add Unity Version window, select a version of Unity to install.
  5. Select Next to continue the installation.
  6. In the Add modules to your install step, select Done.

Note

If you've already installed Visual Studio 2022, you can deselect the Microsoft Visual Studio Community 2022 option.

The Unity Hub will continue installing Unity in the background. When it's consummate, you tin can create a new projection past selecting the Projects tab and selecting the New push button.

Tip

Projects are created using the Unity Editor and not Visual Studio.

Visual Studio for Mac Tools for Unity is included with the installation of Visual Studio for Mac and no carve up installation steps are required. You tin verify this in the Visual Studio for Mac > Extensions > Game Development bill of fare. Visual Studio for Mac Tools for Unity should exist enabled.

Screenshot of the Extension Manager view showing Visual Studio for Mac Tools for Unity enabled

Configure Unity to use Visual Studio

By default, Unity should already be configured to use Visual Studio or Visual Studio for Mac equally a script editor. Y'all 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. On the left, select the External Tools tab.

    Screenshot of the External Tools preference menu in the Unity Editor on Windows

Add a version of Visual Studio that is not listed

Information technology's possible to select other versions of Visual Studio that are unlisted and installed in a custom directory.

  1. Select Scan... from the dropdown list.
  2. Navigate to the Common7/IDE directory inside your Visual Studio installation directory and select devenv.exe. And then, click Open.
  3. For Unity 2022 and older simply, confirm that the Editor Attaching checkbox is selected.
  4. Close the Preferences dialog to complete the configuration process.
  1. In the Unity Editor, select the Unity > Preferences carte du jour.

  2. On the left, Select the External Tools tab.

  3. Use the External Script Editor dropdown list provides a way to choose different installations of Visual Studio for Mac.

    Screenshot of the External Tools preference menu in the Unity Editor on macOS

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

Install or update the Visual Studio Editor package

In Unity versions 2022 and newer, a carve up Unity Package is required for the best feel working with IDEs like Visual Studio and Visual Studio for Mac. This should be included past default, but updates are released to this package that y'all can update to at any time.

  1. In the Unity Editor, select the Windows > Package Manager menu.
  2. Select the Visual Studio Editor package.
  3. If a new version is bachelor, select the Update button.

Screenshot of the Package Manager window in the Unity Editor on Windows

Check for updates

It's recommended to go along Visual Studio and Visual Studio for Mac updated then yous accept 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.

    Screenshot of the Check for Updates menu in Visual Studio 2019

  2. If in that location is an update available, the Visual Studio Installer will testify a new version. Click the Update button.

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

Side by side steps

Learn nigh this extension's integration and productivity features, and how to utilize the Visual Studio debugger for Unity development.