Hello everyone!
When I open Visual Studio Code, I get two error for some of my classes inherited from MonoBehaviour and ScriptableObject: cs0246: The type or namespace name could not be found
For a static class: cs0103:The name ____ does not exist in the current context.
If I open files with these classes and save them again (just “ctrl + s”, nothing more), then the problems disappear. I can build the project even without resolving the problems. But if I close VS Code and open it again, I get these errors again.
All files are placed in the same folders as the files that do not arise any errors.
How can I fix it?
OS: Windows 10, 64bit
Visual Studio Code version: 1.41.1
C# extension version: 1.21.10 (C# for Visual Studio Code (powered by OmniSharp))
Unity version: 2019.3.0f6
Awesome!
Today November 24th, 2020
I had the same issue with Unity 2019.4.13 (LTS) and Visual Studio Code Package (v 1.2.2)
Instead of downgrading to 1.1.3, there was an update for v 1.2.3
I followed the steps of upgrading the package, closing unity, deleting the sln and csproj, then openeing Unity and vscode and it WORKED!
I’m on Unity 2019.4.11f1 and package 1.2.2 and randomly had issues today where only one csproj was working at a time, anything from other namespaces from other csproj files were not being recognised. I followed these steps, downgraded and deleted the .sln and now it’s working normally again. Thank you
I also go this in the past and I’m now on 2019.3.10f1 and still got it. However if you just run and stop your project in unity and make sure all errors are resolved, the missing class imports in vs code will be fixed.
Using Unity 2020.1.2f1 and VS Code 1.51 just follow those (@RahulRaman ) step, except downgrading change to upgrading to current version (1.2.3 on my case). It’s really work.