Will my VR game crashed because of RPC can't send a longer code?

Hi everyone, I am creating a Whiteboard in my VR multiplayer game, and I want all of the players inside the room to see the changes in texture on the Whiteboard, so I previously decide to go with RPC in order to send the message (Changes in whiteboard) to all the players inside the room, but my game just crashed when the other players try to draw something on the whiteboard, I am thinking if it's because the codes in the message are longer and RPC Photon server is not able to handle the weight so the game crashed, I'm not sure but here's my script:

Void Update(): Calling the "Whiteboard Drawing" method using RPC

Void Draw(): The "Whiteboard Drawing" method which used to change the texture of the whiteboard when the pen touch and hit the whiteboard.

Let me know if you guys have any ideas on this situation, thanks in advance!


  • When you just go over the allowed message size, Photon will not crash your game but disconnect that player.

    An RPC is a REMOTE Procedure Call. You can't call that in Update. PUN 2 usually sends 10x per second. More is possible but we have a limit of messages/sec when using the Public Photon Cloud.

  • I see, first of all, thanks for your explanation, so what do you think about those photon users who need to send more messages through RPC in a multiplayer game? I understand that RPC has a limit, that's why everyone will prefer to go with Photon view, etc. But we don't have photon material/texture/render view so we can't see any changes other than Rigidbody, animator and transform view, how about other Photon users who want to send another type of component messages to the server? Looking forward to your reply, thanks in advance!

  • Tobias
    Tobias admin
    edited October 2022

    Any update (RPC but also PhotonViews / OnPhotonSerializeView updates) are messages. So to stay below the message limit, it does not matter how you send but how often you send it and how many individual messages you need.

    You could write a "manager" and aggregate the game state into a single byte[] and send it via RaiseEvent if you wanted to. This would be one message per RaiseEvent call and it's not bound to PhotonViews, etc. You define what's in there and how to read it.

    how about other Photon users who want to send another type of component messages to the server?

    Please elaborate. Maybe the state and synchronization doc helps.

  • Okay, @Tobias , thank you so much for the explanation, I will try to find a way to send the Whiteboard Texture over the Photon server without exceeding the message limit!