Unity and Visual studio development and debugging environment configuration - tool plug-in installation and configuration

In Unity development, C# scripts are commonly used for function development, and Visual Studio is required for development and debugging. Plug-ins and tools need to be installed in Unity3d and Visual Studio respectively to develop and debug better.

Visual studio installs Unity extension tools

  1. "Tools" → "Get Tools and Features" in visual studio, open the visual studio installer

insert image description here
insert image description here

Install the content related to Unity development, select as follows, mainly "Visual Studio Tools for Unity", others are optional for Unity Hub, if you have installed it yourself, you don't need to install it again.
insert image description here
insert image description here

Settings in Unity

1. Install the plugin "Visual Studio Editor"

  1. Open the package manager, click "window" → "Package Manager" in the menu bar
    insert image description here
    insert image description here

  2. Install the plug-in "Visual Studio Editor". If it already exists, you don't need to install it, but if it doesn't exist, you need to install it (if you use vs code, install "Visual Studio Code Editor")

insert image description here

Installation method:

  1. Change Packages to "Unity Registry", then find "Visual Studio Editor" in the drop-down menu on the left, and click "Install" to install

insert image description here

insert image description here

2. Set up external tools

If you open a script, the following two situations occur:

  1. opened a separate script file in vs without solution and project
  2. Unity-related namespaces and base classes are white and cannot be displayed or an error is reported

insert image description here

You need to set the extension tool in unity

Setting method:

  1. Click on the menu bar "Edit" → "Preferences..."

insert image description here

  1. Open the Preferences preferences interface, and set the External Script Editor in External Tools to visual studio 2022 (change to the version you use)

insert image description here

  1. Then click the button below to regenerate project files (Regenerate project files) to regenerate the solution file and project file

insert image description here

At this point, if you open another script, you can see that the solution and the base class namespace related to unity are displayed normally.
insert image description here

Guess you like

Origin blog.csdn.net/qq_39427511/article/details/130070490