after I updated my Visual Studio Community 2022 to the newest version it doesn't highlight code in my Unity project.
I have Unity package installed in the VS Installer. I tried reinstalling this package. I tried re-generating .csproj in unity. Nothing works.
CodePudding user response:
Try the following solutions.
Select External Tools in Unity's Edit-Preferences, and select the vs version to be used in the External Script Editor, so that this vs will be started by default when it is started.
Double-click to start your own script. It is found that although the script is successfully opened with vs, there is no prompt function or code highlighting. If the project is not loaded, click a sln format file under the unity project to open it.
If the project is loaded, there is still no code highlighting. This means that when you load the project file, the script file is not loaded. Load the test.cs script file here. Right-click and select "Include in Project". You can see that the icon of test.cs is lit, and the class name MonoBehaviour in the test.cs file is also lit. This means that vs can already recognize the code in the c# script.