Unnecessary using directive. [Assembly-CSharp]csharp(CS8019)
The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) [Assembly-CSharp]csharp(CS0234)
Appears sometimes after updating project unity version or after reopening project.
I use VSCode. To fix this. I need every time to:
It’s likely the above can simply be accomplished straight from Unity with Assets → Open C# Project. That resolves like 99% of issues quite cleanly, assuming you have your software installed properly.
Here’s my standard blurb for fixing Visual Studio.
This may help you with intellisense and possibly other Visual Studio integration problems:
Sometimes the fix is as simple as doing Assets → Open C# Project from Unity. Other times it requires more.
Also, try update the VSCode package inside of Unity: Window → Package Manager → Search for Visual Studio Code Editor → Press the Update button
I’m on latest unity (2021.2.3f1). Latest packages for UI (1.0.0), VS Code. Everything works fine, intellisense etc. The only problem I have is that somehow the reference to UnityEngine.UI isn’t being picked up by VS code somehow. This means I get lots of warnings about any script files that references UI stuff.
I’ve tried reimporting assets in unity. I’ve tried the OP steps to install VS, then regenerate for VS. I’m not familiar with using VS but I could open a script, see now errors and UI code completion seemed fine.
If you google for the issue, there are so many results, so this must be a common problem, I’m just not finding a fix that works.
Maybe I should start a new post with all the details.
I just downgraded the VS Code package (closed unity, edited the manifest.json) - went to 1.1.2 by random. Reloaded unity. Deleted sln and csproj. Then I regenerated proj files in unity (where you pick external editor) and opened vs code. All working fine.
I think there’s a bug in newer versions of the vs code cs proj generation. I’ll see if I can report a bug somewhere…