Caught exception in OnEvent() for event code 206: System.InvalidCastException: Specified cast is not

Now I have used photon for some time now and I have never encountered this error before until recently. Here are the full details of the error

Caught exception in OnEvent() for event code 206: System.InvalidCastException: Specified cast is not valid.

UnityEngine.Debug:LogError (object)

NetworkingPeer:DebugReturn (ExitGames.Client.Photon.DebugLevel,string) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1611)

ExitGames.Client.Photon.PeerBase/<>c__DisplayClass108_0:<EnqueueDebugReturn>b__0 ()

ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands ()

ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands ()

PhotonHandler:Update () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)

This is a very huge issue since whenever I join or create a game, it won't load any player's characteristic only if it is on a build, but if I create or join a game in Editor, no problem has occurred. I wish I can get a script to fix this, but unfortunately, I cannot find the main script that deals with joining or leaving.

Comments

  • Sorry for the late reply. This would have been better in the PUN 2 forum.

    Which PUN 2 version do you use?

    Did you try attaching the debugger and just breaking at the error's line of code?