- Home /
Beginner problem with OnPhotonSerializeView
I have a problem with OnPhotonSerializeView. It says: InvalidCastException: Cannot cast from source type to destination type. PhotonStreamQueue.Deserialize (.Photon.Stream stream) (at Assets/Photon Unity Networking/Plugins/Photon Network/PhotonStreamQueue.cs:168)
My code:
 public Vector3 Joystick;
 private bool FlipBuffer = true;
 
  public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
     {
         if (stream.isWriting)
         {
             stream.SendNext(Joystick);
             stream.SendNext(FlipLocal);
         }
 
         else
         {
             this.Joystick = (Vector3)stream.ReceiveNext();  
             this.FlipBuffer = (bool)stream.ReceiveNext();
         }
 }
Isnt it possible to send bools or Vector3´s over the network via OnPhotonSerializeView? Thanks in advance!
Answer by sudoman281 · Aug 04, 2017 at 09:26 PM
I'm not sure if Joystick is not a class in Unity. Maybe try renaming your variables. I would recommend you to use _ for the private variables. _joystick, _flipBuffer, ....
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Instantiating scene objects in Photon Multiplayer. 0 Answers
Shooting myself 0 Answers
How to connect to our own dedicated server using photon networking in unity?(Self-hosted) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                