Movement is underlined RED (but still works)

movement = playerControls.Movement.Move.ReadValue();

Movement is underlined red, with the error message:

‘PlayerControls’ does not contain a definition for ‘Movement’ and no accessible extension method ‘Movement’ accepting a first argument of type ‘PlayerControls’ could be found (are you missing a using directive or an assembly reference?)

The code still works, but my OCD can’t handle the fact an error is highlighted and the whole script is red in VSCode

Can you please advise?

Thanks

1 Like

The important thing, of course, is if it compiles in Unity (the error messages in VSCode [or Community or Jetbrains Rider] are the code editor’s educated guess, which while usually correct, isn’t always correct).

Now to getting it working correctly… troubleshooting Visual Studio Code is a bit of a moving target.
First, make sure that you have the latest version of the Unity Extension for VS Code installed
Announcing the Unity extension for Visual Studio Code - Visual Studio Blog

Next, make sure that your Visual Studio package is up to date within the Unity Package Manager as well.

Privacy & Terms