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
CodePudding user response:
The first is to update the NET version of VS: Project -> Properties.
Modify the .NET version used by the Unity project.
In the Unity editor, click the menu Edit -> Project Setting -> Player.
Select the corresponding .NET version in Scripting Runtime Version*.
At this time, please check whether the Visual Studio Editor exists in the Unity of the current project: Window → Package Manager.
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.
Finally, Edit → Preferences... → External Tools, the selection box on the right side of the External Script Editor. Check the currently installed version of VS.
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.