I dont know what photon.pun.photon stream queue.deserialize is and how to fix this error

Options

InvalidCastException: Specified cast is not valid.

Photon.Pun.PhotonStreamQueue.Deserialize (Photon.Pun.PhotonStream stream) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonStreamQueue.cs:177)

Photon.Pun.PhotonAnimatorView.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/Views/PhotonAnimatorView.cs:564)

Photon.Pun.PhotonView.DeserializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:544)

Photon.Pun.PhotonView.DeserializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:534)

Photon.Pun.PhotonNetwork.OnSerializeRead (System.Object[] data, Photon.Realtime.Player sender, System.Int32 networkTime, System.Int16 correctPrefix) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1862)

Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2233)

Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3365)

ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:899)

ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:583)

ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1771)

Photon.Pun.PhotonHandler.Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:226)

Rethrow as AggregateException: Caught 1 exception(s) in methods called by DispatchIncomingCommands(). Rethrowing first only (see above). (Specified cast is not valid.)

Photon.Pun.PhotonHandler.Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:244)

Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:145)

Answers

  • Trimatra
    Options

    Same here, mine was in PhotonTransformView, i tried use try-catch to check, turns out that the PhotonTransformView Try to cast -1 to Vector3 which is invalid, anyway this should not be happening! i dont know why the PhotonTransformView receive -1 on stream.ReceiveNext(), do you find any solution?