Getting a red underline when referencing a script in a variable

Review some basic C# syntax

public class MyClass
{
  // variables here

  // functions here:
  void MyMethod()
  {
    // code here
  }
}

EDIT: I misread what you’re doing. Does Unity complain about it in the console, or just Visual studio? If it’s just in VS, this may help you with intellisense problems:

Also, try update the VSCode package inside of Unity: Window → Package Manager → Search for Visual Studio Code Editor → Press the Update button

Also, this: No suggestions in Vscode