I've tried a lot of things already but nothing worked.
I've already reimported, deleted, and reinstalled stuff. I'm using unity 2019.3.0f6 and vs code 1.42.1.
I've tried a lot of things already but nothing worked.
I've already reimported, deleted, and reinstalled stuff. I'm using unity 2019.3.0f6 and vs code 1.42.1.
I found the answer here. https://issuetracker.unity3d.com/issues/upgrading-projects-to-2019-dot-2-0b1-can-introduce-reference-errors-to-unityengine-dot-ui
For those who are facing this problem yet:
1. Remove all .sln and .csproj files
2. Make sure the "Generate all .csproj files." checkbox is checked on Preferences
3. Reopen C# Project
The guy on the comments showed something that even the official VS Code and Unity Integration page didn't mention. And the integration page is already very old. The Unity ui shown there is already different compared to the current 2019.3.0f6 that I am using.
I used Visual Studio Community 2017 and had the same problem (using Unity 2019.3.12f1). After trying a lot of things (none worked), including the answers provided here, what finally worked for me was the following:
This last step has to be done again when Unity regenerates .csproj files. I found that the <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
tags in the generated .csproj files is responsible for this (after re-adding references in Visual Studio, these tags are removed when saved). I verified that manually removing those lines from the .csproj using a text editor also works. I'm not sure if this setting can be managed somehow within Unity.
Remove the Library folder from the project and open it again to resolve this issue.
This will trigger a full reimport and new metadata will be created for a lot of stuff. It's probably not an issue for most, but on a big project, it can take a long time to reimport everything!
In case you want to take a safer approach, do the following:
Hope this helps!
Thats possibly, because you have two UnityEngine.UI references or namespaces.
Here is a possible solution: https://www.google.com/amp/s/pvs-studio.com/en/amp/blog/posts/csharp/0834/