Home > Mobile >  Unity Api Compability Level is .NET Standard 2 but Visual Studio keeps using .NET v4.7.1
Unity Api Compability Level is .NET Standard 2 but Visual Studio keeps using .NET v4.7.1

Time:11-19

I'm using unity 2020.1.1f1 , I recently noticed I'm using all of .NET 4.x features, new syntax like Auto-property initializers as in public int Health { get; set; } = 100; and so many others mentioned enter image description here

CodePudding user response:

The first is to update the NET version of VS: Project -> Properties.

Modify the .NET version used by the Unity project.

  1. In the Unity editor, click the menu Edit -> Project Setting -> Player.

  2. Select the corresponding .NET version in Scripting Runtime Version*.

enter image description here

reference link: enter image description here

At this time, please check whether the Visual Studio Editor exists in the Unity of the current project: Window → Package Manager.

enter image description here

enter image description here

If it does not exist, switch Packages:Unity Registry in Package Manager, search for Visual Studio Editor, and click Install in the lower right corner.

enter image description here

Finally, Edit → Preferences... → External Tools, the selection box on the right side of the External Script Editor. Check the currently installed version of VS.

enter image description here

Reference document: https://learn.microsoft.com/en-us/visualstudio/gamedev/unity/troubleshooting/troubleshooting-and-known-issues-visual-studio-tools-for-unity#incompatible-project-in-visual-studio.

Hope it helps you.

  • Related