Unity Mirror not Importing correctly

I was following this tutorial https://www.youtube.com/watch?v=8VVgIjWBXks about making a multiplayer game in unity using Mirror https://assetstore.unity.com/packages/tools/network/mirror-129321.

So obviously I went to the asset store and imported it... (I'm using unity 2020.1) But now it's throwing a ton of errors and not letting me use "using Mirror;"

VSCode says: The type or namespace name 'Mirror' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]

Interestingly enough I can run the game without any issues even with all the errors but when I try in my code to "using Mirror;" it doesn't work

I tried reimporting and restarting the project, regenerating .csproj files, and even trying on different unity versions but nothing worked. I'm assuming that the Mirror package itself is totally fine but I'm doing something stupid....

Any idea what I could do?

This seems to be the problem: enter image description hereenter image description here


Solution 1:

Most likely the version of VS Code you have installed, reverting VS Code C# Extension from 1.23 to 1.22.

The short term fix involves literally deleting Mirror from Unity and re-importing it from the Package Manager. Also deleting *.vscode and *.SLN files.

A proper discussion about this issue is found at Omnisharp-vscode GitHub page.

I had to ensure player settings had scripting define symbols:

  • MIRROR
  • MIRROR_17_0_OR_NEWER