Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Photon Pun assembly reference with Visual Studio Code 1.50.1

I am developing Unity game apps on a PC using C#, using Visual Studio Code as the editor. The apps are targeted at PC and Android. Multiplayer uses Photon Pun 2.

The Unity version is 2019.3.14F1 - I don't want to move forward just yet in case of 'unexpected problems'.

The VS Code version was 1.48.3 - and everything was fine, no compile errors, all code working OK etc.

Stupidly, I took Microsoft's advice to update VSC, and VS Code went to 1.50.1. Result of this is that there are all sorts of errors showing up in VS Code relating to the Photon code. All these errors stem back to the 'using Photon.Pun;' line. It says "the type or namespace name 'Pun' does not exist in the namespace 'Photon' (are you missing an assembly reference?)".

The code however does not come up with any compile errors in the Unity editor itself, and it all runs fine, including the Photon parts. The problem is in VS Code.

I realise this is almost certainly as VS Code problem, not Photon, but I am wondering if anyone has met this before and knows how to fix it?

(This is why I do not want to move from 2019.3.14F1 to 2020.whatever at the moment - you never know what might happen).

like image 933
nmw01223 Avatar asked Oct 16 '25 02:10

nmw01223


2 Answers

I had the same problem. Installing different versions of VS Code / VS Community Edition didn't fix anything for me, but this did:

With the project open in VS Code, find all occurrences of

<ReferenceOutputAssembly>false</ReferenceOutputAssembly>

in *.csproj files, and replace them with

<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
like image 98
4026 Avatar answered Oct 17 '25 21:10

4026


I was wrong.

To-day, the errors are back.

The reason appears to be that in the process of trying to sort this, I installed VS Community Edition 2019 to see if that worked OK (it did). Then went back to VSC, and - that was fine too. Later I uninstalled VS Community Edition 2019 (it is taking about 4GB). It was uninstalling that which brought the errors back into VSC. Reinstalled VS Community Edition 2019, and it is all fine again.

So, VS Community Edition 2019 installs something that VSC needs - but I haven't yet figured out what it is.

UPDATE:

Gave up. Never managed to find out what VSC wanted and wasn't getting. Instead, reinstalled old version of VSC (1.48.2 from code.visualstudio.com/updates) and it is all fine again.

like image 42
nmw01223 Avatar answered Oct 17 '25 20:10

nmw01223