Debug Unity scripts in Visual Studio 2019

Hello,

I have a beginner question:
When I open a script from Unity in Visual Studio 2019, I cannot debug my code it’s greyed out. And there is no underlines under errors (when a semi-column is missing for example).
I know I can do all that if I open a solution, but in Unity it’s just a script.

Thanks!

  1. Make sure you have installed Visual Studio Editor in package manager.
  2. Under Edit>Preferences>External tools>External Script Editor, make sure Visual Studio 2019 is selected.
  3. In Visual Studio 2019, go to Tools>Get Tools and Features>Workloads>Gaming, make sure Game development with Unity is installed.
  4. In Visual Studio 2019, go to Tools>Options and make sure the intellisense is enabled. Check the attached screenshot.

Thank you!