Version: 2023.2
设置脚本编写环境
Debug C# code in Unity

集成开发环境 (IDE) 支持

An integrated development environment (IDE) is a piece of computer software that provides tools and facilities to make it easier to develop other pieces of software. Unity supports the following IDEs:

  • Visual Studio
  • Visual Studio Code
  • JetBrains Rider

Visual Studio(Windows 和 macOS 上的默认集成开发环境)

When you install Unity on Windows and macOS, by default Unity also installs Visual Studio or Visual Studio for Mac, respectively. You can choose to exclude it when you select which components to download and install. By default, the External Script Editor (menu: Unity > Preferences > External Tools > External Script Editor) is set to Visual Studio. When you enable this option, Unity launches Visual Studio and uses it as the default editor for all script files. For more information, see Visual Studio C# Integration.

On macOS, Unity installs Visual Studio for Mac as the C# IDE. Visual Studio Tools for Unity (VSTU) provides Unity integration for Visual Studio for Mac (VS4M). For information on setting up and using Visual Studio for Mac, see the following Microsoft documentation pages:

Note: On Windows, Unity also includes Visual Studio 2019 Community by default in the installation package.

Visual Studio Code(Windows、macOS、Linux)

Unity supports opening scripts in Visual Studio Code (VS Code). To open scripts in VS Code, go to Unity > Preferences > External Tools > External Script Editor and select Visual Studio Code. For information on using VS Code with Unity, see Visual Studio’s documentation on Unity Development with VS Code.

先决条件

为了使用 Visual Studio Code 进行 C# 代码编辑并获得 Unity C# 调试支持,需要安装:

JetBrains Rider(Windows、macOS、Linux)

Unity supports opening scripts in JetBrains Rider. To open scripts in Rider, go to Unity > Preferences > External Tools > External Script Editor and select Rider.

Rider is based on ReSharper and includes most of its features. It supports all of C# 7.2’s features as well as C# debugging on the .NET 4.6 scripting runtime in Unity. For more information, see JetBrains’ documentation on Rider for Unity.


  • 2019–04–18 页面已发布
设置脚本编写环境
Debug C# code in Unity