Sudden Unity Namespace Errors

When I added the pure C# class, Visual Studio Code started throwing hundreds of errors in the “Problems” tab. Looking at the problems, it was clear that VS Code was no longer recognizing Unity specific namespaces and classes. I fixed these errors by going to

File → Add Folder to Workspace…
and selecting the “Assets” folder in the project

This seemed to clue VSCode into the fact that this is indeed a Unity project, and all my hundreds of strange errors disappeared at once. It was satisfying. Sharing in case this happens to someone else.

Privacy & Terms