Home > Mobile >  Visual Studio code highlight doesn't work with Unity project
Visual Studio code highlight doesn't work with Unity project

Time:10-28

after I updated my Visual Studio Community 2022 to the newest version it doesn't highlight code in my Unity project.

Thats how my vs looks.

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.

  1. 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.

  2. 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.

    enter image description here

  3. 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.

    enter image description here

  • Related