Namespace Photon.Pun and MonoBehaviourPunCallbacks does not exist.

Options
Hi, I'm getting lots of Photon related missing references for some reason. I was working on adding some models in my scene for a map, when I finished I went back to my MainMenu scene, opened my MenuController script and saw that all of the Photon related variables like PhotonView, PhotonNetwork etc are highlighted red. For some reason MonoBehaviourPunCallbacks does not exist and using Photon.Pun; also. I haven't touched the Photon Folder and wasn't scripting since yesterday, but a couple hours earlier the problem wasn't there. I tried deleting ScriptAssemblies folder, updating Visual Studio to 16.9.3 version but that didn't helped. The weirdest thing is that the errors are showing only in Visual Studio, in Unity the Console window is clear. Even after I build the project, I can still play the game and connect with other users. JWRbH1O.pnghttps://pasteboard.co/JWRbH1O.png


Edit: So I have temporarily fixed this by clicking on MonoBehaviourPunCallbacks in VS took Quick Action option and it created a new Class called MonoBehaviourPunCallbacks, then I searched for that class in Unity and deleted it. After re-opening my scripts with VS the MonoBehaviourPunCallbacks class was showing and working.

Answers

  • Tobias
    Tobias admin
    edited April 2021
    Options
    This sounds like an issue with Unity. There are a few unlucky versions that don't interact well with some VS versions.
    It's usually not just a PUN issue so you might find more info about this in the Unity forum.

    Your solution sounds odd. Can't really say if that makes sense in some way (to Unity / VS)...