Version: 5.6
RenderDoc 集成

Visual Studio C# 集成

What does this feature get me?

一种更完善的 C# 开发环境。 智能自动补齐、基于计算机辅助的源文件更改、智能语法突出显示等。

What’s the difference between Express and Pro?

VisualStudio C# 2010 is a product from Microsoft. It comes in an Express and a Professional edition. The Express edition is free, and you can download it from here.
The Professional edition is not free, you can find out more information about it here.

Unity’s VisualStudio integration allows you to create and maintain VisualStudio project files automatically. Also, VisualStudio will open when you double click on a script or on an error message in the Unity console.

I’ve got Visual Studio Express, how do I use it?

  • In Unity, select from the menu Assets->Sync MonoDevelop Project
  • Find the newly created .sln file in your Unity project (one folder up from your Assets folder)
  • Open that file with Visual Studio Express.
  • You can now edit all your script files, and switch back to Unity to use them.

I’ve got Visual Studio Professional, how do I use it?

  • In Unity, go to Edit->Preferences, and make sure that Visual Studio is selected as your preferred external editor.
  • Doubleclick a C# file in your project. Visual Studio should automatically open that file for you.
  • You can edit the file, save, and switch back to Unity.

A few things to watch out for:

  • 尽管 Visual Studio 附带了自己的 C# 编译器,并且您可以使用它来检查 # 脚本中是否存在错误,但 Unity 仍然使用自己的 C# 编译器来编译脚本。使用 Visual Studio 编译器仍然非常有用,因为这意味着不必一直切换到 Unity 来检查是否有任何错误。

  • Visual Studio’s C# compiler has some more features than Unity’s C# compiler currently has. This means that some code (especially newer c# features) will not give an error in Visual Studio but will give an error in Unity.

  • Unity 会自动创建和维护 Visual Studio .sln 和 .csproj 文件。每当在 Unity 中添加/重命名/移动/删除文件时,Unity 都会重新生成 .sln 和 .csproj 文件。也可以从 Visual Studio 向解决方案添加文件。Unity 随后会导入这些新文件,下次 Unity 再次创建项目文件时,便会使用包含的新文件进行创建。

  • Unity does not regenerate the Visual Studio project files after an AssetServer update, or a SVN update. You can manually ask Unity to regenerate the Visual Studio project files through the menu: Assets->Sync MonoDevelop Project

RenderDoc 集成